aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-14 18:13:41 -0400
committerDrew DeVault <sir@cmpwn.com>2017-06-14 18:13:41 -0400
commit76fcfa1e7fb98eb815bbb937099ff9fde63d301f (patch)
tree833070bd6cc76d15098370f5d237480f5b577573
parentd158e18308e91f0c4ae81ac86976b0540e5efd84 (diff)
downloadsway-76fcfa1e7fb98eb815bbb937099ff9fde63d301f.zip
sway-76fcfa1e7fb98eb815bbb937099ff9fde63d301f.tar.gz
sway-76fcfa1e7fb98eb815bbb937099ff9fde63d301f.tar.bz2
Force focus on unmanaged views during pointer test
-rw-r--r--sway/container.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sway/container.c b/sway/container.c
index 08aa77a..358ba76 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -699,12 +699,12 @@ static bool pointer_test(swayc_t *view, void *_origin) {
swayc_t *container_under_pointer(void) {
// root.output->workspace
- if (!root_container.focused || !root_container.focused->focused) {
+ if (!root_container.focused) {
return NULL;
}
- swayc_t *lookup = root_container.focused->focused;
+ swayc_t *lookup = root_container.focused;
// Case of empty workspace
- if (lookup->children == 0) {
+ if (lookup->children && !lookup->unmanaged) {
return NULL;
}
struct wlc_point origin;
@@ -712,6 +712,17 @@ swayc_t *container_under_pointer(void) {
while (lookup && lookup->type != C_VIEW) {
int i;
int len;
+ for (int _i = 0; lookup->unmanaged && _i < lookup->unmanaged->length; ++_i) {
+ wlc_handle *handle = lookup->unmanaged->items[_i];
+ const struct wlc_geometry *geo = wlc_view_get_geometry(*handle);
+ if (origin.x >= geo->origin.x && origin.y >= geo->origin.y
+ && origin.x < geo->origin.x + (int)geo->size.w
+ && origin.y < geo->origin.y + (int)geo->size.h) {
+ // Hack: we force focus upon unmanaged views here
+ wlc_view_focus(*handle);
+ return NULL;
+ }
+ }
// if tabbed/stacked go directly to focused container, otherwise search
// children
if (lookup->layout == L_TABBED || lookup->layout == L_STACKED) {