From 130d0460d6d817cf6f651ba1764a0b05e15efdc1 Mon Sep 17 00:00:00 2001 From: Cosimo Matteini Date: Sun, 10 Nov 2024 18:28:20 +0100 Subject: [PATCH] wayland: reimplement maximize and restore It was removed with wayland reimplementation in #4777 --- window/src/os/wayland/window.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/window/src/os/wayland/window.rs b/window/src/os/wayland/window.rs index 74ba5ae6b9f..79960b3e4a4 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -466,6 +466,14 @@ impl WindowOps for WaylandWindow { Ok(()) }); } + + fn maximize(&self) { + WaylandConnection::with_window_inner(self.0, move |inner| Ok(inner.maximize())); + } + + fn restore(&self) { + WaylandConnection::with_window_inner(self.0, move |inner| Ok(inner.restore())); + } } #[derive(Default, Clone, Debug)] pub(crate) struct PendingEvent { @@ -1208,6 +1216,18 @@ impl WaylandWindowInner { _ => log::warn!("unhandled FrameAction: {:?}", action), } } + + fn maximize(&mut self) { + if let Some(window) = self.window.as_mut() { + window.set_maximized(); + } + } + + fn restore(&mut self) { + if let Some(window) = self.window.as_mut() { + window.unset_maximized(); + } + } } impl WaylandState {