summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2021-01-13 00:56:33 +1100
committerFurkan Sahin <furkan-dev@proton.me>2021-01-13 00:56:33 +1100
commite16b1a5f1ee64e98171c2dab9e86b55fb75083ba (patch)
tree8f3764929d04c596ea74bb4c02d9c1295b480672
parente5996b8e9638cabe8e2ff987159361cf97bc4026 (diff)
Adhere to ICCCM focus specification
For certain applications (e.g. JetBrains) the parent window controls input. We need to adhere to the ICCCM input focus specification to properly handle these cases. Relates to swaywm/wlroots#2604
-rw-r--r--sway/tree/view.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 07ca3dff..7afcdf31 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -785,7 +785,18 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
view_execute_criteria(view);
- if (should_focus(view)) {
+ bool set_focus = should_focus(view);
+
+#if HAVE_XWAYLAND
+ if (wlr_surface_is_xwayland_surface(wlr_surface)) {
+ struct wlr_xwayland_surface *xsurface =
+ wlr_xwayland_surface_from_wlr_surface(wlr_surface);
+ set_focus = (wlr_xwayland_icccm_input_model(xsurface) !=
+ WLR_ICCCM_INPUT_MODEL_NONE) && set_focus;
+ }
+#endif
+
+ if (set_focus) {
input_manager_set_focus(&view->container->node);
}