Seat: keep parent Xwayland view of a focused OR surface activated

Xwayland OR menus may disappear if their parent view is deactivated. The
heuristic and ICCCM input model implemented prior, used to determine whether an
OR surface may take focus, does not cover all menus, so retaining parent view
activation works as a catch-all solution for handling unwanted OR menu focus.
This commit is contained in:
Zakariyya Von Forslun
2023-01-11 06:47:05 +10:00
parent f20692e329
commit 63610d9440
2 changed files with 44 additions and 2 deletions

View File

@ -175,6 +175,16 @@ 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();