Fixed XBadWindow error when iconified under Unity3D
authorSam Lantinga <slouken@libsdl.org>
Tue, 06 Nov 2012 10:34:47 -0800
changeset 66594016ef96095a
parent 6658 1f867cd3e2aa
child 6660 4fa0723e6874
Fixed XBadWindow error when iconified under Unity3D
Apparently the root window changes in this case. We want to send to the root window that is being listened to by the window manager, so this should be okay.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Tue Nov 06 10:20:14 2012 -0800
     1.2 +++ b/src/video/x11/SDL_x11events.c	Tue Nov 06 10:34:47 2012 -0800
     1.3 @@ -389,17 +389,11 @@
     1.4              if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
     1.5                  (xevent.xclient.format == 32) &&
     1.6                  (xevent.xclient.data.l[0] == videodata->_NET_WM_PING)) {
     1.7 -
     1.8 -                SDL_DisplayData *dpydata;
     1.9 -                Window root;
    1.10 +                Window root = DefaultRootWindow(display);
    1.11  
    1.12  #ifdef DEBUG_XEVENTS
    1.13                  printf("window %p: _NET_WM_PING\n", data);
    1.14  #endif
    1.15 -
    1.16 -                dpydata = (SDL_DisplayData *)
    1.17 -                    SDL_GetDisplayForWindow(data->window);
    1.18 -                root = RootWindow(display, dpydata->screen);
    1.19                  xevent.xclient.window = root;
    1.20                  XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
    1.21                  break;
    1.22 @@ -412,7 +406,6 @@
    1.23  #ifdef DEBUG_XEVENTS
    1.24                  printf("window %p: WM_DELETE_WINDOW\n", data);
    1.25  #endif
    1.26 -
    1.27                  SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
    1.28                  break;
    1.29              }