Add xdg-decoration

This commit is contained in:
2022-09-09 22:22:36 +02:00
parent 7dc0a6194f
commit cd7ebab4dc
6 changed files with 467 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
#include "keyboard.h"
#include "pointer.h"
#include "protocols/xdg-shell-client-protocol.h"
#include "protocols/xdg-decoration-client-protocol.h"
#include <assert.h>
#include <stdint.h>
@@ -28,6 +29,8 @@ static void registry_handle_global(void *data, struct wl_registry *wl_registry,
state->xdg_wm_base = wl_registry_bind(wl_registry, name, &xdg_wm_base_interface, 3);
} else if (strcmp(interface, wl_seat_interface.name) == 0) {
state->wl_seat = wl_registry_bind(wl_registry, name, &wl_seat_interface, 7);
} else if (strcmp(interface, zxdg_decoration_manager_v1_interface.name) == 0) {
state->xdg_decoration_manager = wl_registry_bind(wl_registry, name, &zxdg_decoration_manager_v1_interface, 1);
}
}
@@ -244,9 +247,14 @@ int main(int argc, char *argv[])
xdg_toplevel_set_title(state.xdg_toplevel, "Example client");
wl_surface_commit(state.wl_surface);
xdg_wm_base_add_listener(state.xdg_wm_base, &xdg_wm_base_listener, &state);
struct wl_callback *cb = wl_surface_frame(state.wl_surface);
wl_callback_add_listener(cb, &wl_surface_frame_listener, &state);
state.xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(state.xdg_decoration_manager, state.xdg_toplevel);
zxdg_toplevel_decoration_v1_set_mode(state.xdg_toplevel_decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
while (wl_display_dispatch(state.wl_display)) {
/* This space deliberately left blank */
}