diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-13 21:00:18 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-13 21:00:18 +0200 |
| commit | 8bfca48991ce85f065eea4d2456908eebb9529bc (patch) | |
| tree | 748e37cb092e3ccec363b2e945a1b01a0c33ec06 /src/root.zig | |
| parent | 3cb52c4898cb387d1e9b185479e4187f2a1a711a (diff) | |
| download | river-8bfca48991ce85f065eea4d2456908eebb9529bc.tar.gz river-8bfca48991ce85f065eea4d2456908eebb9529bc.tar.xz | |
Implement the focus stack
Diffstat (limited to 'src/root.zig')
| -rw-r--r-- | src/root.zig | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/root.zig b/src/root.zig index 38c09f6..0c470d2 100644 --- a/src/root.zig +++ b/src/root.zig @@ -19,10 +19,6 @@ pub const Root = struct { wlr_output_layout: *c.wlr_output_layout, outputs: std.TailQueue(Output), - /// The view that has seat focus, if any. - /// TODO: move this to Seat - focused_view: ?*View, - /// Number of pending configures sent in the current transaction. /// A value of 0 means there is no current transaction. pending_configures: u32, @@ -41,8 +37,6 @@ pub const Root = struct { self.outputs = std.TailQueue(Output).init(); - self.focused_view = null; - self.pending_configures = 0; self.transaction_timer = null; @@ -188,8 +182,8 @@ pub const Root = struct { // Iterate over all views of all outputs var output_it = self.outputs.first; - while (output_it) |node| : (output_it = node.next) { - const output = &node.data; + while (output_it) |output_node| : (output_it = output_node.next) { + const output = &output_node.data; // If there were pending focused tags, make them the current focus if (output.pending_focused_tags) |tags| { @@ -199,9 +193,6 @@ pub const Root = struct { ); output.current_focused_tags = tags; output.pending_focused_tags = null; - - self.focused_view = null; - Log.Error.log("FIXME: this needs to iterate over all seats and focus(null)", .{}); } var view_it = ViewStack(View).iterator(output.views.first, 0xFFFFFFFF); @@ -218,20 +209,16 @@ pub const Root = struct { if (view.pending_tags) |tags| { view.current_tags = tags; view.pending_tags = null; - - // If the pending tags caused the currently focused view to no - // longer be visible, focus the next view. - if (self.focused_view) |focus| { - if (focus == view and - view.current_tags & output.current_focused_tags == 0) - { - Log.Error.log("FIXME: this needs to iterate over all seats and focus(null)", .{}); - } - } } view.dropStashedBuffer(); } } + + // Iterate over all seats and update focus + var it = self.server.input_manager.seats.first; + while (it) |seat_node| : (it = seat_node.next) { + seat_node.data.focus(null); + } } }; |
