From 162faad8e3cc47f32e0c1ef19b52257ec7f657bb Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 19 Oct 2009 19:03:17 +0000 Subject: [PATCH] * X11GLNative.cs: Correctly set all necessary ClientMessage fields for XSendEvent call in Close() method. --- Source/OpenTK/Platform/X11/X11GLNative.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index 9a3a485f..b3785559 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -585,8 +585,10 @@ namespace OpenTK.Platform.X11 break; case XEventName.ClientMessage: + Debug.WriteLine("Client message received."); if (e.ClientMessageEvent.ptr1 == _atom_wm_destroy) { + Debug.WriteLine("Exit message received."); CancelEventArgs ce = new CancelEventArgs(); if (Closing != null) Closing(this, ce); @@ -597,7 +599,8 @@ namespace OpenTK.Platform.X11 if (Unload != null) Unload(this, EventArgs.Empty); - + + Debug.WriteLine("Destroying window."); Functions.XDestroyWindow(window.Display, window.WindowHandle); break; } @@ -606,6 +609,7 @@ namespace OpenTK.Platform.X11 break; case XEventName.DestroyNotify: + Debug.WriteLine("Window destroyed"); exists = false; if (Closed != null) @@ -1276,9 +1280,14 @@ namespace OpenTK.Platform.X11 public void Exit() { XEvent ev = new XEvent(); + ev.type = XEventName.ClientMessage; + ev.ClientMessageEvent.format = 32; + ev.ClientMessageEvent.display = window.Display; + ev.ClientMessageEvent.window = window.WindowHandle; ev.ClientMessageEvent.ptr1 = _atom_wm_destroy; Functions.XSendEvent(window.Display, window.WindowHandle, false, - new IntPtr((int)EventMask.NoEventMask), ref ev); + EventMask.NoEventMask, ref ev); + Functions.XFlush(window.Display); } #endregion