aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-08-08 13:49:00 +0100
committerLibravatar GitHub <noreply@github.com>2018-08-08 13:49:00 +0100
commit89e176d3fbee3b7f35185dffa71ab42214eb1f3f (patch)
tree2aeea57d78619aad0476e53a422218b929718664
parentMerge pull request #2420 from RyanDwyer/floating-move-to-workspace (diff)
parentDon't call send_pointer_notify_button when doing move or resize (diff)
downloadsway-89e176d3fbee3b7f35185dffa71ab42214eb1f3f.tar.gz
sway-89e176d3fbee3b7f35185dffa71ab42214eb1f3f.tar.zst
sway-89e176d3fbee3b7f35185dffa71ab42214eb1f3f.zip
Merge pull request #2436 from RyanDwyer/fix-floating-deco-focus
Fix focus when clicking floating decorations
-rw-r--r--sway/input/cursor.c4
-rw-r--r--sway/tree/container.c12
2 files changed, 7 insertions, 9 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 80b4f9dc..3f417e96 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -429,6 +429,8 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor,
429 struct sway_container *cont) { 429 struct sway_container *cont) {
430 struct sway_seat *seat = cursor->seat; 430 struct sway_seat *seat = cursor->seat;
431 431
432 seat_set_focus(seat, cont);
433
432 // Deny moving or resizing a fullscreen container 434 // Deny moving or resizing a fullscreen container
433 if (container_is_fullscreen_or_child(cont)) { 435 if (container_is_fullscreen_or_child(cont)) {
434 seat_pointer_notify_button(seat, time_msec, button, state); 436 seat_pointer_notify_button(seat, time_msec, button, state);
@@ -469,8 +471,6 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor,
469 return; 471 return;
470 } 472 }
471 473
472 // Send event to surface
473 seat_set_focus(seat, cont);
474 seat_pointer_notify_button(seat, time_msec, button, state); 474 seat_pointer_notify_button(seat, time_msec, button, state);
475} 475}
476 476
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 4507655e..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,
533 return container; 533 return container;
534} 534}
535 535
536static struct sway_container *container_at_view(struct sway_container *swayc, 536static void surface_at_view(struct sway_container *swayc, double lx, double ly,
537 double lx, double ly,
538 struct wlr_surface **surface, double *sx, double *sy) { 537 struct wlr_surface **surface, double *sx, double *sy) {
539 if (!sway_assert(swayc->type == C_VIEW, "Expected a view")) { 538 if (!sway_assert(swayc->type == C_VIEW, "Expected a view")) {
540 return NULL; 539 return;
541 } 540 }
542 struct sway_view *sview = swayc->sway_view; 541 struct sway_view *sview = swayc->sway_view;
543 double view_sx = lx - sview->x; 542 double view_sx = lx - sview->x;
@@ -567,9 +566,7 @@ static struct sway_container *container_at_view(struct sway_container *swayc,
567 *sx = _sx; 566 *sx = _sx;
568 *sy = _sy; 567 *sy = _sy;
569 *surface = _surface; 568 *surface = _surface;
570 return swayc;
571 } 569 }
572 return NULL;
573} 570}
574 571
575/** 572/**
@@ -682,7 +679,8 @@ struct sway_container *tiling_container_at(
682 struct sway_container *con, double lx, double ly, 679 struct sway_container *con, double lx, double ly,
683 struct wlr_surface **surface, double *sx, double *sy) { 680 struct wlr_surface **surface, double *sx, double *sy) {
684 if (con->type == C_VIEW) { 681 if (con->type == C_VIEW) {
685 return container_at_view(con, lx, ly, surface, sx, sy); 682 surface_at_view(con, lx, ly, surface, sx, sy);
683 return con;
686 } 684 }
687 if (!con->children->length) { 685 if (!con->children->length) {
688 return NULL; 686 return NULL;
@@ -745,7 +743,7 @@ struct sway_container *container_at(struct sway_container *workspace,
745 struct sway_container *focus = 743 struct sway_container *focus =
746 seat_get_focus_inactive(seat, &root_container); 744 seat_get_focus_inactive(seat, &root_container);
747 if (focus && focus->type == C_VIEW) { 745 if (focus && focus->type == C_VIEW) {
748 container_at_view(focus, lx, ly, surface, sx, sy); 746 surface_at_view(focus, lx, ly, surface, sx, sy);
749 if (*surface && surface_is_popup(*surface)) { 747 if (*surface && surface_is_popup(*surface)) {
750 return focus; 748 return focus;
751 } 749 }