cursor: fix crash if focus-follows-cursor is set

Currently we hit a stack overflow as we do not check if the target view
already has keyboard focus before calling Seat.focus() in
Cursor.passthrough(). To fix this, simply add this check.
This commit is contained in:
Isaac Freund
2021-07-29 13:42:36 +02:00
parent f56c892958
commit bae826ef0e

View File

@ -826,9 +826,11 @@ fn passthrough(self: *Self, time: u32) void {
if (follow_mode == .strict or (follow_mode == .normal and focus_change)) {
switch (result.parent) {
.view => |view| {
self.seat.focusOutput(view.output);
self.seat.focus(view);
server.root.startTransaction();
if (self.seat.focused != .view or self.seat.focused.view != view) {
self.seat.focusOutput(view.output);
self.seat.focus(view);
server.root.startTransaction();
}
},
.layer_surface => {},
}