From ceff0a1adb6c6b3ac55ae2032129bcd0ff41ce96 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Nov 2012 10:34:47 -0800 Subject: [PATCH] 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 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index cfae4bcaa..30d0bdb74 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -389,17 +389,11 @@ X11_DispatchEvent(_THIS) if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) && (xevent.xclient.format == 32) && (xevent.xclient.data.l[0] == videodata->_NET_WM_PING)) { - - SDL_DisplayData *dpydata; - Window root; + Window root = DefaultRootWindow(display); #ifdef DEBUG_XEVENTS printf("window %p: _NET_WM_PING\n", data); #endif - - dpydata = (SDL_DisplayData *) - SDL_GetDisplayForWindow(data->window); - root = RootWindow(display, dpydata->screen); xevent.xclient.window = root; XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xevent); break; @@ -412,7 +406,6 @@ X11_DispatchEvent(_THIS) #ifdef DEBUG_XEVENTS printf("window %p: WM_DELETE_WINDOW\n", data); #endif - SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; }