Add SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling

_NET_WM_PING protocol handling in CreateWindow if
desired.
This commit is contained in:
Sam Lantinga
2015-10-27 11:18:04 -07:00
parent 2b0140a91f
commit 38edc1779a
2 changed files with 31 additions and 5 deletions

View File

@@ -542,11 +542,23 @@ X11_CreateWindow(_THIS, SDL_Window * window)
(unsigned char *)&_NET_WM_BYPASS_COMPOSITOR_HINT_ON, 1);
{
Atom protocols[] = {
data->WM_DELETE_WINDOW, /* Allow window to be deleted by the WM */
data->_NET_WM_PING, /* Respond so WM knows we're alive */
};
X11_XSetWMProtocols(display, w, protocols, sizeof (protocols) / sizeof (protocols[0]));
Atom protocols[2];
int proto_count = 0;
const char *ping_hint;
protocols[proto_count] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */
proto_count++;
ping_hint = SDL_GetHint(SDL_HINT_VIDEO_X11_NET_WM_PING);
/* Default to using ping if there is no hint */
if (!ping_hint || SDL_atoi(ping_hint)) {
protocols[proto_count] = data->_NET_WM_PING; /* Respond so WM knows we're alive */
proto_count++;
}
SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0]));
X11_XSetWMProtocols(display, w, protocols, proto_count);
}
if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {