diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-19 14:41:17 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-19 18:29:13 +0400 |
| commit | 3963f537a4182dbcd8e1e2f262ee105473facc56 (patch) | |
| tree | 942f802863d1f8f63bbe68b53ab2d091e3c7dda9 /src/layout/workspace.rs | |
| parent | f31e105043a9fae0fae3dcfe0feb7ea1193d5f77 (diff) | |
| download | niri-3963f537a4182dbcd8e1e2f262ee105473facc56.tar.gz niri-3963f537a4182dbcd8e1e2f262ee105473facc56.tar.bz2 niri-3963f537a4182dbcd8e1e2f262ee105473facc56.zip | |
Wrap mapped windows in a Mapped
Diffstat (limited to 'src/layout/workspace.rs')
| -rw-r--r-- | src/layout/workspace.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 9a0f10e5..03868dc0 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -10,6 +10,7 @@ use smithay::output::Output; use smithay::reexports::wayland_protocols::xdg::shell::server::xdg_toplevel; use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface; use smithay::utils::{Logical, Point, Rectangle, Scale, Size}; +use smithay::wayland::compositor::send_surface_state; use super::tile::{Tile, TileRenderElement}; use super::{LayoutElement, Options}; @@ -299,6 +300,13 @@ impl<W: LayoutElement> Workspace<W> { .map(Tile::window) } + pub fn windows_mut(&mut self) -> impl Iterator<Item = &mut W> + '_ { + self.columns + .iter_mut() + .flat_map(|col| col.tiles.iter_mut()) + .map(Tile::window_mut) + } + pub fn set_output(&mut self, output: Option<Output>) { if self.output == output { return; @@ -407,7 +415,11 @@ impl<W: LayoutElement> Workspace<W> { pub fn configure_new_window(&self, window: &Window, width: Option<ColumnWidth>) { if let Some(output) = self.output.as_ref() { - set_preferred_scale_transform(window, output); + let scale = output.current_scale().integer_scale(); + let transform = output.current_transform(); + window.with_surfaces(|surface, data| { + send_surface_state(surface, data, scale, transform); + }); } window @@ -584,6 +596,10 @@ impl<W: LayoutElement> Workspace<W> { self.windows().find(|win| win.is_wl_surface(wl_surface)) } + pub fn find_wl_surface_mut(&mut self, wl_surface: &WlSurface) -> Option<&mut W> { + self.windows_mut().find(|win| win.is_wl_surface(wl_surface)) + } + /// Computes the X position of the windows in the given column, in logical coordinates. fn column_x(&self, column_idx: usize) -> i32 { let mut x = 0; |
