mirror of
https://github.com/swaywm/sway.git
synced 2024-12-01 19:06:38 +00:00
Force focus on unmanaged views during pointer test
This commit is contained in:
parent
d158e18308
commit
76fcfa1e7f
|
@ -699,12 +699,12 @@ static bool pointer_test(swayc_t *view, void *_origin) {
|
||||||
|
|
||||||
swayc_t *container_under_pointer(void) {
|
swayc_t *container_under_pointer(void) {
|
||||||
// root.output->workspace
|
// root.output->workspace
|
||||||
if (!root_container.focused || !root_container.focused->focused) {
|
if (!root_container.focused) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
swayc_t *lookup = root_container.focused->focused;
|
swayc_t *lookup = root_container.focused;
|
||||||
// Case of empty workspace
|
// Case of empty workspace
|
||||||
if (lookup->children == 0) {
|
if (lookup->children && !lookup->unmanaged) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct wlc_point origin;
|
struct wlc_point origin;
|
||||||
|
@ -712,6 +712,17 @@ swayc_t *container_under_pointer(void) {
|
||||||
while (lookup && lookup->type != C_VIEW) {
|
while (lookup && lookup->type != C_VIEW) {
|
||||||
int i;
|
int i;
|
||||||
int len;
|
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
|
// if tabbed/stacked go directly to focused container, otherwise search
|
||||||
// children
|
// children
|
||||||
if (lookup->layout == L_TABBED || lookup->layout == L_STACKED) {
|
if (lookup->layout == L_TABBED || lookup->layout == L_STACKED) {
|
||||||
|
|
Loading…
Reference in a new issue