diff --git a/window/src/os/wayland/window.rs b/window/src/os/wayland/window.rs index 11e6ef13e..934145b33 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -24,7 +24,6 @@ use std::sync::{Arc, Mutex}; use toolkit::get_surface_scale_factor; use toolkit::reexports::client::protocol::wl_data_source::Event as DataSourceEvent; use toolkit::reexports::client::protocol::wl_surface::WlSurface; -use toolkit::shm::MemPool; use toolkit::window::{ButtonColorSpec, ColorSpec, ConceptConfig, ConceptFrame, Event}; use wayland_client::protocol::wl_data_device_manager::WlDataDeviceManager; use wayland_egl::{is_available as egl_is_available, WlEglSurface}; @@ -86,7 +85,6 @@ pub struct WaylandWindowInner { surface: WlSurface, copy_and_paste: Arc>, window: Option>, - pool: MemPool, dimensions: Dimensions, need_paint: bool, last_mouse_coords: Point, @@ -218,8 +216,6 @@ impl WaylandWindow { window.set_title(name.to_string()); window.set_frame_config(frame_config()); - let pool = MemPool::new(conn.environment.borrow().require_global(), |_| {})?; - // window.new_seat(&conn.seat); conn.keyboard.add_window(window_id, &surface); @@ -234,7 +230,6 @@ impl WaylandWindow { callbacks, surface: surface.detach(), window: Some(window), - pool, dimensions, need_paint: true, last_mouse_coords: Point::new(0, 0), @@ -420,10 +415,6 @@ impl WaylandWindowInner { self.dimensions.dpi as i32 / crate::DEFAULT_DPI as i32 } - fn get_dpi(&self) -> usize { - self.dimensions.dpi - } - fn surface_to_pixels(&self, surface: i32) -> i32 { surface * self.get_dpi_factor() } @@ -579,27 +570,6 @@ impl WaylandWindowInner { Ok(()) } - - fn damage(&mut self) { - if self.surface.as_ref().version() >= 4 { - self.surface.damage_buffer( - 0, - 0, - self.dimensions.pixel_width as i32, - self.dimensions.pixel_height as i32, - ); - } else { - // Older versions use the surface size which is the pre-scaled - // dimensions. Since we store the scaled dimensions, we need - // to compensate here. - self.surface.damage( - 0, - 0, - self.pixels_to_surface(self.dimensions.pixel_width as i32), - self.pixels_to_surface(self.dimensions.pixel_height as i32), - ); - } - } } struct MmapImage<'a> { diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index c3dd080b2..d660cfcf1 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -41,12 +41,10 @@ pub(crate) struct XWindowInner { window_id: xcb::xproto::Window, conn: Weak, callbacks: Box, - window_context: Context, width: u16, height: u16, expose: VecDeque, paint_all: bool, - buffer_image: BufferImage, cursor: Option, cursors: HashMap, XcbCursor>, copy_and_paste: CopyAndPaste, @@ -111,7 +109,6 @@ impl<'a> PaintContext for X11GraphicsContext<'a> { impl XWindowInner { fn enable_opengl(&mut self) -> anyhow::Result<()> { - let window = XWindow(self.window_id); let conn = self.conn(); let gl_state = match conn.gl_connection.borrow().as_ref() { @@ -142,13 +139,11 @@ impl XWindowInner { })?; self.gl_state.replace(gl_state.clone()); - self.callbacks.created(&window, gl_state) + let window_handle = Window::X11(XWindow::from_id(self.window_id)); + self.callbacks.created(&window_handle, gl_state) } pub fn paint(&mut self) -> anyhow::Result<()> { - let window_dimensions = - Rect::from_size(Size::new(self.width as isize, self.height as isize)); - if !self.paint_all && self.expose.is_empty() { return Ok(()); } @@ -757,21 +752,15 @@ impl XWindow { .request_check() .context("xcb::create_window_checked")?; - let window_context = Context::new(&conn, &window_id); - - let buffer_image = BufferImage::new(&conn, window_id, width, height); - Arc::new(Mutex::new(XWindowInner { window_id, conn: Rc::downgrade(&conn), callbacks, - window_context, width: width.try_into()?, height: height.try_into()?, expose: VecDeque::new(), paint_all: true, copy_and_paste: CopyAndPaste::default(), - buffer_image, cursor: None, cursors: HashMap::new(), gl_state: None,