diff options
| -rw-r--r-- | src/wlstate.cc | 25 | ||||
| -rw-r--r-- | src/wlstate.h | 1 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/wlstate.cc b/src/wlstate.cc index 674c049..c7c1066 100644 --- a/src/wlstate.cc +++ b/src/wlstate.cc @@ -1,14 +1,24 @@ #include "wlstate.h" #include "utils.h" +#include "xdg-shell.h" #include <string.h> #include <wayland-client-core.h> #include <wayland-client-protocol.h> #define WAYC_VERSION 1 +static void wayc_xdg_wm_base_pong(void *data, struct xdg_wm_base *wm_base, + u32 serial) { + (void)data; + xdg_wm_base_pong(wm_base, serial); +} + +static struct xdg_wm_base_listener WAYC_XDG_WM_BASE_LISTENER = { + wayc_xdg_wm_base_pong, +}; + static void wayc_registry_add(void *data, struct wl_registry *registry, - uint32_t name, const char *interface, - uint32_t version) { + u32 name, const char *interface, u32 version) { (void)version; wayc_notnull(data); @@ -25,25 +35,18 @@ static void wayc_registry_add(void *data, struct wl_registry *registry, state->compositor = compositor; } - if (!strcmp(interface, wl_surface_interface.name)) { - wl_surface_t surface = (wl_surface_t)wl_registry_bind( - registry, name, &wl_surface_interface, WAYC_VERSION); - - wayc_notnull(surface); - state->surface = surface; - } - if (!strcmp(interface, xdg_wm_base_interface.name)) { xdg_wm_base_t wm_base = (xdg_wm_base_t)wl_registry_bind( registry, name, &xdg_wm_base_interface, WAYC_VERSION); wayc_notnull(wm_base); state->wm_base = wm_base; + xdg_wm_base_add_listener(wm_base, &WAYC_XDG_WM_BASE_LISTENER, state); } } static void wayc_registry_remove(void *data, struct wl_registry *registry, - uint32_t name) { + u32 name) { wayc_assert(data != NULL); wayc_assert(registry != NULL); wayc_panic("Registry global removed: name=%u", name); diff --git a/src/wlstate.h b/src/wlstate.h index 3612bdd..20a1e75 100644 --- a/src/wlstate.h +++ b/src/wlstate.h @@ -6,7 +6,6 @@ struct wl_state_s { wl_display_t display; wl_registry_t registry; wl_compositor_t compositor; - wl_surface_t surface; xdg_wm_base_t wm_base; }; |
