aboutsummaryrefslogtreecommitdiff
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 1e3e16d6..d8b1abeb 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -83,7 +83,28 @@ static struct wlr_surface *layer_surface_popup_at(struct sway_output *output,
struct sway_node *node_at_coords(
struct sway_seat *seat, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy) {
- // check for unmanaged views first
+ // find the output the cursor is on
+ struct wlr_output *wlr_output = wlr_output_layout_output_at(
+ root->output_layout, lx, ly);
+ if (wlr_output == NULL) {
+ return NULL;
+ }
+ struct sway_output *output = wlr_output->data;
+ if (!output || !output->enabled) {
+ // output is being destroyed or is being enabled
+ return NULL;
+ }
+ double ox = lx, oy = ly;
+ wlr_output_layout_output_coords(root->output_layout, wlr_output, &ox, &oy);
+
+ // layer surfaces on the overlay layer are rendered on top
+ if ((*surface = layer_surface_at(output,
+ &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
+ ox, oy, sx, sy))) {
+ return NULL;
+ }
+
+ // check for unmanaged views
#if HAVE_XWAYLAND
struct wl_list *unmanaged = &root->xwayland_unmanaged;
struct sway_xwayland_unmanaged *unmanaged_surface;
@@ -101,19 +122,6 @@ struct sway_node *node_at_coords(
}
}
#endif
- // find the output the cursor is on
- struct wlr_output *wlr_output = wlr_output_layout_output_at(
- root->output_layout, lx, ly);
- if (wlr_output == NULL) {
- return NULL;
- }
- struct sway_output *output = wlr_output->data;
- if (!output || !output->enabled) {
- // output is being destroyed or is being enabled
- return NULL;
- }
- double ox = lx, oy = ly;
- wlr_output_layout_output_coords(root->output_layout, wlr_output, &ox, &oy);
if (root->fullscreen_global) {
// Try fullscreen container
@@ -131,11 +139,6 @@ struct sway_node *node_at_coords(
return NULL;
}
- if ((*surface = layer_surface_at(output,
- &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
- ox, oy, sx, sy))) {
- return NULL;
- }
if (ws->fullscreen) {
// Try transient containers
for (int i = 0; i < ws->floating->length; ++i) {