diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 104221f5d5..853e85b20f 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -25,7 +25,7 @@ use crate::platform::pump_events::PumpStatus; use crate::window::{ self, CursorGrabMode, CustomCursor, CustomCursorSource, Fullscreen, ImePurpose, ResizeDirection, Theme, Window as CoreWindow, WindowAttributes, WindowButtons, WindowId, - WindowLevel, + WindowLevel, Surface as CoreSurface }; mod keycodes; @@ -804,7 +804,7 @@ impl rwh_06::HasWindowHandle for Window { } } -impl CoreWindow for Window { +impl CoreSurface for Window { fn id(&self) -> WindowId { GLOBAL_WINDOW } @@ -831,6 +831,45 @@ impl CoreWindow for Window { fn pre_present_notify(&self) {} + fn surface_size(&self) -> PhysicalSize { + self.outer_size() + } + + fn request_surface_size(&self, _size: Size) -> Option> { + Some(self.surface_size()) + } + + fn set_transparent(&self, _transparent: bool) {} + + fn set_cursor(&self, _: Cursor) {} + + fn set_cursor_position(&self, _: Position) -> Result<(), RequestError> { + Err(NotSupportedError::new("set_cursor_position is not supported").into()) + } + + fn set_cursor_grab(&self, _: CursorGrabMode) -> Result<(), RequestError> { + Err(NotSupportedError::new("set_cursor_grab is not supported").into()) + } + + fn set_cursor_visible(&self, _: bool) {} + + fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), RequestError> { + Err(NotSupportedError::new("set_cursor_hittest is not supported").into()) + } + + #[cfg(feature = "rwh_06")] + fn rwh_06_display_handle(&self) -> &dyn rwh_06::HasDisplayHandle { + self + } + + #[cfg(feature = "rwh_06")] + fn rwh_06_window_handle(&self) -> &dyn rwh_06::HasWindowHandle { + self + } +} + +impl CoreWindow for Window { + fn inner_position(&self) -> Result, RequestError> { Err(NotSupportedError::new("inner_position is not supported").into()) } @@ -843,14 +882,6 @@ impl CoreWindow for Window { // no effect } - fn surface_size(&self) -> PhysicalSize { - self.outer_size() - } - - fn request_surface_size(&self, _size: Size) -> Option> { - Some(self.surface_size()) - } - fn outer_size(&self) -> PhysicalSize { screen_size(&self.app) } @@ -867,8 +898,6 @@ impl CoreWindow for Window { fn set_title(&self, _title: &str) {} - fn set_transparent(&self, _transparent: bool) {} - fn set_blur(&self, _blur: bool) {} fn set_visible(&self, _visibility: bool) {} @@ -929,18 +958,6 @@ impl CoreWindow for Window { fn request_user_attention(&self, _request_type: Option) {} - fn set_cursor(&self, _: Cursor) {} - - fn set_cursor_position(&self, _: Position) -> Result<(), RequestError> { - Err(NotSupportedError::new("set_cursor_position is not supported").into()) - } - - fn set_cursor_grab(&self, _: CursorGrabMode) -> Result<(), RequestError> { - Err(NotSupportedError::new("set_cursor_grab is not supported").into()) - } - - fn set_cursor_visible(&self, _: bool) {} - fn drag_window(&self) -> Result<(), RequestError> { Err(NotSupportedError::new("drag_window is not supported").into()) } @@ -952,10 +969,6 @@ impl CoreWindow for Window { #[inline] fn show_window_menu(&self, _position: Position) {} - fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), RequestError> { - Err(NotSupportedError::new("set_cursor_hittest is not supported").into()) - } - fn set_theme(&self, _theme: Option) {} fn theme(&self) -> Option { @@ -973,16 +986,6 @@ impl CoreWindow for Window { } fn reset_dead_keys(&self) {} - - #[cfg(feature = "rwh_06")] - fn rwh_06_display_handle(&self) -> &dyn rwh_06::HasDisplayHandle { - self - } - - #[cfg(feature = "rwh_06")] - fn rwh_06_window_handle(&self) -> &dyn rwh_06::HasWindowHandle { - self - } } #[derive(Default, Clone, Debug)]