From e90e7e99ce2ec2005e9d05b25445cf2db4f54522 Mon Sep 17 00:00:00 2001 From: univrsal Date: Mon, 22 Jan 2024 19:29:02 +0100 Subject: [PATCH] Gamepad hook: Do not init video on linux Might be preventing pipewire capture from initializing OpenGL --- src/hook/gamepad_hook_helper.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hook/gamepad_hook_helper.cpp b/src/hook/gamepad_hook_helper.cpp index b7e28d2c..f411eddd 100644 --- a/src/hook/gamepad_hook_helper.cpp +++ b/src/hook/gamepad_hook_helper.cpp @@ -5,7 +5,9 @@ #if defined(_WIN32) #define WIN32 1 +#define INIT_FLAGS_FOR_SDL (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) #else +#define INIT_FLAGS_FOR_SDL (SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) #define WIN32 0 #endif @@ -38,8 +40,9 @@ inline void sdl_init() SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_SetHint(SDL_HINT_LINUX_JOYSTICK_DEADZONES, "1"); - if (SDL_WasInit(0) == (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) || - SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) < 0) { + + if (SDL_WasInit(0) == INIT_FLAGS_FOR_SDL || + SDL_Init(INIT_FLAGS_FOR_SDL) < 0) { berr("Couldn't initialize SDL: %s\n", SDL_GetError()); return; }