Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WM_DELETE_WINDOW should check that the event message_type is WM_PROTO…
Browse files Browse the repository at this point in the history
…COLS.
  • Loading branch information
icculus committed Nov 2, 2012
1 parent 94c52ef commit 0659ddd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/video/x11/SDL_x11events.c
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11video.h
Expand Up @@ -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;
Expand Down

0 comments on commit 0659ddd

Please sign in to comment.