Seat: rework Xwayland Override Redirect focus

Instead of stashing the active view and setting Seat.focused to the
Xwayland OR surface when a child OR surface of a currently focused
Xwayland view is given keyboard focus, keep Seat.focused set to the
Xwayland view.

Such Override Redirect surfaces are commonly used for drop down menus
and the like, and river should behave as if the parent Xwayland view
still has focus.

This ensures that the riverctl focus-view next/prev commands continue to
work as expected while a popup is open, the correct focused view title
will be sent over river status, etc.

It's also cleaner to centralize this logic in XwaylandOverrideRedirect
and keep it out of Seat.zig.
This commit is contained in:
Isaac Freund
2023-01-12 11:57:56 +01:00
parent 63610d9440
commit 615beab2e6
4 changed files with 44 additions and 63 deletions

View File

@ -175,16 +175,6 @@ pub fn getConstraints(self: Self) View.Constraints {
/// Called when the xwayland surface is destroyed
fn handleDestroy(listener: *wl.Listener(*wlr.XwaylandSurface), _: *wlr.XwaylandSurface) void {
const self = @fieldParentPtr(Self, "destroy", listener);
const view = self.view;
// Ensure no seat will attempt to access this view after it is destroyed.
var seat_it = server.input_manager.seats.first;
while (seat_it) |seat_node| : (seat_it = seat_node.next) {
const seat = &seat_node.data;
if (seat.activated_xwayland_view == view) {
seat.activated_xwayland_view = null;
}
}
// Remove listeners that are active for the entire lifetime of the view
self.destroy.link.remove();