wayland: implement window:maximize() window:restore()

This commit is contained in:
Wez Furlong committed 2022-07-07 06:19:08 -07:00
1 parent dbc2c85361
commit 9779b29c39
1 file changed
+20
+20
View File
@@ -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;