From e2e4881b267cc1a1142d0353a1c5ef311f382325 Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Wed, 31 Jul 2024 10:18:19 +0859 Subject: [PATCH] chore: update modifiers --- iced_layershell/src/application.rs | 7 ++----- iced_layershell/src/application/state.rs | 3 +++ iced_layershell/src/conversion.rs | 2 +- iced_layershell/src/multi_window/state.rs | 3 +++ iced_sessionlock/src/multi_window/state.rs | 3 +++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/iced_layershell/src/application.rs b/iced_layershell/src/application.rs index 0196e45..622d507 100644 --- a/iced_layershell/src/application.rs +++ b/iced_layershell/src/application.rs @@ -194,11 +194,8 @@ where // TODO: maybe use it later LayerEvent::BindProvide(_, _) => {} LayerEvent::RequestMessages(message) => { - match message { - DispatchMessage::MouseEnter { serial, .. } => { - pointer_serial = *serial; - } - _ => {} + if let DispatchMessage::MouseEnter { serial, .. } = message { + pointer_serial = *serial; } event_sender diff --git a/iced_layershell/src/application/state.rs b/iced_layershell/src/application/state.rs index bf98efe..b69fdc0 100644 --- a/iced_layershell/src/application/state.rs +++ b/iced_layershell/src/application/state.rs @@ -97,6 +97,9 @@ where WindowEvent::CursorMoved { x, y } => { self.mouse_position = Some(Point::new(*x as f32, *y as f32)); } + WindowEvent::ModifiersChanged(modifiers) => { + self.modifiers = *modifiers; + } _ => {} } } diff --git a/iced_layershell/src/conversion.rs b/iced_layershell/src/conversion.rs index d3ccdcc..4cfd1ca 100644 --- a/iced_layershell/src/conversion.rs +++ b/iced_layershell/src/conversion.rs @@ -73,7 +73,7 @@ pub fn window_event( } })), LayerShellEvent::ModifiersChanged(new_modifiers) => Some(IcedEvent::Keyboard( - keyboard::Event::ModifiersChanged(keymap::modifiers(new_modifiers.clone())), + keyboard::Event::ModifiersChanged(keymap::modifiers(*new_modifiers)), )), _ => None, } diff --git a/iced_layershell/src/multi_window/state.rs b/iced_layershell/src/multi_window/state.rs index 910f68f..697ce28 100644 --- a/iced_layershell/src/multi_window/state.rs +++ b/iced_layershell/src/multi_window/state.rs @@ -95,6 +95,9 @@ where WindowEvent::CursorMoved { x, y } => { self.mouse_position = Some(Point::new(*x as f32, *y as f32)); } + WindowEvent::ModifiersChanged(modifiers) => { + self.modifiers = *modifiers; + } _ => {} } } diff --git a/iced_sessionlock/src/multi_window/state.rs b/iced_sessionlock/src/multi_window/state.rs index 8041624..66d1d6a 100644 --- a/iced_sessionlock/src/multi_window/state.rs +++ b/iced_sessionlock/src/multi_window/state.rs @@ -95,6 +95,9 @@ where WindowEvent::CursorMoved { x, y } => { self.mouse_position = Some(Point::new(*x as f32, *y as f32)); } + WindowEvent::ModifiersChanged(modifiers) => { + self.modifiers = modifiers.clone(); + } _ => {} } }