From 91bf9b4d14bcf135809a7fd381ebaf7986042f47 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Mon, 16 Apr 2018 17:53:11 +0900 Subject: wayland renderer: implement bottom --- lib/renderers/wayland/window.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/renderers/wayland/window.c') diff --git a/lib/renderers/wayland/window.c b/lib/renderers/wayland/window.c index 5807bfa..e195e38 100644 --- a/lib/renderers/wayland/window.c +++ b/lib/renderers/wayland/window.c @@ -279,6 +279,19 @@ static const struct zwlr_layer_surface_v1_listener layer_surface_listener = { .closed = layer_surface_closed, }; +void +bm_wl_window_set_bottom(struct window *window, struct wl_display *display, bool bottom) +{ + if (window->bottom == bottom) + return; + + window->bottom = bottom; + + zwlr_layer_surface_v1_set_anchor(window->layer_surface, (window->bottom ? ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM : ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP) | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT); + wl_surface_commit(window->surface); + wl_display_roundtrip(display); +} + bool bm_wl_window_create(struct window *window, struct wl_display *display, struct wl_shm *shm, struct wl_output *output, struct zwlr_layer_shell_v1 *layer_shell, struct wl_surface *surface) { @@ -286,7 +299,7 @@ bm_wl_window_create(struct window *window, struct wl_display *display, struct wl if (layer_shell && (window->layer_surface = zwlr_layer_shell_v1_get_layer_surface(layer_shell, surface, output, ZWLR_LAYER_SHELL_V1_LAYER_TOP, "menu"))) { zwlr_layer_surface_v1_add_listener(window->layer_surface, &layer_surface_listener, window); - zwlr_layer_surface_v1_set_anchor(window->layer_surface, ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT); + zwlr_layer_surface_v1_set_anchor(window->layer_surface, (window->bottom ? ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM : ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP) | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT); zwlr_layer_surface_v1_set_size(window->layer_surface, 0, 32); zwlr_layer_surface_v1_set_keyboard_interactivity(window->layer_surface, true); wl_surface_commit(surface); -- cgit v1.2.3-70-g09d2