aboutsummaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorChristian Meissl <meissl.christian@gmail.com>2024-02-24 18:31:54 +0100
committerIvan Molodetskikh <yalterz@gmail.com>2024-02-28 13:19:41 +0400
commit5ac350d51c0f16be3e40355bcb25cf23d34cc662 (patch)
treea8e811d97b60b614216fbc4942c0562fe803bf78 /src/layout
parent494e98c1235133fd5267bfdfb9a5468f1115deff (diff)
downloadniri-5ac350d51c0f16be3e40355bcb25cf23d34cc662.tar.gz
niri-5ac350d51c0f16be3e40355bcb25cf23d34cc662.tar.bz2
niri-5ac350d51c0f16be3e40355bcb25cf23d34cc662.zip
chore: update smithay
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/mod.rs51
-rw-r--r--src/layout/workspace.rs31
2 files changed, 52 insertions, 30 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 61bdaa8d..ba8663a1 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -247,35 +247,45 @@ impl LayoutElement for Window {
}
fn request_size(&self, size: Size<i32, Logical>) {
- self.toplevel().with_pending_state(|state| {
- state.size = Some(size);
- state.states.unset(xdg_toplevel::State::Fullscreen);
- });
+ self.toplevel()
+ .expect("no x11 support")
+ .with_pending_state(|state| {
+ state.size = Some(size);
+ state.states.unset(xdg_toplevel::State::Fullscreen);
+ });
}
fn request_fullscreen(&self, size: Size<i32, Logical>) {
- self.toplevel().with_pending_state(|state| {
- state.size = Some(size);
- state.states.set(xdg_toplevel::State::Fullscreen);
- });
+ self.toplevel()
+ .expect("no x11 support")
+ .with_pending_state(|state| {
+ state.size = Some(size);
+ state.states.set(xdg_toplevel::State::Fullscreen);
+ });
}
fn min_size(&self) -> Size<i32, Logical> {
- with_states(self.toplevel().wl_surface(), |state| {
- let curr = state.cached_state.current::<SurfaceCachedState>();
- curr.min_size
- })
+ with_states(
+ self.toplevel().expect("no x11 support").wl_surface(),
+ |state| {
+ let curr = state.cached_state.current::<SurfaceCachedState>();
+ curr.min_size
+ },
+ )
}
fn max_size(&self) -> Size<i32, Logical> {
- with_states(self.toplevel().wl_surface(), |state| {
- let curr = state.cached_state.current::<SurfaceCachedState>();
- curr.max_size
- })
+ with_states(
+ self.toplevel().expect("no x11 support").wl_surface(),
+ |state| {
+ let curr = state.cached_state.current::<SurfaceCachedState>();
+ curr.max_size
+ },
+ )
}
fn is_wl_surface(&self, wl_surface: &WlSurface) -> bool {
- self.toplevel().wl_surface() == wl_surface
+ self.toplevel().expect("no x11 support").wl_surface() == wl_surface
}
fn set_preferred_scale_transform(&self, scale: i32, transform: Transform) {
@@ -285,7 +295,10 @@ impl LayoutElement for Window {
}
fn has_ssd(&self) -> bool {
- self.toplevel().current_state().decoration_mode
+ self.toplevel()
+ .expect("no x11 support")
+ .current_state()
+ .decoration_mode
== Some(zxdg_toplevel_decoration_v1::Mode::ServerSide)
}
@@ -305,6 +318,7 @@ impl LayoutElement for Window {
fn is_fullscreen(&self) -> bool {
self.toplevel()
+ .expect("no x11 support")
.current_state()
.states
.contains(xdg_toplevel::State::Fullscreen)
@@ -312,6 +326,7 @@ impl LayoutElement for Window {
fn is_pending_fullscreen(&self) -> bool {
self.toplevel()
+ .expect("no x11 support")
.with_pending_state(|state| state.states.contains(xdg_toplevel::State::Fullscreen))
}
}
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 2f11cc4f..49c1b53d 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -361,15 +361,18 @@ impl<W: LayoutElement> Workspace<W> {
set_preferred_scale_transform(window, output);
}
- window.toplevel().with_pending_state(|state| {
- if state.states.contains(xdg_toplevel::State::Fullscreen) {
- state.size = Some(self.view_size);
- } else {
- state.size = Some(self.new_window_size(width));
- }
+ window
+ .toplevel()
+ .expect("no x11 support")
+ .with_pending_state(|state| {
+ if state.states.contains(xdg_toplevel::State::Fullscreen) {
+ state.size = Some(self.view_size);
+ } else {
+ state.size = Some(self.new_window_size(width));
+ }
- state.bounds = Some(self.toplevel_bounds());
- });
+ state.bounds = Some(self.toplevel_bounds());
+ });
}
fn compute_new_view_offset_for_column(&self, current_x: i32, idx: usize) -> i32 {
@@ -1211,11 +1214,15 @@ impl Workspace<Window> {
&& col.active_tile_idx == tile_idx;
win.set_activated(active);
- win.toplevel().with_pending_state(|state| {
- state.bounds = Some(bounds);
- });
+ win.toplevel()
+ .expect("no x11 support")
+ .with_pending_state(|state| {
+ state.bounds = Some(bounds);
+ });
- win.toplevel().send_pending_configure();
+ win.toplevel()
+ .expect("no x11 support")
+ .send_pending_configure();
win.refresh();
}
}