Skip to content

Commit

Permalink
Gamepad hook: Do not init video on linux
Browse files Browse the repository at this point in the history
Might be preventing pipewire capture from initializing OpenGL
  • Loading branch information
univrsal committed Jan 22, 2024
1 parent 130ee31 commit e90e7e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hook/gamepad_hook_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit e90e7e9

Please sign in to comment.