layout: Extract ScrollingSpace

Leave the Workspace to do the workspace parts, and extract the scrolling parts
into a new file. This is a pre-requisite for things like the floating layer
(which will live in a workspace alongside the scrolling layer).

As part of this huge refactor, I found and fixed at least these issues:
- Wrong horizontal popup unconstraining for a smaller window in an
  always-centered column.
- Wrong workspace switch in focus_up_or_right().
This commit is contained in:
Ivan Molodetskikh
2024-11-30 09:18:33 +03:00
parent 1e76716819
commit 8665003269
10 changed files with 4499 additions and 4125 deletions
+4 -5
View File
@@ -189,9 +189,8 @@ impl CompositorHandler for State {
if let Some(output) = output.cloned() {
self.niri.layout.start_open_animation_for_window(&window);
let new_active_window =
self.niri.layout.active_window().map(|(m, _)| &m.window);
if new_active_window == Some(&window) {
let new_focus = self.niri.layout.focus().map(|m| &m.window);
if new_focus == Some(&window) {
self.maybe_warp_cursor_to_focus();
}
@@ -242,7 +241,7 @@ impl CompositorHandler for State {
// The toplevel got unmapped.
//
// Test client: wleird-unmap.
let active_window = self.niri.layout.active_window().map(|(m, _)| &m.window);
let active_window = self.niri.layout.focus().map(|m| &m.window);
let was_active = active_window == Some(&window);
#[cfg(feature = "xdp-gnome-screencast")]
@@ -290,7 +289,7 @@ impl CompositorHandler for State {
self.niri.layout.update_window(&window, serial);
// Popup placement depends on window size which might have changed.
self.update_reactive_popups(&window, &output);
self.update_reactive_popups(&window);
self.niri.queue_redraw(&output);
return;