diff --git a/window/src/os/wayland/window.rs b/window/src/os/wayland/window.rs index eb9068f68..1db4968d2 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -881,8 +881,8 @@ impl WaylandWindowInner { let factor = get_surface_scale_factor(&self.surface); Dimensions { - pixel_width, - pixel_height, + pixel_width: pixel_width as _, + pixel_height: pixel_height as _, dpi: factor as usize * crate::DEFAULT_DPI as usize, } } diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index 4d6b9441a..d20c2ee68 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -61,7 +61,7 @@ pub(crate) struct XWindowInner { copy_and_paste: CopyAndPaste, config: ConfigHandle, gl_state: Option>, - resize_promises: Vec>, + resize_promises: Vec>, } fn enclosing_boundary_with(a: &Rect, b: &Rect) -> Rect { @@ -816,9 +816,6 @@ impl XWindowInner { fn show(&mut self) { xcb::map_window(self.conn().conn(), self.window_id); } - fn set_cursor(&mut self, cursor: Option) { - XWindowInner::set_cursor(self, cursor).unwrap(); - } fn invalidate(&mut self) { self.paint_all = true; } @@ -839,23 +836,6 @@ impl XWindowInner { let _ = self.adjust_decorations(config.window_decorations); } - fn set_inner_size(&mut self, width: usize, height: usize) -> Future { - let _ = xcb::configure_window_checked( - self.conn().conn(), - self.window_id, - &[ - (xcb::CONFIG_WINDOW_WIDTH as u16, width as u32), - (xcb::CONFIG_WINDOW_HEIGHT as u16, height as u32), - ], - ) - .request_check(); - - let promise = Promise::new(); - let future = promise.get_future(); - self.resize_promises.push(promise); - promise - } - fn set_window_position(&self, coords: ScreenPoint) { // We ask the window manager to move the window for us so that // we don't have to deal with adjusting for the frame size. @@ -980,7 +960,27 @@ impl WindowOps for XWindow { } fn set_inner_size(&self, width: usize, height: usize) -> Future { - XConnection::with_window_inner(self.0, move |inner| Ok(inner.set_inner_size(width, height))) + let mut promise = Promise::new(); + let future = promise.get_future().unwrap(); + + let mut promise = Some(promise); + + XConnection::with_window_inner(self.0, move |inner| { + if let Some(promise) = promise.take() { + inner.resize_promises.push(promise); + } + xcb::configure_window( + inner.conn().conn(), + inner.window_id, + &[ + (xcb::CONFIG_WINDOW_WIDTH as u16, width as u32), + (xcb::CONFIG_WINDOW_HEIGHT as u16, height as u32), + ], + ); + Ok(()) + }); + + future } fn set_window_position(&self, coords: ScreenPoint) -> Future<()> { diff --git a/window/src/os/x_and_wayland.rs b/window/src/os/x_and_wayland.rs index dbf4c582d..2eebcbb25 100644 --- a/window/src/os/x_and_wayland.rs +++ b/window/src/os/x_and_wayland.rs @@ -7,7 +7,7 @@ use crate::os::wayland::connection::WaylandConnection; use crate::os::wayland::window::WaylandWindow; use crate::os::x11::connection::XConnection; use crate::os::x11::window::XWindow; -use crate::{Clipboard, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps}; +use crate::{Clipboard, Dimensions, MouseCursor, ScreenPoint, WindowCallbacks, WindowOps}; use config::ConfigHandle; use promise::*; use std::any::Any;