x11: Put a matching window_group wmhint on every window created.

This is useful to the Window Manager, so it can know to associate multiple SDL
windows with a single app.
This commit is contained in:
Ryan C. Gordon 2016-01-05 02:27:26 -05:00
parent 8e855f2fbc
commit f9af0c0376
3 changed files with 6 additions and 1 deletions

View File

@ -376,6 +376,9 @@ X11_VideoInit(_THIS)
/* Get the process PID to be associated to the window */ /* Get the process PID to be associated to the window */
data->pid = getpid(); data->pid = getpid();
/* I have no idea how random this actually is, or has to be. */
data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
/* Open a connection to the X input manager */ /* Open a connection to the X input manager */
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
if (SDL_X11_HAVE_UTF8) { if (SDL_X11_HAVE_UTF8) {

View File

@ -81,6 +81,7 @@ typedef struct SDL_VideoData
int numwindows; int numwindows;
SDL_WindowData **windowlist; SDL_WindowData **windowlist;
int windowlistlength; int windowlistlength;
XID window_group;
/* This is true for ICCCM2.0-compliant window managers */ /* This is true for ICCCM2.0-compliant window managers */
SDL_bool net_wm; SDL_bool net_wm;

View File

@ -524,7 +524,8 @@ X11_CreateWindow(_THIS, SDL_Window * window)
/* Setup the input hints so we get keyboard input */ /* Setup the input hints so we get keyboard input */
wmhints = X11_XAllocWMHints(); wmhints = X11_XAllocWMHints();
wmhints->input = True; wmhints->input = True;
wmhints->flags = InputHint; wmhints->window_group = data->window_group;
wmhints->flags = InputHint | WindowGroupHint;
/* Setup the class hints so we can get an icon (AfterStep) */ /* Setup the class hints so we can get an icon (AfterStep) */
classhints = X11_XAllocClassHint(); classhints = X11_XAllocClassHint();