Print error if wlr-layer-shell is not supported
This commit is contained in:
parent
ac272a754e
commit
28f821f1e0
1 changed files with 10 additions and 4 deletions
14
wl-overlay.c
14
wl-overlay.c
|
@ -116,18 +116,19 @@ struct user_request {
|
||||||
|
|
||||||
struct client_state {
|
struct client_state {
|
||||||
struct user_request user_request;
|
struct user_request user_request;
|
||||||
|
bool stop;
|
||||||
|
|
||||||
/* Globals */
|
/* Globals */
|
||||||
struct wl_registry *wl_registry;
|
struct wl_registry *wl_registry;
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
struct wl_shm *wl_shm;
|
struct wl_shm *wl_shm;
|
||||||
struct wl_compositor *wl_compositor;
|
struct wl_compositor *wl_compositor;
|
||||||
|
struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
|
|
||||||
struct wl_seat *wl_seat;
|
struct wl_seat *wl_seat;
|
||||||
/* Objects */
|
/* Objects */
|
||||||
struct zwlr_layer_shell_v1 *layer_shell;
|
|
||||||
struct wl_surface *wl_surface;
|
struct wl_surface *wl_surface;
|
||||||
struct zwlr_layer_surface_v1 *zwlr_surface;
|
struct zwlr_layer_surface_v1 *zwlr_surface;
|
||||||
|
|
||||||
bool stop;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -452,12 +453,17 @@ main(int argc, char *argv[])
|
||||||
state.wl_display = wl_display_connect(NULL);
|
state.wl_display = wl_display_connect(NULL);
|
||||||
if (!state.wl_display) {
|
if (!state.wl_display) {
|
||||||
fprintf(stderr, "Could not connect to Wayland server\n");
|
fprintf(stderr, "Could not connect to Wayland server\n");
|
||||||
return 1;
|
exit(1);
|
||||||
}
|
}
|
||||||
state.wl_registry = wl_display_get_registry(state.wl_display);
|
state.wl_registry = wl_display_get_registry(state.wl_display);
|
||||||
wl_registry_add_listener(state.wl_registry, &wl_registry_listener, &state);
|
wl_registry_add_listener(state.wl_registry, &wl_registry_listener, &state);
|
||||||
wl_display_roundtrip(state.wl_display);
|
wl_display_roundtrip(state.wl_display);
|
||||||
|
|
||||||
|
if (state.layer_shell == NULL) {
|
||||||
|
fprintf(stderr, "Wayland compositor does not support wlr-layer-shell protocol\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
state.wl_surface = wl_compositor_create_surface(state.wl_compositor);
|
state.wl_surface = wl_compositor_create_surface(state.wl_compositor);
|
||||||
state.zwlr_surface = zwlr_layer_shell_v1_get_layer_surface(
|
state.zwlr_surface = zwlr_layer_shell_v1_get_layer_surface(
|
||||||
state.layer_shell, state.wl_surface, NULL, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "wl-overlay");
|
state.layer_shell, state.wl_surface, NULL, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "wl-overlay");
|
||||||
|
|
Loading…
Reference in a new issue