x11: Put a matching window_group wmhint on every window created.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 05 Jan 2016 02:27:26 -0500
changeset 10023d8015905fef6
parent 10022 30807689ca1b
child 10024 9a1189c7b891
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.
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11video.h
src/video/x11/SDL_x11window.c
     1.1 --- a/src/video/x11/SDL_x11video.c	Tue Jan 05 01:42:00 2016 -0500
     1.2 +++ b/src/video/x11/SDL_x11video.c	Tue Jan 05 02:27:26 2016 -0500
     1.3 @@ -376,6 +376,9 @@
     1.4      /* Get the process PID to be associated to the window */
     1.5      data->pid = getpid();
     1.6  
     1.7 +    /* I have no idea how random this actually is, or has to be. */
     1.8 +    data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
     1.9 +
    1.10      /* Open a connection to the X input manager */
    1.11  #ifdef X_HAVE_UTF8_STRING
    1.12      if (SDL_X11_HAVE_UTF8) {
     2.1 --- a/src/video/x11/SDL_x11video.h	Tue Jan 05 01:42:00 2016 -0500
     2.2 +++ b/src/video/x11/SDL_x11video.h	Tue Jan 05 02:27:26 2016 -0500
     2.3 @@ -81,6 +81,7 @@
     2.4      int numwindows;
     2.5      SDL_WindowData **windowlist;
     2.6      int windowlistlength;
     2.7 +    XID window_group;
     2.8  
     2.9      /* This is true for ICCCM2.0-compliant window managers */
    2.10      SDL_bool net_wm;
     3.1 --- a/src/video/x11/SDL_x11window.c	Tue Jan 05 01:42:00 2016 -0500
     3.2 +++ b/src/video/x11/SDL_x11window.c	Tue Jan 05 02:27:26 2016 -0500
     3.3 @@ -524,7 +524,8 @@
     3.4      /* Setup the input hints so we get keyboard input */
     3.5      wmhints = X11_XAllocWMHints();
     3.6      wmhints->input = True;
     3.7 -    wmhints->flags = InputHint;
     3.8 +    wmhints->window_group = data->window_group;
     3.9 +    wmhints->flags = InputHint | WindowGroupHint;
    3.10  
    3.11      /* Setup the class hints so we can get an icon (AfterStep) */
    3.12      classhints = X11_XAllocClassHint();