* X11GLNative.cs: Correctly set all necessary ClientMessage fields

for XSendEvent call in Close() method.
This commit is contained in:
the_fiddler 2009-10-19 19:03:17 +00:00
parent 47c1cc69e5
commit 162faad8e3

View file

@ -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