Skip to content

Add hint for blocking win key when using raw keyboard #13066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

expikr
Copy link
Contributor

@expikr expikr commented May 17, 2025

@Susko3 windows' rawinput keyboard natively support blocking the Windows key via RIDEV_NOHOTKEYS while leaving alt-tab intact. The only drawback is that the Alt-Tab menu becomes the classic style when tabbing out.

* - "0": Hotkeys are not blocked. (default)
* - "1": Hotkeys are blocked.
*
* This hint must be set before SDL is initialized.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to make this hint apply dynamically: just restart the raw input thread / re-register the devices. Having it dynamic would make it more useful, as games could enable windows hotkeys when in menus or when paused, but disable it when in active gameplay.

@@ -77,7 +77,7 @@ static DWORD WINAPI WIN_RawInputThread(LPVOID param)
if (data->flags & ENABLE_RAW_KEYBOARD_INPUT) {
devices[count].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
devices[count].usUsage = USB_USAGE_GENERIC_KEYBOARD;
devices[count].dwFlags = 0;
devices[count].dwFlags = SDL_GetHintBoolean(SDL_HINT_WINDOWS_RAW_KEYBOARD_NOHOTKEY) ? 0x200 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use RIDEV_NOHOTKEYS instead of a magic value.

@slouken slouken added this to the 3.4.0 milestone Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants