aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar Versus Void <chaoskeeper@mail.ru>2019-09-05 07:36:09 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2019-09-05 17:41:23 +0300
commit2c1a11016ccb7646a74de51eff003c18e5aa7902 (patch)
treefbc36fafba191cdd6cc8cca791b8eafe46a10e3c /sway/input
parentswaybar: complete barconfig_update event handling (diff)
downloadsway-2c1a11016ccb7646a74de51eff003c18e5aa7902.tar.gz
sway-2c1a11016ccb7646a74de51eff003c18e5aa7902.tar.zst
sway-2c1a11016ccb7646a74de51eff003c18e5aa7902.zip
Do not search for edges on subsurfaces, fix #4381
Subsurfaces (in most cases popups) aren't decorated by sway and will never have any borders, but may be drawn beyond container boundaries producing false positive when searching for edge. So we want to skip edge search when handling mouse event on subsurface.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seatop_default.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index 9087434c..68c617e4 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -58,8 +58,8 @@ static bool edge_is_external(struct sway_container *cont, enum wlr_edges edge) {
58} 58}
59 59
60static enum wlr_edges find_edge(struct sway_container *cont, 60static enum wlr_edges find_edge(struct sway_container *cont,
61 struct sway_cursor *cursor) { 61 struct wlr_surface *surface, struct sway_cursor *cursor) {
62 if (!cont->view) { 62 if (!cont->view || cont->view->surface != surface) {
63 return WLR_EDGE_NONE; 63 return WLR_EDGE_NONE;
64 } 64 }
65 if (cont->border == B_NONE || !cont->border_thickness || 65 if (cont->border == B_NONE || !cont->border_thickness ||
@@ -89,8 +89,8 @@ static enum wlr_edges find_edge(struct sway_container *cont,
89 * Edges that can't be resized are edges of the workspace. 89 * Edges that can't be resized are edges of the workspace.
90 */ 90 */
91static enum wlr_edges find_resize_edge(struct sway_container *cont, 91static enum wlr_edges find_resize_edge(struct sway_container *cont,
92 struct sway_cursor *cursor) { 92 struct wlr_surface *surface, struct sway_cursor *cursor) {
93 enum wlr_edges edge = find_edge(cont, cursor); 93 enum wlr_edges edge = find_edge(cont, surface, cursor);
94 if (edge && !container_is_floating(cont) && edge_is_external(cont, edge)) { 94 if (edge && !container_is_floating(cont) && edge_is_external(cont, edge)) {
95 return WLR_EDGE_NONE; 95 return WLR_EDGE_NONE;
96 } 96 }
@@ -199,7 +199,7 @@ static void cursor_do_rebase(struct sway_cursor *cursor, uint32_t time_msec,
199 } 199 }
200 } else if (node && node->type == N_CONTAINER) { 200 } else if (node && node->type == N_CONTAINER) {
201 // Try a node's resize edge 201 // Try a node's resize edge
202 enum wlr_edges edge = find_resize_edge(node->sway_container, cursor); 202 enum wlr_edges edge = find_resize_edge(node->sway_container, surface, cursor);
203 if (edge == WLR_EDGE_NONE) { 203 if (edge == WLR_EDGE_NONE) {
204 cursor_set_image(cursor, "left_ptr", NULL); 204 cursor_set_image(cursor, "left_ptr", NULL);
205 } else if (container_is_floating(node->sway_container)) { 205 } else if (container_is_floating(node->sway_container)) {
@@ -235,14 +235,15 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
235 double sx, sy; 235 double sx, sy;
236 struct sway_node *node = node_at_coords(seat, 236 struct sway_node *node = node_at_coords(seat,
237 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); 237 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
238
238 struct sway_container *cont = node && node->type == N_CONTAINER ? 239 struct sway_container *cont = node && node->type == N_CONTAINER ?
239 node->sway_container : NULL; 240 node->sway_container : NULL;
240 bool is_floating = cont && container_is_floating(cont); 241 bool is_floating = cont && container_is_floating(cont);
241 bool is_floating_or_child = cont && container_is_floating_or_child(cont); 242 bool is_floating_or_child = cont && container_is_floating_or_child(cont);
242 bool is_fullscreen_or_child = cont && container_is_fullscreen_or_child(cont); 243 bool is_fullscreen_or_child = cont && container_is_fullscreen_or_child(cont);
243 enum wlr_edges edge = cont ? find_edge(cont, cursor) : WLR_EDGE_NONE; 244 enum wlr_edges edge = cont ? find_edge(cont, surface, cursor) : WLR_EDGE_NONE;
244 enum wlr_edges resize_edge = cont && edge ? 245 enum wlr_edges resize_edge = cont && edge ?
245 find_resize_edge(cont, cursor) : WLR_EDGE_NONE; 246 find_resize_edge(cont, surface, cursor) : WLR_EDGE_NONE;
246 bool on_border = edge != WLR_EDGE_NONE; 247 bool on_border = edge != WLR_EDGE_NONE;
247 bool on_contents = cont && !on_border && surface; 248 bool on_contents = cont && !on_border && surface;
248 bool on_workspace = node && node->type == N_WORKSPACE; 249 bool on_workspace = node && node->type == N_WORKSPACE;
@@ -505,7 +506,7 @@ static void handle_axis(struct sway_seat *seat,
505 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); 506 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
506 struct sway_container *cont = node && node->type == N_CONTAINER ? 507 struct sway_container *cont = node && node->type == N_CONTAINER ?
507 node->sway_container : NULL; 508 node->sway_container : NULL;
508 enum wlr_edges edge = cont ? find_edge(cont, cursor) : WLR_EDGE_NONE; 509 enum wlr_edges edge = cont ? find_edge(cont, surface, cursor) : WLR_EDGE_NONE;
509 bool on_border = edge != WLR_EDGE_NONE; 510 bool on_border = edge != WLR_EDGE_NONE;
510 bool on_titlebar = cont && !on_border && !surface; 511 bool on_titlebar = cont && !on_border && !surface;
511 bool on_titlebar_border = cont && on_border && 512 bool on_titlebar_border = cont && on_border &&