diff --git a/doc/changelog.dox b/doc/changelog.dox index 149f0a82b..a2f8815d2 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -267,6 +267,9 @@ See also: @cpp {640, 480} @ce - @ref Platform::Sdl2Application::Configuration::WindowFlags values that make no sense on Emscripten are not available there anymore +- When using SDL 2.0.8 and newer, @ref Platform::Sdl2Application no longer + attempts to disable compositing on Linux. See @ref Platform-Sdl2Application-usage-linux + for more information. @subsubsection changelog-latest-changes-shaders Shaders library diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index d7d59a497..5b701f057 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -95,6 +95,10 @@ Sdl2Application::Sdl2Application(const Arguments& arguments, NoCreateT): std::exit(1); } + #ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* Available since 2.0.8 */ + SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); + #endif + /* Save command-line arguments */ if(args.value("log") == "verbose") _verboseLog = true; const std::string dpiScaling = args.value("dpi-scaling"); diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index a2a8df49e..433b61df0 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -228,6 +228,21 @@ If no other application header is included, this class is also aliased to @cpp Platform::Application @ce and the macro is aliased to @cpp MAGNUM_APPLICATION_MAIN() @ce to simplify porting. +@subsection Platform-Sdl2Application-usage-linux Linux specifics + +SDL by default attempts to disable compositing, which may cause ugly flickering +for non-fullscreen apps (KWin, among others, is known to respect this setting). +When using SDL >= 2.0.8, @ref Sdl2Application turns this behavior off, keeping +the compositor running to avoid the flicker. You can turn this behavior back on +by enabling the [corresponding SDL hint](https://wiki.libsdl.org/CategoryHints) through an environment variable: + +@code{.sh} +SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR=1 ./your-app +@endcode + +If you're running an older version of SDL, you can disallow apps from bypassing +the compositor in system-wide KWin settings. + @subsection Platform-Sdl2Application-usage-ios iOS specifics Leaving a default (zero) window size in @ref Configuration will cause the app