* 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; break;
case XEventName.ClientMessage: case XEventName.ClientMessage:
Debug.WriteLine("Client message received.");
if (e.ClientMessageEvent.ptr1 == _atom_wm_destroy) if (e.ClientMessageEvent.ptr1 == _atom_wm_destroy)
{ {
Debug.WriteLine("Exit message received.");
CancelEventArgs ce = new CancelEventArgs(); CancelEventArgs ce = new CancelEventArgs();
if (Closing != null) if (Closing != null)
Closing(this, ce); Closing(this, ce);
@ -597,7 +599,8 @@ namespace OpenTK.Platform.X11
if (Unload != null) if (Unload != null)
Unload(this, EventArgs.Empty); Unload(this, EventArgs.Empty);
Debug.WriteLine("Destroying window.");
Functions.XDestroyWindow(window.Display, window.WindowHandle); Functions.XDestroyWindow(window.Display, window.WindowHandle);
break; break;
} }
@ -606,6 +609,7 @@ namespace OpenTK.Platform.X11
break; break;
case XEventName.DestroyNotify: case XEventName.DestroyNotify:
Debug.WriteLine("Window destroyed");
exists = false; exists = false;
if (Closed != null) if (Closed != null)
@ -1276,9 +1280,14 @@ namespace OpenTK.Platform.X11
public void Exit() public void Exit()
{ {
XEvent ev = new XEvent(); 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; ev.ClientMessageEvent.ptr1 = _atom_wm_destroy;
Functions.XSendEvent(window.Display, window.WindowHandle, false, Functions.XSendEvent(window.Display, window.WindowHandle, false,
new IntPtr((int)EventMask.NoEventMask), ref ev); EventMask.NoEventMask, ref ev);
Functions.XFlush(window.Display);
} }
#endregion #endregion