From e6cc3c4752efa340d42432d0cb886b5bccfabbcb Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 2 Jun 2015 17:49:49 +0200 Subject: [PATCH] Clarified WM_PROTOCOLS event handling. --- src/x11_window.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index d3dffa6c..33e51708 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1117,16 +1117,17 @@ static void processEvent(XEvent *event) if (event->xclient.message_type == _glfw.x11.WM_PROTOCOLS) { - if (_glfw.x11.WM_DELETE_WINDOW && - (Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW) + const Atom protocol = event->xclient.data.l[0]; + if (protocol == None) + break; + + if (protocol == _glfw.x11.WM_DELETE_WINDOW) { // The window manager was asked to close the window, for example by // the user pressing a 'close' window decoration button - _glfwInputWindowCloseRequest(window); } - else if (_glfw.x11.NET_WM_PING && - (Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING) + else if (protocol == _glfw.x11.NET_WM_PING) { // The window manager is pinging the application to ensure it's // still responding to events