From 417d50dfe9de25c681ce7ec98dd18b526a46387c Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:01:37 +0100 Subject: [PATCH] Implement cursor input for overlay popups --- src/desktop.c | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/desktop.c b/src/desktop.c index 93875507..07630daf 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -357,6 +357,14 @@ desktop_surface_and_view_at(struct server *server, double lx, double ly, wlr_output_layout_output_coords(output->server->output_layout, wlr_output, &ox, &oy); + /* Overlay-layer popups */ + *surface = layer_surface_popup_at(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], + ox, oy, sx, sy); + if (*surface) { + return NULL; + } + /* Overlay-layer */ *surface = layer_surface_at( &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], @@ -365,6 +373,26 @@ desktop_surface_and_view_at(struct server *server, double lx, double ly, return NULL; } + /* Check for other layer popups */ + *surface = layer_surface_popup_at(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], + ox, oy, sx, sy); + if (*surface) { + return NULL; + } + *surface = layer_surface_popup_at(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], + ox, oy, sx, sy); + if (*surface) { + return NULL; + } + *surface = layer_surface_popup_at(output, + &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], + ox, oy, sx, sy); + if (*surface) { + return NULL; + } + /* Check for unmanaged surfaces */ #if HAVE_XWAYLAND struct xwayland_unmanaged *unmanaged_surface; @@ -381,26 +409,6 @@ desktop_surface_and_view_at(struct server *server, double lx, double ly, } #endif - /* Check all layer popups */ - *surface = layer_surface_popup_at(output, - &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], - ox, oy, sx, sy); - if (*surface) { - return NULL; - } - *surface = layer_surface_popup_at(output, - &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], - ox, oy, sx, sy); - if (*surface) { - return NULL; - } - *surface = layer_surface_popup_at(output, - &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], - ox, oy, sx, sy); - if (*surface) { - return NULL; - } - /* Top-layer */ *surface = layer_surface_at( &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], @@ -409,6 +417,7 @@ desktop_surface_and_view_at(struct server *server, double lx, double ly, return NULL; } + /* Usual views */ struct view *view; wl_list_for_each (view, &server->views, link) { if (!view->mapped) { @@ -431,6 +440,7 @@ desktop_surface_and_view_at(struct server *server, double lx, double ly, } } + /* Bottom and Background layers */ *surface = layer_surface_at( &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], ox, oy, sx, sy);