View: Add attachRelative function

This is used for the above/below attach-modes introduced in d71bebc.

Also remove redundant focusedIndex function in Output.PendingState.
This commit is contained in:
Peter Kaplan
2024-03-05 23:49:24 +01:00
committed by Isaac Freund
parent 50d4f25eee
commit 26210b2be5
2 changed files with 31 additions and 30 deletions

View File

@ -60,20 +60,6 @@ pub const PendingState = struct {
///
/// This includes both floating/fullscreen views and those arranged in the layout.
wm_stack: wl.list.Head(View, .pending_wm_stack_link),
///
/// Index of the first view in focus_stack in the wm_stack list.
pub fn focusedIndex(self: *PendingState) ?u32 {
var focus_stack_it = self.focus_stack.iterator(.forward);
const focused_view = focus_stack_it.next() orelse return null;
var it = self.wm_stack.iterator(.forward);
var count: u32 = 0;
while (it.next()) |other| {
if (other == focused_view) break;
count += 1;
}
return count;
}
};
wlr_output: *wlr.Output,