Skip to content

Commit

Permalink
Compare only base modifiers for hotkey match
Browse files Browse the repository at this point in the history
Fixes the issue raised in #1077
  • Loading branch information
raphlinus committed Jul 3, 2020
1 parent d4c575c commit 71af454
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion druid-shell/src/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ impl HotKey {
///
/// [`KeyboardEvent`]: keyboard_types::KeyEvent
pub fn matches(&self, event: impl Borrow<KeyEvent>) -> 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
}
}

Expand Down

0 comments on commit 71af454

Please sign in to comment.