From 1e984fec05c7b63fa65a9b11b77a2c2f639bfc73 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 8 Aug 2018 21:45:58 +1000 Subject: Fix focus when clicking floating decorations It's not right for container_at_view to only return the swayc if a surface was clicked. --- sway/tree/container.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sway/tree/container.c b/sway/tree/container.c index 4507655e..39df86a5 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -567,9 +567,8 @@ static struct sway_container *container_at_view(struct sway_container *swayc, *sx = _sx; *sy = _sy; *surface = _surface; - return swayc; } - return NULL; + return swayc; } /** -- cgit v1.2.3 From a0ece6f95620674514da633584ebdadabf5b4072 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 8 Aug 2018 22:14:11 +1000 Subject: Rename container_at_view to surface_at_view and make it return void --- sway/tree/container.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sway/tree/container.c b/sway/tree/container.c index 39df86a5..aecb2ac6 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -533,11 +533,10 @@ struct sway_container *container_parent(struct sway_container *container, return container; } -static struct sway_container *container_at_view(struct sway_container *swayc, - double lx, double ly, +static void surface_at_view(struct sway_container *swayc, double lx, double ly, struct wlr_surface **surface, double *sx, double *sy) { if (!sway_assert(swayc->type == C_VIEW, "Expected a view")) { - return NULL; + return; } struct sway_view *sview = swayc->sway_view; double view_sx = lx - sview->x; @@ -568,7 +567,6 @@ static struct sway_container *container_at_view(struct sway_container *swayc, *sy = _sy; *surface = _surface; } - return swayc; } /** @@ -681,7 +679,8 @@ struct sway_container *tiling_container_at( struct sway_container *con, double lx, double ly, struct wlr_surface **surface, double *sx, double *sy) { if (con->type == C_VIEW) { - return container_at_view(con, lx, ly, surface, sx, sy); + surface_at_view(con, lx, ly, surface, sx, sy); + return con; } if (!con->children->length) { return NULL; @@ -744,7 +743,7 @@ struct sway_container *container_at(struct sway_container *workspace, struct sway_container *focus = seat_get_focus_inactive(seat, &root_container); if (focus && focus->type == C_VIEW) { - container_at_view(focus, lx, ly, surface, sx, sy); + surface_at_view(focus, lx, ly, surface, sx, sy); if (*surface && surface_is_popup(*surface)) { return focus; } -- cgit v1.2.3 From 4c5dc6f135ce1b46ecffb6440b0b106df0a3e18d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 8 Aug 2018 22:27:21 +1000 Subject: Focus floating views when beginning move/resize operations --- sway/input/cursor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 80b4f9dc..39874b73 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -429,6 +429,9 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, struct sway_container *cont) { struct sway_seat *seat = cursor->seat; + seat_set_focus(seat, cont); + seat_pointer_notify_button(seat, time_msec, button, state); + // Deny moving or resizing a fullscreen container if (container_is_fullscreen_or_child(cont)) { seat_pointer_notify_button(seat, time_msec, button, state); @@ -468,10 +471,6 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, seat_begin_resize(seat, floater, button, edge); return; } - - // Send event to surface - seat_set_focus(seat, cont); - seat_pointer_notify_button(seat, time_msec, button, state); } /** -- cgit v1.2.3 From f5dc3ac09d6f44d51b5bb7f8f5ac863cd228afd8 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 8 Aug 2018 22:32:59 +1000 Subject: Don't call send_pointer_notify_button when doing move or resize --- sway/input/cursor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 39874b73..3f417e96 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -430,7 +430,6 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, struct sway_seat *seat = cursor->seat; seat_set_focus(seat, cont); - seat_pointer_notify_button(seat, time_msec, button, state); // Deny moving or resizing a fullscreen container if (container_is_fullscreen_or_child(cont)) { @@ -471,6 +470,8 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor, seat_begin_resize(seat, floater, button, edge); return; } + + seat_pointer_notify_button(seat, time_msec, button, state); } /** -- cgit v1.2.3