Skip to content

Commit 91a9e26

Browse files
committed
extend rawkb hint with nohotkey option
1 parent 510c7ed commit 91a9e26

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/SDL3/SDL_hints.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4115,12 +4115,13 @@ extern "C" {
41154115
#define SDL_HINT_WINDOWS_GAMEINPUT "SDL_WINDOWS_GAMEINPUT"
41164116

41174117
/**
4118-
* A variable controlling whether raw keyboard events are used on Windows.
4118+
* A variable controlling if and how raw keyboard events are used on Windows.
41194119
*
41204120
* The variable can be set to the following values:
41214121
*
4122-
* - "0": The Windows message loop is used for keyboard events. (default)
4123-
* - "1": Low latency raw keyboard events are used.
4122+
* - "0": Raw keyboard events are not used (default)
4123+
* - "1": Raw keyboard events are used.
4124+
* - "2": Raw keyboard events are used, with RIDEV_NOHOTKEYS (available since SDL 3.4.0)
41244125
*
41254126
* This hint can be set anytime.
41264127
*

src/video/windows/SDL_windowsrawinput.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ static DWORD WINAPI WIN_RawInputThread(LPVOID param)
7878
devices[count].usUsagePage = USB_USAGEPAGE_GENERIC_DESKTOP;
7979
devices[count].usUsage = USB_USAGE_GENERIC_KEYBOARD;
8080
devices[count].dwFlags = 0;
81+
int rawmode = SDL_GetStringInteger(SDL_GetHint(SDL_HINT_WINDOWS_RAW_KEYBOARD), 0);
82+
if (rawmode == 2) {
83+
devices[count].dwFlags |= RIDEV_NOHOTKEYS;
84+
}
8185
devices[count].hwndTarget = window;
8286
++count;
8387
}

0 commit comments

Comments
 (0)