osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

SDL3: Enable raw keyboard on Windows

Open Susko3 opened this issue 11 months ago • 2 comments

Related:

  • https://github.com/ppy/osu-framework/issues/6141
  • https://github.com/libsdl-org/SDL/issues/9409

With https://github.com/ppy/osu-framework/pull/6506, this will handle keyboard events on a dedicated thread to bypass the usual SDL event flow, leading to lower latency and immunity from main thread lag (we sometimes see SDL_PumpEvents() take a long time). Mouse input is already handled on this dedicated thread when relative mouse mode is enabled.

~~This PR is blocked as it breaks disabling the windows key during gameplay in osu!. Raw keyboard input will bypass the hook that is supposed to disable the windows key. I found some plausible workaround for this, but they are very hacky and might increase latency.~~

Enabling raw keyboard may lead to timing issues wrt TextBox text input & related handling. This PR needs to be tested to check for IME regressions.

Susko3 avatar Jan 23 '25 19:01 Susko3

Keep in mind that the hint can be toggled while the game is running. So if some issue is a deal-breaker, we can just toggle the hint off as needed. Example: if someone has a gaming keyboard that can disable the windows key in hardware, they don't need our software solution, so they would only benefit from raw keyboard.

https://wiki.libsdl.org/SDL3/SDL_HINT_WINDOWS_RAW_KEYBOARD

Susko3 avatar Jan 24 '25 14:01 Susko3

Unblocked as we have a fix for disabling the windows key during gameplay in osu!: https://github.com/ppy/osu/pull/35727.

Susko3 avatar Nov 18 '25 11:11 Susko3