src/video/x11/SDL_x11events.c
changeset 6659 4016ef96095a
parent 6638 3d221da309d3
child 6660 4fa0723e6874
equal deleted inserted replaced
6658:1f867cd3e2aa 6659:4016ef96095a
   387         /* Have we been requested to quit (or another client message?) */
   387         /* Have we been requested to quit (or another client message?) */
   388     case ClientMessage:{
   388     case ClientMessage:{
   389             if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
   389             if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
   390                 (xevent.xclient.format == 32) &&
   390                 (xevent.xclient.format == 32) &&
   391                 (xevent.xclient.data.l[0] == videodata->_NET_WM_PING)) {
   391                 (xevent.xclient.data.l[0] == videodata->_NET_WM_PING)) {
   392 
   392                 Window root = DefaultRootWindow(display);
   393                 SDL_DisplayData *dpydata;
       
   394                 Window root;
       
   395 
   393 
   396 #ifdef DEBUG_XEVENTS
   394 #ifdef DEBUG_XEVENTS
   397                 printf("window %p: _NET_WM_PING\n", data);
   395                 printf("window %p: _NET_WM_PING\n", data);
   398 #endif
   396 #endif
   399 
       
   400                 dpydata = (SDL_DisplayData *)
       
   401                     SDL_GetDisplayForWindow(data->window);
       
   402                 root = RootWindow(display, dpydata->screen);
       
   403                 xevent.xclient.window = root;
   397                 xevent.xclient.window = root;
   404                 XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
   398                 XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
   405                 break;
   399                 break;
   406             }
   400             }
   407 
   401 
   410                 (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) {
   404                 (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) {
   411 
   405 
   412 #ifdef DEBUG_XEVENTS
   406 #ifdef DEBUG_XEVENTS
   413                 printf("window %p: WM_DELETE_WINDOW\n", data);
   407                 printf("window %p: WM_DELETE_WINDOW\n", data);
   414 #endif
   408 #endif
   415 
       
   416                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
   409                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
   417                 break;
   410                 break;
   418             }
   411             }
   419         }
   412         }
   420         break;
   413         break;