output: introduce state struct
This simplifies the handling of the current/pending tags and will be used in the future for atomic layout updates involving layer surface exclusive zones.
This commit is contained in:
@ -44,8 +44,8 @@ pub fn focusView(
|
||||
// If there is a currently focused view, focus the next visible view in the stack.
|
||||
const focused_node = @fieldParentPtr(ViewStack(View).Node, "view", current_focus);
|
||||
var it = switch (direction) {
|
||||
.Next => ViewStack(View).iterator(focused_node, output.current_focused_tags),
|
||||
.Prev => ViewStack(View).reverseIterator(focused_node, output.current_focused_tags),
|
||||
.Next => ViewStack(View).iterator(focused_node, output.current.tags),
|
||||
.Prev => ViewStack(View).reverseIterator(focused_node, output.current.tags),
|
||||
};
|
||||
|
||||
// Skip past the focused node
|
||||
@ -60,8 +60,8 @@ pub fn focusView(
|
||||
// There is either no currently focused view or the last visible view in the
|
||||
// stack is focused and we need to wrap.
|
||||
var it = switch (direction) {
|
||||
.Next => ViewStack(View).iterator(output.views.first, output.current_focused_tags),
|
||||
.Prev => ViewStack(View).reverseIterator(output.views.last, output.current_focused_tags),
|
||||
.Next => ViewStack(View).iterator(output.views.first, output.current.tags),
|
||||
.Prev => ViewStack(View).reverseIterator(output.views.last, output.current.tags),
|
||||
};
|
||||
|
||||
seat.focus(if (it.next()) |node| &node.view else null);
|
||||
|
@ -28,8 +28,8 @@ pub fn setFocusedTags(
|
||||
out: *?[]const u8,
|
||||
) Error!void {
|
||||
const tags = try parseTags(allocator, args, out);
|
||||
if (seat.focused_output.current_focused_tags != tags) {
|
||||
seat.focused_output.pending_focused_tags = tags;
|
||||
if (seat.focused_output.pending.tags != tags) {
|
||||
seat.focused_output.pending.tags = tags;
|
||||
seat.input_manager.server.root.arrange();
|
||||
}
|
||||
}
|
||||
@ -57,9 +57,9 @@ pub fn toggleFocusedTags(
|
||||
) Error!void {
|
||||
const tags = try parseTags(allocator, args, out);
|
||||
const output = seat.focused_output;
|
||||
const new_focused_tags = output.current_focused_tags ^ tags;
|
||||
const new_focused_tags = output.pending.tags ^ tags;
|
||||
if (new_focused_tags != 0) {
|
||||
output.pending_focused_tags = new_focused_tags;
|
||||
output.pending.tags = new_focused_tags;
|
||||
seat.input_manager.server.root.arrange();
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ pub fn zoom(
|
||||
|
||||
// If the the first view that is part of the layout is focused, zoom
|
||||
// the next view in the layout. Otherwise zoom the focused view.
|
||||
var it = ViewStack(View).iterator(output.views.first, output.current_focused_tags);
|
||||
var it = ViewStack(View).iterator(output.views.first, output.current.tags);
|
||||
const layout_first = while (it.next()) |node| {
|
||||
if (!node.view.pending.float and !node.view.pending.fullscreen) break node;
|
||||
} else unreachable;
|
||||
|
Reference in New Issue
Block a user