From 0659ddd887cd32ae522cb9d7d4fd6dfee3d663a6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 2 Nov 2012 14:15:21 -0400 Subject: [PATCH] WM_DELETE_WINDOW should check that the event message_type is WM_PROTOCOLS. --- src/video/x11/SDL_x11events.c | 3 ++- src/video/x11/SDL_x11video.c | 1 + src/video/x11/SDL_x11video.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 26b1e0062..47ba10d63 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -386,7 +386,8 @@ X11_DispatchEvent(_THIS) /* 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); diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 122023832..637e2b6e1 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -370,6 +370,7 @@ X11_VideoInit(_THIS) /* 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); diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index 94793fe66..6ed951462 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -80,6 +80,7 @@ typedef struct SDL_VideoData SDL_bool net_wm; /* Useful atoms */ + Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; Atom _NET_WM_STATE; Atom _NET_WM_STATE_HIDDEN;