Skip to content

Commit

Permalink
Merge pull request #1079 from linebender/fix_mods
Browse files Browse the repository at this point in the history
Compare only base modifiers for hotkey match
  • Loading branch information
raphlinus authored Jul 4, 2020
2 parents d4c575c + 71af454 commit 64eb47c
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 64eb47c

Please sign in to comment.