microsoft / microsoft/microsoft-ui-xaml
Multiple windows in WinUI 3 cannot register hotkeys with the same hotkey ID.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
I want to call `RegisterHotKey` to register global hotkeys for different windows, but when the hotkey IDs are the same, the registration fails.
### Steps to reproduce the bug
1. Clone https://github.com/GochenRyan/WinUISample.git
2. Checkout commit fe334cce48856a6dd842a9448098d746d09f649e
3. Set Hotkeys as startup project
4. Insert a break point at https://github.com/GochenRyan/WinUISample/blob/fe334cce48856a6dd842a9448098d746d09f649e/WinUISample/Hotkeys/GlobalHotkeyManager.cs#L43
5. Upon running the application and clicking the 'Create new window' button, the attempt to register the hotkey will fail.
### Expected behavior
_No response_
### Screenshots
_No response_
### NuGet package version
WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002
### Windows version
Windows Insider Build (xxxxx)
### Additional context
_No response_
Contributor guide
Research direction
Reproduce the failure using the linked WinUISample repository at commit fe334cce48856a6dd842a9448098d746d09f649e, with Hotkeys as the startup project. Start at Hotkeys/GlobalHotkeyManager.cs line 43 and inspect the RegisterHotKey call when creating another window. Done means the cause of duplicate hotkey IDs failing across windows is identified and behavior is verified against Windows App SDK 1.6.1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100