[client] set the compositor bypass hint

This commit is contained in:
Geoffrey McRae 2017-12-11 04:11:36 +11:00
parent 8adf7cbacd
commit e2c1f1cd77

View File

@ -18,7 +18,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <getopt.h>
#include <SDL2/SDL.h>
#include <SDL_ttf.h>
#include <SDL2/SDL_syswm.h>
#include <SDL2/SDL_ttf.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
@ -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");