seat: set focus before starting transactions
Focus was made double-buffered in96a91fd. However, much of the code still behaved as if focus was separate from the transaction system. This commit completes the work started in96a91fdand ensures that focus is applied consistently in a single transaction.
This commit is contained in:
@ -120,21 +120,21 @@ pub fn focus(self: *Self, _view: ?*View) void {
|
||||
// If the view is not currently visible, behave as if null was passed
|
||||
if (view) |v| {
|
||||
if (v.output != self.focused_output or
|
||||
v.current.tags & self.focused_output.current.tags == 0) view = null;
|
||||
v.pending.tags & self.focused_output.pending.tags == 0) view = null;
|
||||
}
|
||||
|
||||
// If the target view is not fullscreen or null, then a fullscreen view
|
||||
// will grab focus if visible.
|
||||
if (if (view) |v| !v.current.fullscreen else true) {
|
||||
var it = ViewStack(*View).iterator(self.focus_stack.first, self.focused_output.current.tags);
|
||||
if (if (view) |v| !v.pending.fullscreen else true) {
|
||||
var it = ViewStack(*View).pendingIterator(self.focus_stack.first, self.focused_output.pending.tags);
|
||||
view = while (it.next()) |node| {
|
||||
if (node.view.output == self.focused_output and node.view.current.fullscreen) break node.view;
|
||||
if (node.view.output == self.focused_output and node.view.pending.fullscreen) break node.view;
|
||||
} else view;
|
||||
}
|
||||
|
||||
if (view == null) {
|
||||
// Set view to the first currently visible view in the focus stack if any
|
||||
var it = ViewStack(*View).iterator(self.focus_stack.first, self.focused_output.current.tags);
|
||||
var it = ViewStack(*View).pendingIterator(self.focus_stack.first, self.focused_output.pending.tags);
|
||||
view = while (it.next()) |node| {
|
||||
if (node.view.output == self.focused_output) break node.view;
|
||||
} else null;
|
||||
@ -223,9 +223,6 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
||||
// Inform any clients tracking status of the change
|
||||
var it = self.status_trackers.first;
|
||||
while (it) |node| : (it = node.next) node.data.sendFocusedView();
|
||||
|
||||
// Start a transaction to apply the pending focus state
|
||||
self.input_manager.server.root.startTransaction();
|
||||
}
|
||||
|
||||
/// Focus the given output, notifying any listening clients of the change.
|
||||
|
||||
Reference in New Issue
Block a user