src/video/x11/SDL_x11window.c
changeset 6483 4b51ff3dcf74
parent 6481 fab4b15b17e9
child 6484 b904bb684095
equal deleted inserted replaced
6482:94e3643928ed 6483:4b51ff3dcf74
   807 {
   807 {
   808     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   808     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   809     Display *display = data->videodata->display;
   809     Display *display = data->videodata->display;
   810     XEvent event;
   810     XEvent event;
   811 
   811 
   812     XMapRaised(display, data->xwindow);
   812     if (!X11_IsWindowMapped(_this, window)) {
   813     /* Blocking wait for "MapNotify" event.
   813         XMapRaised(display, data->xwindow);
   814      * We use XIfEvent because XWindowEvent takes a mask rather than a type, 
   814         /* Blocking wait for "MapNotify" event.
   815      * and XCheckTypedWindowEvent doesn't block */
   815          * We use XIfEvent because XWindowEvent takes a mask rather than a type, 
   816     XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
   816          * and XCheckTypedWindowEvent doesn't block */
   817     XFlush(display);
   817         XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
       
   818         XFlush(display);
       
   819     }
   818 }
   820 }
   819 
   821 
   820 void
   822 void
   821 X11_HideWindow(_THIS, SDL_Window * window)
   823 X11_HideWindow(_THIS, SDL_Window * window)
   822 {
   824 {
   823     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   825     SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   824     Display *display = data->videodata->display;
   826     Display *display = data->videodata->display;
   825     XEvent event;
   827     XEvent event;
   826 
   828 
   827     XUnmapWindow(display, data->xwindow);
   829     if (X11_IsWindowMapped(_this, window)) {
   828     /* Blocking wait for "UnmapNotify" event */
   830         XUnmapWindow(display, data->xwindow);
   829     XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);    
   831         /* Blocking wait for "UnmapNotify" event */
   830     XFlush(display);
   832         XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);    
       
   833         XFlush(display);
       
   834     }
   831 }
   835 }
   832 
   836 
   833 void
   837 void
   834 X11_RaiseWindow(_THIS, SDL_Window * window)
   838 X11_RaiseWindow(_THIS, SDL_Window * window)
   835 {
   839 {