sampler: fold held modifiers from the events

This commit is contained in:
bflatastic
2026-11-21 21:33:31 +07:00
parent 8de18d4b87
commit 298079fd93
2 changed files with 9 additions and 1 deletions
Generated
+7
View File
@@ -2021,6 +2021,11 @@ dependencies = [
[[package]]
name = "craft-appkit"
version = "0.1.0"
dependencies = [
"block2 0.6.2",
"objc2-app-kit 0.3.2",
"objc2-foundation 0.3.2",
]
[[package]]
name = "craft-assuan"
@@ -4566,6 +4571,7 @@ dependencies = [
name = "craft-window"
version = "0.1.0"
dependencies = [
"craft-appkit",
"craft-atomic",
"craft-behavior",
"craft-host",
@@ -4582,6 +4588,7 @@ dependencies = [
"tempfile",
"wayland-client",
"winsafe",
"x11rb",
]
[[package]]
+2 -1
View File
@@ -335,12 +335,13 @@ pub(crate) fn hook(ctx: &Context, input: &RawInput, events: &mut Vec<Arrived>) -
let before = events.len();
let os = crate::runtime::windows::os_of(ctx);
let latin = &input.latin_layout_chars;
let held = craft_keymap::Mods::from_egui(&input.modifiers, os);
let mut held = Mods::NONE;
let is_space = |key: &KeyInput| key.physical.or(key.typed) == Some(craft_keymap::Key::Space);
events.retain(|Arrived { event, .. }| {
match event {
Event::PointerMoved(pos) if here => over = hole.answers(*pos),
Event::PointerGone if here => over = false,
Event::ModifiersChanged(modifiers) => held = Mods::from_egui(modifiers, os),
Event::PointerButton { pos, .. } if here => over = hole.answers(*pos),
_ => {}
}