Skip to content

Commit b96b95d

Browse files
committed
Add hint for blocking win key when using raw keyboard
1 parent 510c7ed commit b96b95d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

include/SDL3/SDL_hints.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4128,6 +4128,20 @@ extern "C" {
41284128
*/
41294129
#define SDL_HINT_WINDOWS_RAW_KEYBOARD "SDL_WINDOWS_RAW_KEYBOARD"
41304130

4131+
/**
4132+
* A variable controlling whether to block hotkeys when raw keyboard events are enabled.
4133+
*
4134+
* The variable can be set to the following values:
4135+
*
4136+
* - "0": Hotkeys are not blocked. (default)
4137+
* - "1": Hotkeys are blocked.
4138+
*
4139+
* This hint must be set before SDL is initialized.
4140+
*
4141+
* \since This hint is available since SDL 3.2.16.
4142+
*/
4143+
#define SDL_HINT_WINDOWS_RAW_KEYBOARD_NOHOTKEY "SDL_WINDOWS_RAW_KEYBOARD_NOHOTKEY"
4144+
41314145
/**
41324146
* A variable controlling whether SDL uses Kernel Semaphores on Windows.
41334147
*

src/video/windows/SDL_windowsrawinput.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static DWORD WINAPI WIN_RawInputThread(LPVOID param)
7777
if (data->flags & ENABLE_RAW_KEYBOARD_INPUT) {
7878
devices[count].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
7979
devices[count].usUsage = USB_USAGE_GENERIC_KEYBOARD;
80-
devices[count].dwFlags = 0;
80+
devices[count].dwFlags = SDL_GetHintBoolean(SDL_HINT_WINDOWS_RAW_KEYBOARD_NOHOTKEY) ? 0x200 : 0;
8181
devices[count].hwndTarget = window;
8282
++count;
8383
}

0 commit comments

Comments
 (0)