diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-06-14 18:13:41 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-06-14 18:13:41 -0400 |
commit | 76fcfa1e7fb98eb815bbb937099ff9fde63d301f (patch) | |
tree | 833070bd6cc76d15098370f5d237480f5b577573 | |
parent | Fix Firefox address bar thing (diff) | |
download | sway-76fcfa1e7fb98eb815bbb937099ff9fde63d301f.tar.gz sway-76fcfa1e7fb98eb815bbb937099ff9fde63d301f.tar.zst sway-76fcfa1e7fb98eb815bbb937099ff9fde63d301f.zip |
Force focus on unmanaged views during pointer test
-rw-r--r-- | sway/container.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sway/container.c b/sway/container.c index 08aa77a8..358ba767 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -699,12 +699,12 @@ static bool pointer_test(swayc_t *view, void *_origin) { | |||
699 | 699 | ||
700 | swayc_t *container_under_pointer(void) { | 700 | swayc_t *container_under_pointer(void) { |
701 | // root.output->workspace | 701 | // root.output->workspace |
702 | if (!root_container.focused || !root_container.focused->focused) { | 702 | if (!root_container.focused) { |
703 | return NULL; | 703 | return NULL; |
704 | } | 704 | } |
705 | swayc_t *lookup = root_container.focused->focused; | 705 | swayc_t *lookup = root_container.focused; |
706 | // Case of empty workspace | 706 | // Case of empty workspace |
707 | if (lookup->children == 0) { | 707 | if (lookup->children && !lookup->unmanaged) { |
708 | return NULL; | 708 | return NULL; |
709 | } | 709 | } |
710 | struct wlc_point origin; | 710 | struct wlc_point origin; |
@@ -712,6 +712,17 @@ swayc_t *container_under_pointer(void) { | |||
712 | while (lookup && lookup->type != C_VIEW) { | 712 | while (lookup && lookup->type != C_VIEW) { |
713 | int i; | 713 | int i; |
714 | int len; | 714 | int len; |
715 | for (int _i = 0; lookup->unmanaged && _i < lookup->unmanaged->length; ++_i) { | ||
716 | wlc_handle *handle = lookup->unmanaged->items[_i]; | ||
717 | const struct wlc_geometry *geo = wlc_view_get_geometry(*handle); | ||
718 | if (origin.x >= geo->origin.x && origin.y >= geo->origin.y | ||
719 | && origin.x < geo->origin.x + (int)geo->size.w | ||
720 | && origin.y < geo->origin.y + (int)geo->size.h) { | ||
721 | // Hack: we force focus upon unmanaged views here | ||
722 | wlc_view_focus(*handle); | ||
723 | return NULL; | ||
724 | } | ||
725 | } | ||
715 | // if tabbed/stacked go directly to focused container, otherwise search | 726 | // if tabbed/stacked go directly to focused container, otherwise search |
716 | // children | 727 | // children |
717 | if (lookup->layout == L_TABBED || lookup->layout == L_STACKED) { | 728 | if (lookup->layout == L_TABBED || lookup->layout == L_STACKED) { |