aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Rasmus Moorats <xx@nns.ee>2021-09-23 17:52:35 +0300
committerLibravatar Kirill Primak <vyivel@posteo.net>2021-10-26 15:13:37 +0300
commitaaf68cf423d718a748b56481fddb37e9186b83ed (patch)
tree62530faa4400d79e17c6ebded8528a9674436f3c
parentrefactor: use JSON_MAX_DEPTH everywhere (diff)
downloadsway-aaf68cf423d718a748b56481fddb37e9186b83ed.tar.gz
sway-aaf68cf423d718a748b56481fddb37e9186b83ed.tar.zst
sway-aaf68cf423d718a748b56481fddb37e9186b83ed.zip
fix cursor input for layer-shell surfaces
previously, fullscreen global containers would grab cursor input even if a shell-layer surface was on top of it related issue: https://github.com/swaywm/sway/issues/6501
-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,
83struct sway_node *node_at_coords( 83struct sway_node *node_at_coords(
84 struct sway_seat *seat, double lx, double ly, 84 struct sway_seat *seat, double lx, double ly,
85 struct wlr_surface **surface, double *sx, double *sy) { 85 struct wlr_surface **surface, double *sx, double *sy) {
86 // check for unmanaged views first 86 // find the output the cursor is on
87 struct wlr_output *wlr_output = wlr_output_layout_output_at(
88 root->output_layout, lx, ly);
89 if (wlr_output == NULL) {
90 return NULL;
91 }
92 struct sway_output *output = wlr_output->data;
93 if (!output || !output->enabled) {
94 // output is being destroyed or is being enabled
95 return NULL;
96 }
97 double ox = lx, oy = ly;
98 wlr_output_layout_output_coords(root->output_layout, wlr_output, &ox, &oy);
99
100 // layer surfaces on the overlay layer are rendered on top
101 if ((*surface = layer_surface_at(output,
102 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
103 ox, oy, sx, sy))) {
104 return NULL;
105 }
106
107 // check for unmanaged views
87#if HAVE_XWAYLAND 108#if HAVE_XWAYLAND
88 struct wl_list *unmanaged = &root->xwayland_unmanaged; 109 struct wl_list *unmanaged = &root->xwayland_unmanaged;
89 struct sway_xwayland_unmanaged *unmanaged_surface; 110 struct sway_xwayland_unmanaged *unmanaged_surface;
@@ -101,19 +122,6 @@ struct sway_node *node_at_coords(
101 } 122 }
102 } 123 }
103#endif 124#endif
104 // find the output the cursor is on
105 struct wlr_output *wlr_output = wlr_output_layout_output_at(
106 root->output_layout, lx, ly);
107 if (wlr_output == NULL) {
108 return NULL;
109 }
110 struct sway_output *output = wlr_output->data;
111 if (!output || !output->enabled) {
112 // output is being destroyed or is being enabled
113 return NULL;
114 }
115 double ox = lx, oy = ly;
116 wlr_output_layout_output_coords(root->output_layout, wlr_output, &ox, &oy);
117 125
118 if (root->fullscreen_global) { 126 if (root->fullscreen_global) {
119 // Try fullscreen container 127 // Try fullscreen container
@@ -131,11 +139,6 @@ struct sway_node *node_at_coords(
131 return NULL; 139 return NULL;
132 } 140 }
133 141
134 if ((*surface = layer_surface_at(output,
135 &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
136 ox, oy, sx, sy))) {
137 return NULL;
138 }
139 if (ws->fullscreen) { 142 if (ws->fullscreen) {
140 // Try transient containers 143 // Try transient containers
141 for (int i = 0; i < ws->floating->length; ++i) { 144 for (int i = 0; i < ws->floating->length; ++i) {