mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-02 15:45:58 +00:00
SDL: Fix a XWayland crash when capturing keyboard input
This commit is contained in:
parent
498db18f2c
commit
9c210aa223
1 changed files with 11 additions and 0 deletions
|
@ -369,6 +369,17 @@ bool InputBackend::HandleEventAndContinue(const SDL_Event& e)
|
|||
}
|
||||
else if (e.type == Common::KeyboardContext::s_sdl_init_event_type)
|
||||
{
|
||||
const auto wsi = GetControllerInterface().GetWindowSystemInfo();
|
||||
if (wsi.type == WindowSystemType::X11)
|
||||
{
|
||||
// Avoid a crash with Xwayland when the wrong driver is picked
|
||||
if (!SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "x11"))
|
||||
{
|
||||
WARN_LOG_FMT(IOS_USB, "SDL failed to pick driver to capture keyboard input: {}",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
if (!SDL_InitSubSystem(SDL_INIT_VIDEO))
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_USB, "SDL failed to init subsystem to capture keyboard input: {}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue