From d0294dbe5f224c399fdefe955d13854479cd4770 Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 10 Feb 2019 19:13:32 +0100 Subject: [PATCH] let SDL use the X11 XRandR window manager per default. there's a command "gfx_use_x11xrandr_wm" to turn that off. this should help with override redirect issues --- src/engine/client/backend_sdl.cpp | 3 +++ src/engine/client/graphics_threaded.cpp | 1 + src/engine/client/graphics_threaded.h | 1 + src/engine/shared/config_variables.h | 1 + 4 files changed, 6 insertions(+) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index f22bfff01..c055ae8ab 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -703,6 +703,9 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt SdlFlags |= SDL_WINDOW_FULLSCREEN; #endif + if(Flags&IGraphicsBackend::INITFLAG_X11XRANDR) + SDL_SetHint(SDL_HINT_VIDEO_X11_XRANDR, "1"); + // set gl attributes SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); if(FsaaSamples) diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index abf00ad83..7ef403c2f 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -744,6 +744,7 @@ int CGraphics_Threaded::IssueInit() if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN; if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC; if(g_Config.m_DbgResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE; + if(g_Config.m_GfxUseX11XRandRWM) Flags |= IGraphicsBackend::INITFLAG_X11XRANDR; return m_pBackend->Init("Teeworlds", &g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight); } diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h index 47a08a614..48f338254 100644 --- a/src/engine/client/graphics_threaded.h +++ b/src/engine/client/graphics_threaded.h @@ -309,6 +309,7 @@ public: INITFLAG_VSYNC = 2, INITFLAG_RESIZABLE = 4, INITFLAG_BORDERLESS = 8, + INITFLAG_X11XRANDR = 16, }; virtual ~IGraphicsBackend() {} diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index fcbea920f..4b9ca0a02 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -59,6 +59,7 @@ MACRO_CONFIG_INT(GfxFinish, gfx_finish, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "W MACRO_CONFIG_INT(GfxAsyncRender, gfx_asyncrender, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Do rendering async from the the update") MACRO_CONFIG_INT(GfxMaxFps, gfx_maxfps, 144, 30, 2000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Maximum fps (when limit fps is enabled)") MACRO_CONFIG_INT(GfxLimitFps, gfx_limitfps, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Limit fps") +MACRO_CONFIG_INT(GfxUseX11XRandRWM, gfx_use_x11xrandr_wm, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Let SDL use the X11 XRandR window manager") MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Disable OS mouse settings such as mouse acceleration, use raw mouse input mode") MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ingame mouse sensitivity")