From 0b00ff487f7ad2a0abbc3b9315df369db1c99a54 Mon Sep 17 00:00:00 2001 From: bi4k8 Date: Mon, 28 Nov 2022 19:23:23 +0000 Subject: [PATCH] wayland: respond to xdg_wm_base.ping --- src/display-wayland.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/display-wayland.cc b/src/display-wayland.cc index 490179af..4a35d5d9 100644 --- a/src/display-wayland.cc +++ b/src/display-wayland.cc @@ -40,6 +40,7 @@ #include #include +#include #include #endif /* BUILD_WAYLAND */ @@ -301,16 +302,26 @@ struct { struct wl_registry *registry; struct wl_compositor *compositor; struct wl_shm *shm; -/* struct wl_shell *shell; - struct wl_shell_surface *shell_surface;*/ struct wl_surface *surface; struct wl_seat *seat; /* struct wl_pointer *pointer;*/ struct wl_output *output; + struct xdg_wm_base *shell; struct zwlr_layer_shell_v1 *layer_shell; } wl_globals; +static void +xdg_wm_base_ping(void *data, struct xdg_wm_base *shell, uint32_t serial) +{ + xdg_wm_base_pong(shell, serial); +} + +static const struct xdg_wm_base_listener xdg_wm_base_listener = { + /*.ping =*/ &xdg_wm_base_ping, +}; + + static void output_geometry(void *data, struct wl_output *wl_output, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, @@ -383,6 +394,9 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, } else if(strcmp(interface, "wl_output") == 0) { wl_globals.output = static_cast(wl_registry_bind(registry, name, &wl_output_interface, 2)); wl_output_add_listener(wl_globals.output, &output_listener, nullptr); + } else if(strcmp(interface, "xdg_wm_base") == 0) { + wl_globals.shell = static_cast(wl_registry_bind(registry, name, &xdg_wm_base_interface, 1)); + xdg_wm_base_add_listener(wl_globals.shell, &xdg_wm_base_listener, nullptr); } else if(strcmp(interface, "zwlr_layer_shell_v1") == 0) { wl_globals.layer_shell = static_cast(wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1)); }