forked from speedie/spmenu
fix some x11 stuff
This commit is contained in:
parent
5ecd718daa
commit
29365cd10e
|
@ -27,9 +27,7 @@ void handle_wl(void) {
|
||||||
init_disp(&state);
|
init_disp(&state);
|
||||||
|
|
||||||
if (no_display) {
|
if (no_display) {
|
||||||
protocol = 0;
|
die("spmenu: failed to connect to wayland display");
|
||||||
handle();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_layer(&state, "spmenu");
|
create_layer(&state, "spmenu");
|
||||||
|
|
|
@ -491,14 +491,21 @@ int roundtrip(struct state *state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int connect_display(struct state *state) {
|
||||||
|
state->display = wl_display_connect(NULL);
|
||||||
|
|
||||||
|
if (state->display) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If this function returns 1, something went wrong.
|
/* If this function returns 1, something went wrong.
|
||||||
* This may be that the user is using X11, or a compositor like Mutter.
|
* This may be that the user is using X11, or a compositor like Mutter.
|
||||||
* In this case, it may be a good idea to fall back to X11.
|
* In this case, it may be a good idea to fall back to X11.
|
||||||
*/
|
*/
|
||||||
int init_disp(struct state *state) {
|
int init_disp(struct state *state) {
|
||||||
state->display = wl_display_connect(NULL);
|
|
||||||
|
|
||||||
// Open display
|
|
||||||
if (!state->display) {
|
if (!state->display) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -129,6 +129,7 @@ static void buttonpress_wl(uint32_t button, double ex, double ey);
|
||||||
static int is_correct_modifier(struct state *state, char *modifier);
|
static int is_correct_modifier(struct state *state, char *modifier);
|
||||||
static int roundtrip(struct state *state);
|
static int roundtrip(struct state *state);
|
||||||
static int init_disp(struct state *state);
|
static int init_disp(struct state *state);
|
||||||
|
static int connect_display(struct state *state);
|
||||||
static int init_keys(struct state *state);
|
static int init_keys(struct state *state);
|
||||||
static int create_layer(struct state *state, char *name);
|
static int create_layer(struct state *state, char *name);
|
||||||
static int anchor_layer(struct state *state, int position);
|
static int anchor_layer(struct state *state, int position);
|
||||||
|
|
6
spmenu.c
6
spmenu.c
|
@ -472,6 +472,12 @@ void handle(void) {
|
||||||
eventloop_x11(); // function is a loop which checks X11 events and calls other functions accordingly
|
eventloop_x11(); // function is a loop which checks X11 events and calls other functions accordingly
|
||||||
#if USEWAYLAND
|
#if USEWAYLAND
|
||||||
} else {
|
} else {
|
||||||
|
if (connect_display(&state)) {
|
||||||
|
protocol = 0;
|
||||||
|
handle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
loadhistory();
|
loadhistory();
|
||||||
store_image_vars();
|
store_image_vars();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue