wayland renderer: Fix bottom positioning

- reset size when it changes, so there is no blank below text
 - ignore exclude zone to overlap bar regardless of rendering order
This commit is contained in:
Dominique Martinet 2018-04-28 08:16:21 +09:00
parent f7bb9f953d
commit 610b30364e
3 changed files with 7 additions and 3 deletions

View File

@ -40,7 +40,7 @@ render(const struct bm_menu *menu)
if (wayland->input.code != wayland->input.last_code) {
struct window *window;
wl_list_for_each(window, &wayland->windows, link) {
bm_wl_window_render(window, menu);
bm_wl_window_render(window, wayland->display, menu);
}
wayland->input.last_code = wayland->input.code;
}

View File

@ -117,7 +117,7 @@ struct wayland {
void bm_wl_repeat(struct wayland *wayland);
bool bm_wl_registry_register(struct wayland *wayland);
void bm_wl_registry_destroy(struct wayland *wayland);
void bm_wl_window_render(struct window *window, const struct bm_menu *menu);
void bm_wl_window_render(struct window *window, struct wl_display *display, const struct bm_menu *menu);
void bm_wl_window_set_bottom(struct window *window, struct wl_display *display, bool bottom);
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);
void bm_wl_window_destroy(struct window *window);

View File

@ -204,7 +204,7 @@ static const struct wl_callback_listener listener = {
};
void
bm_wl_window_render(struct window *window, const struct bm_menu *menu)
bm_wl_window_render(struct window *window, struct wl_display *display, const struct bm_menu *menu)
{
assert(window && menu);
@ -229,6 +229,9 @@ bm_wl_window_render(struct window *window, const struct bm_menu *menu)
break;
window->height = result.height;
zwlr_layer_surface_v1_set_size(window->layer_surface, 0, window->height);
wl_surface_commit(window->surface);
wl_display_roundtrip(display);
destroy_buffer(buffer);
}
@ -299,6 +302,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_exclusive_zone(window->layer_surface, -1);
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);