Fixed missing ICCCM protocol message checks.

This commit is contained in:
Camilla Berglund 2014-03-09 13:24:17 +01:00
parent 98552f1d75
commit 9309f75704
4 changed files with 28 additions and 16 deletions

View File

@ -67,6 +67,7 @@ The following dependencies are needed by the examples and test programs:
cause an uncaught `BadWindow` error cause an uncaught `BadWindow` error
- [X11] Bugfix: No check was made for the presence GLX 1.3 when - [X11] Bugfix: No check was made for the presence GLX 1.3 when
`GLX_SGIX_fbconfig` was unavailable `GLX_SGIX_fbconfig` was unavailable
- [X11] Bugfix: The message type of ICCCM protocol events was not checked
## Contact ## Contact

View File

@ -430,6 +430,9 @@ static GLboolean initExtensions(void)
Bool supported; Bool supported;
// Find or create window manager atoms // Find or create window manager atoms
_glfw.x11.WM_PROTOCOLS = XInternAtom(_glfw.x11.display,
"WM_PROTOCOLS",
False);
_glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False); _glfw.x11.WM_STATE = XInternAtom(_glfw.x11.display, "WM_STATE", False);
_glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display, _glfw.x11.WM_DELETE_WINDOW = XInternAtom(_glfw.x11.display,
"WM_DELETE_WINDOW", "WM_DELETE_WINDOW",

View File

@ -107,6 +107,7 @@ typedef struct _GLFWlibraryX11
XContext context; XContext context;
// Window manager atoms // Window manager atoms
Atom WM_PROTOCOLS;
Atom WM_STATE; Atom WM_STATE;
Atom WM_DELETE_WINDOW; Atom WM_DELETE_WINDOW;
Atom NET_WM_NAME; Atom NET_WM_NAME;

View File

@ -739,7 +739,13 @@ static void processEvent(XEvent *event)
{ {
// Custom client message, probably from the window manager // Custom client message, probably from the window manager
if ((Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW) if (event->xclient.message_type == None)
break;
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)
{ {
// The window manager was asked to close the window, for example by // The window manager was asked to close the window, for example by
// the user pressing a 'close' window decoration button // the user pressing a 'close' window decoration button
@ -759,6 +765,7 @@ static void processEvent(XEvent *event)
SubstructureNotifyMask | SubstructureRedirectMask, SubstructureNotifyMask | SubstructureRedirectMask,
event); event);
} }
}
else if (event->xclient.message_type == _glfw.x11.XdndEnter) else if (event->xclient.message_type == _glfw.x11.XdndEnter)
{ {
// A drag operation has entered the window // A drag operation has entered the window