File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44pub enum Interaction {
55 #[ default]
66 None ,
7+ Hidden ,
78 Idle ,
89 Pointer ,
910 Grab ,
Original file line number Diff line number Diff line change @@ -467,10 +467,13 @@ pub fn window_theme(mode: theme::Mode) -> Option<winit::window::Theme> {
467467/// [`winit`]: https://github.com/rust-windowing/winit
468468pub fn mouse_interaction (
469469 interaction : mouse:: Interaction ,
470- ) -> winit:: window:: CursorIcon {
470+ ) -> Option < winit:: window:: CursorIcon > {
471471 use mouse:: Interaction ;
472472
473- match interaction {
473+ let icon = match interaction {
474+ Interaction :: Hidden => {
475+ return None ;
476+ }
474477 Interaction :: None | Interaction :: Idle => {
475478 winit:: window:: CursorIcon :: Default
476479 }
@@ -497,7 +500,9 @@ pub fn mouse_interaction(
497500 Interaction :: Move => winit:: window:: CursorIcon :: Move ,
498501 Interaction :: Copy => winit:: window:: CursorIcon :: Copy ,
499502 Interaction :: Help => winit:: window:: CursorIcon :: Help ,
500- }
503+ } ;
504+
505+ Some ( icon)
501506}
502507
503508/// Converts a `MouseButton` from [`winit`] to an [`iced`] mouse button.
Original file line number Diff line number Diff line change @@ -245,8 +245,15 @@ where
245245
246246 pub fn update_mouse ( & mut self , interaction : mouse:: Interaction ) {
247247 if interaction != self . mouse_interaction {
248- self . raw
249- . set_cursor ( conversion:: mouse_interaction ( interaction) ) ;
248+ if let Some ( icon) = conversion:: mouse_interaction ( interaction) {
249+ self . raw . set_cursor ( icon) ;
250+
251+ if self . mouse_interaction == mouse:: Interaction :: Hidden {
252+ self . raw . set_cursor_visible ( true ) ;
253+ }
254+ } else {
255+ self . raw . set_cursor_visible ( false ) ;
256+ }
250257
251258 self . mouse_interaction = interaction;
252259 }
You can’t perform that action at this time.
0 commit comments