From e2c1f1cd77724662e35ce31f95540ce1f1f54b35 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 11 Dec 2017 04:11:36 +1100 Subject: [PATCH] [client] set the compositor bypass hint --- client/main.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/client/main.c b/client/main.c index a2abfcd2..25acbd87 100644 --- a/client/main.c +++ b/client/main.c @@ -18,7 +18,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include #include -#include +#include +#include #include #include #include @@ -625,6 +626,32 @@ int run() ) ); + // set the compositor hint to bypass for low latency + SDL_SysWMinfo wminfo; + SDL_VERSION(&wminfo.version); + if (SDL_GetWindowWMInfo(state.window, &wminfo)) + { + if (wminfo.subsystem == SDL_SYSWM_X11) + { + Atom NETWM_BYPASS_COMPOSITOR = XInternAtom( + wminfo.info.x11.display, + "NETWM_BYPASS_COMPOSITOR", + False); + + unsigned long value = 1; + XChangeProperty( + wminfo.info.x11.display, + wminfo.info.x11.window, + NETWM_BYPASS_COMPOSITOR, + XA_CARDINAL, + 32, + PropModeReplace, + (unsigned char *)&value, + 1 + ); + } + } + if (!state.window) { DEBUG_ERROR("failed to create window");