aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorIlia Bozhinov <ammen99@gmail.com>2020-01-05 18:36:32 +0200
committerSimon Ser <contact@emersion.fr>2020-01-05 23:17:08 +0100
commitc067fbc010da0eeb1364a391f13e9609b7fd0477 (patch)
treefb231df89552bac8dda67b90d67fb77c45763a0b /xwayland
parent51f8c22f4d72f9e18657baccfff3db544c1c0660 (diff)
xwm: allow applications to change focus between their own surfaces
Although currently this problem is present in only Steam, and it is actually a client bug.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/xwm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index c35a9abc..95f8ed94 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -1234,8 +1234,17 @@ static void xwm_handle_focus_in(struct wlr_xwm *xwm,
// Do not let X clients change the focus behind the compositor's
// back. Reset the focus to the old one if it changed.
- if (!xwm->focus_surface || ev->event != xwm->focus_surface->window_id) {
+ //
+ // Note: Some applications rely on being able to change focus, for ex. Steam:
+ // https://github.com/swaywm/sway/issues/1865
+ // Because of that, we allow changing focus between surfaces belonging to the
+ // same application.
+ struct wlr_xwayland_surface *requested_focus = lookup_surface(xwm, ev->event);
+ if (!xwm->focus_surface || !requested_focus ||
+ requested_focus->pid != xwm->focus_surface->pid) {
xwm_send_focus_window(xwm, xwm->focus_surface);
+ } else {
+ xwm->focus_surface = requested_focus;
}
}