diff --git a/src/lib.rs b/src/lib.rs index 13c8fae6..6a158d8d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -218,6 +218,8 @@ pub mod window { } /// Get the position of the window. + /// TODO: implement for other platforms + #[cfg(target_os = "windows")] pub fn get_window_position() -> (u32, u32) { let mut d = native_display().lock().unwrap(); d.screen_position diff --git a/src/native/linux_x11.rs b/src/native/linux_x11.rs index 5ef66448..9d18c0eb 100644 --- a/src/native/linux_x11.rs +++ b/src/native/linux_x11.rs @@ -243,27 +243,6 @@ impl X11Display { (self.libx11.XFlush)(self.display); } - unsafe fn set_window_position(&mut self, window: Window, new_x: u32, new_y: u32) { - (self.libx11.XMoveWindow)(self.display, window, new_x, new_y); - (self.libx11.XFlush)(self.display); - } - - unsafe fn get_window_position(&mut self, window: Window) -> (u32, u32) { - let mut x = 0; - let mut y = 0; - (self.libx11.XTranslateCoordinates)( - self.display, - window, - self.root, - 0, - 0, - &mut x, - &mut y, - std::ptr::null_mut(), - ); - (x, y) - } - fn show_mouse(&mut self, shown: bool) { unsafe { if shown { @@ -346,7 +325,7 @@ impl X11Display { new_height, } => self.set_window_size(self.window, new_width as _, new_height as _), SetWindowPosition { new_x, new_y } => { - self.set_window_position(self.window, new_x as _, new_y as _) + eprintln!("Not implemented for X11") } SetFullscreen(fullscreen) => self.set_fullscreen(self.window, fullscreen), ShowKeyboard(show) => { @@ -390,7 +369,6 @@ where (display.libx11.XFlush)(display.display); - // Get width and height let (w, h) = display .libx11 .query_window_size(display.display, display.window); @@ -425,13 +403,6 @@ where display.process_event(&mut xevent, &mut *event_handler); } - // update screen_position if window was moved - let (x, y) = display.get_window_position(display.window); - let mut d = crate::native_display().try_lock().unwrap(); - if d.screen_position.0 != x || d.screen_position.1 != y { - d.screen_position = (x, y); - } - event_handler.update(); event_handler.draw(); diff --git a/src/native/macos.rs b/src/native/macos.rs index e240176c..8657de68 100644 --- a/src/native/macos.rs +++ b/src/native/macos.rs @@ -183,6 +183,9 @@ impl MacosDisplay { new_height, } => self.set_window_size(new_width as _, new_height as _), SetFullscreen(fullscreen) => self.set_fullscreen(fullscreen), + SetWindowPosition(new_x, new_y) => { + eprintln!("Not implemented for macos"); + } _ => {} } }