Skip to content

Commit

Permalink
Xwayland: restrict OR focus changes based on ICCCM input model
Browse files Browse the repository at this point in the history
Some popup menus are not covered by the `overrideRedirectWantsFocus()`
heuristic (e.g. in IntelliJ IDEA), so before focusing an OR window,
its input model should also be checked to ensure that it is able to
take input focus. This appears to fix the popup menus in IntelliJ IDEA,
which would otherwise disappear immediately due to unwanted focus.
  • Loading branch information
zakvf authored and ifreund committed Jun 22, 2022
1 parent 5cce490 commit bd03484
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion river/Cursor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ fn handleButton(listener: *wl.Listener(*wlr.Pointer.event.Button), event: *wlr.P
},
.xwayland_override_redirect => |override_redirect| {
if (!build_options.xwayland) unreachable;
if (override_redirect.xwayland_surface.overrideRedirectWantsFocus()) {
if (override_redirect.xwayland_surface.overrideRedirectWantsFocus() and
override_redirect.xwayland_surface.icccmInputModel() != .none)
{
self.seat.setFocusRaw(.{ .xwayland_override_redirect = override_redirect });
}
},
Expand Down
4 changes: 3 additions & 1 deletion river/XwaylandOverrideRedirect.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface:

xwayland_surface.surface.?.events.commit.add(&self.commit);

if (self.xwayland_surface.overrideRedirectWantsFocus()) {
if (self.xwayland_surface.overrideRedirectWantsFocus() and
self.xwayland_surface.icccmInputModel() != .none)
{
server.input_manager.defaultSeat().setFocusRaw(.{ .xwayland_override_redirect = self });
}
}
Expand Down

0 comments on commit bd03484

Please sign in to comment.