code: use a tagged union to store focus

This simplifies the code and is more robust than two separate pointers.
This commit is contained in:
Isaac Freund
2020-07-15 14:15:17 +02:00
parent 8afe7c2c87
commit 101f47d78f
11 changed files with 48 additions and 86 deletions

View File

@ -139,11 +139,8 @@ fn handleUnmap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
var it = self.output.root.server.input_manager.seats.first;
while (it) |node| : (it = node.next) {
const seat = &node.data;
if (seat.focused_layer) |current_focus| {
if (current_focus == self) {
seat.setFocusRaw(.{ .none = {} });
}
}
if (seat.focused == .layer and seat.focused.layer == self)
seat.setFocusRaw(.{ .none = {} });
}
// This gives exclusive focus to a keyboard interactive top or overlay layer