From 9779b29c395cecfe35934e7f199d13725a668841 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 7 Jul 2022 06:19:08 -0700 Subject: [PATCH] wayland: implement window:maximize() window:restore() --- 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 ae709342f..ce0413db4 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -911,6 +911,14 @@ impl WindowOps for WaylandWindow { }); } + 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())); + } + fn set_inner_size(&self, width: usize, height: usize) { WaylandConnection::with_window_inner(self.0, move |inner| { Ok(inner.set_inner_size(width, height)) @@ -1056,6 +1064,18 @@ impl WaylandWindowInner { self.do_paint().unwrap(); } + 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(); + } + } + fn set_inner_size(&mut self, width: usize, height: usize) -> Dimensions { let pixel_width = width as i32; let pixel_height = height as i32;