Skip to content

Commit

Permalink
Disable X11 compositor bypass
Browse files Browse the repository at this point in the history
Compositor bypass is meant for fullscreen games consuming lots of GPU
resources. For a light app that will usually be windowed, this only
causes unnecessary compositor suspends, especially visible (and
annoying) with complying window manager like KWin.

Signed-off-by: Romain Vimont <[email protected]>
  • Loading branch information
dos1 authored and rom1v committed May 5, 2019
1 parent 068253a commit b941854
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@
# define SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP
#endif

#if SDL_VERSION_ATLEAST(2, 0, 8)
// <https://hg.libsdl.org/SDL/rev/dfde5d3f9781>
# define SCRCPY_SDL_HAS_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
#endif

#endif
7 changes: 7 additions & 0 deletions app/src/scrcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ sdl_init_and_configure(bool display) {
}
#endif

#ifdef SCRCPY_SDL_HAS_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
// Disable compositor bypassing on X11
if (!SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0")) {
LOGW("Could not disable X11 compositor bypass");
}
#endif

// Do not disable the screensaver when scrcpy is running
SDL_EnableScreenSaver();

Expand Down

0 comments on commit b941854

Please sign in to comment.