From 71af4546036a4033acaa1e4d10bc1155a901a81d Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Fri, 3 Jul 2020 10:16:34 -0700 Subject: [PATCH] Compare only base modifiers for hotkey match Fixes the issue raised in #1077 --- druid-shell/src/hotkey.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/druid-shell/src/hotkey.rs b/druid-shell/src/hotkey.rs index b6b703303c..f4f13cd74c 100644 --- a/druid-shell/src/hotkey.rs +++ b/druid-shell/src/hotkey.rs @@ -111,8 +111,10 @@ impl HotKey { /// /// [`KeyboardEvent`]: keyboard_types::KeyEvent pub fn matches(&self, event: impl Borrow) -> bool { + // Should be a const but const bit_or doesn't work here. + let base_mods = Modifiers::SHIFT | Modifiers::CONTROL | Modifiers::ALT | Modifiers::META; let event = event.borrow(); - self.mods == event.mods && self.key == event.key + self.mods == event.mods & base_mods && self.key == event.key } }