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 6637 31e3f5b04120
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
--- a/src/video/x11/SDL_x11events.c	Fri Nov 02 14:03:14 2012 -0400
+++ b/src/video/x11/SDL_x11events.c	Fri Nov 02 14:15:21 2012 -0400
@@ -386,7 +386,8 @@
 
         /* Have we been requested to quit (or another client message?) */
     case ClientMessage:{
-            if ((xevent.xclient.format == 32) &&
+            if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
+                (xevent.xclient.format == 32) &&
                 (xevent.xclient.data.l[0] == videodata->WM_DELETE_WINDOW)) {
 
                 SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
--- a/src/video/x11/SDL_x11video.c	Fri Nov 02 14:03:14 2012 -0400
+++ b/src/video/x11/SDL_x11video.c	Fri Nov 02 14:15:21 2012 -0400
@@ -370,6 +370,7 @@
 
     /* Look up some useful Atoms */
 #define GET_ATOM(X) data->X = XInternAtom(data->display, #X, False)
+    GET_ATOM(WM_PROTOCOLS);
     GET_ATOM(WM_DELETE_WINDOW);
     GET_ATOM(_NET_WM_STATE);
     GET_ATOM(_NET_WM_STATE_HIDDEN);
--- a/src/video/x11/SDL_x11video.h	Fri Nov 02 14:03:14 2012 -0400
+++ b/src/video/x11/SDL_x11video.h	Fri Nov 02 14:15:21 2012 -0400
@@ -80,6 +80,7 @@
     SDL_bool net_wm;
 
     /* Useful atoms */
+    Atom WM_PROTOCOLS;
     Atom WM_DELETE_WINDOW;
     Atom _NET_WM_STATE;
     Atom _NET_WM_STATE_HIDDEN;