seat: prioritize fullscreen views for focus
This commit is contained in:
parent
acd08840ab
commit
eb1e66b0fe
@ -122,21 +122,26 @@ pub fn focus(self: *Self, _view: ?*View) void {
|
||||
return;
|
||||
}
|
||||
|
||||
// If view is null or not currently visible
|
||||
if (if (view) |v|
|
||||
v.output != self.focused_output or
|
||||
v.current.tags & self.focused_output.current_focused_tags == 0
|
||||
else
|
||||
true) {
|
||||
// Set view to the first currently visible view on in the focus stack if any
|
||||
var it = ViewStack(*View).iterator(
|
||||
self.focus_stack.first,
|
||||
self.focused_output.current_focused_tags,
|
||||
);
|
||||
// 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_focused_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_focused_tags);
|
||||
view = while (it.next()) |node| {
|
||||
if (node.view.output == self.focused_output) {
|
||||
break node.view;
|
||||
}
|
||||
if (node.view.output == self.focused_output and node.view.current.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_focused_tags);
|
||||
view = while (it.next()) |node| {
|
||||
if (node.view.output == self.focused_output) break node.view;
|
||||
} else null;
|
||||
}
|
||||
|
||||
|
@ -282,12 +282,10 @@ pub fn map(self: *Self) void {
|
||||
const node = @fieldParentPtr(ViewStack(Self).Node, "view", self);
|
||||
self.output.views.push(node);
|
||||
|
||||
// Focus the newly mapped view. Note: if a seat is focusing a different output
|
||||
// it will continue to do so.
|
||||
// Focus the new view, assuming the seat is focusing the proper output
|
||||
// and there isn't something else like a fullscreen view grabbing focus.
|
||||
var it = root.server.input_manager.seats.first;
|
||||
while (it) |seat_node| : (it = seat_node.next) {
|
||||
seat_node.data.focus(self);
|
||||
}
|
||||
while (it) |seat_node| : (it = seat_node.next) seat_node.data.focus(self);
|
||||
|
||||
c.wlr_surface_send_enter(self.wlr_surface.?, self.output.wlr_output);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user