WM_DELETE_WINDOW should check that the event message_type is WM_PROTOCOLS.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 02 Nov 2012 14:15:21 -0400
changeset 663731e3f5b04120
parent 6636 e76e208521c3
child 6638 3d221da309d3
WM_DELETE_WINDOW should check that the event message_type is WM_PROTOCOLS.
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11video.h
     1.1 --- a/src/video/x11/SDL_x11events.c	Fri Nov 02 14:03:14 2012 -0400
     1.2 +++ b/src/video/x11/SDL_x11events.c	Fri Nov 02 14:15:21 2012 -0400
     1.3 @@ -386,7 +386,8 @@
     1.4  
     1.5          /* Have we been requested to quit (or another client message?) */
     1.6      case ClientMessage:{
     1.7 -            if ((xevent.xclient.format == 32) &&
     1.8 +            if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
     1.9 +                (xevent.xclient.format == 32) &&
    1.10                  (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) {
    1.11  
    1.12                  SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
     2.1 --- a/src/video/x11/SDL_x11video.c	Fri Nov 02 14:03:14 2012 -0400
     2.2 +++ b/src/video/x11/SDL_x11video.c	Fri Nov 02 14:15:21 2012 -0400
     2.3 @@ -370,6 +370,7 @@
     2.4  
     2.5      /* Look up some useful Atoms */
     2.6  #define GET_ATOM(X) data->X = XInternAtom(data->display, #X, False)
     2.7 +    GET_ATOM(WM_PROTOCOLS);
     2.8      GET_ATOM(WM_DELETE_WINDOW);
     2.9      GET_ATOM(_NET_WM_STATE);
    2.10      GET_ATOM(_NET_WM_STATE_HIDDEN);
     3.1 --- a/src/video/x11/SDL_x11video.h	Fri Nov 02 14:03:14 2012 -0400
     3.2 +++ b/src/video/x11/SDL_x11video.h	Fri Nov 02 14:15:21 2012 -0400
     3.3 @@ -80,6 +80,7 @@
     3.4      SDL_bool net_wm;
     3.5  
     3.6      /* Useful atoms */
     3.7 +    Atom WM_PROTOCOLS;
     3.8      Atom WM_DELETE_WINDOW;
     3.9      Atom _NET_WM_STATE;
    3.10      Atom _NET_WM_STATE_HIDDEN;