Skip to content

Commit

Permalink
Prevent global shortcut activation from repeating on Windows (#602)
Browse files Browse the repository at this point in the history
* Add MOD_NOREPEAT to Windows global shortcut manager

* Add .changes
  • Loading branch information
kvnxiao authored Oct 24, 2022
1 parent 775974d commit d15a756
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/windows-global-shortcut-no-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch
---

Default to MOD_NOREPEAT for registering global shortcuts / hotkeys via win32 RegisterHotKey on Windows. This prevents shortcuts from repeatedly activating when the accelerator is pressed and held down, and ensures that we maintain platform-agnostic consistency.
2 changes: 1 addition & 1 deletion src/platform_impl/windows/global_shortcut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl ShortcutManager {
accelerator: Accelerator,
) -> Result<RootGlobalShortcut, ShortcutManagerError> {
unsafe {
let mut converted_modifiers = Default::default();
let mut converted_modifiers = MOD_NOREPEAT;
let modifiers: ModifiersState = accelerator.mods;
if modifiers.shift_key() {
converted_modifiers |= MOD_SHIFT;
Expand Down

0 comments on commit d15a756

Please sign in to comment.