MacOS: Fix event from user clicking close box to properly report that window doesn't exist anymore.
This commit is contained in:
parent
017c9e86d0
commit
c605a05ffb
2 changed files with 14 additions and 11 deletions
|
@ -700,18 +700,18 @@ namespace OpenTK.Platform.MacOS.Carbon
|
|||
{
|
||||
IntPtr windowTarget = GetWindowEventTarget(windowRef);
|
||||
|
||||
Debug.Print("Window: {0}", windowRef);
|
||||
Debug.Print("Window Target: {0}", windowTarget);
|
||||
Debug.Print("Handler: {0}", uppHandlerProc);
|
||||
Debug.Print("Num Events: {0}", eventTypes.Length);
|
||||
Debug.Print("User Data: {0}", userData);
|
||||
Debug.Print("Handler Ref: {0}", handlerRef);
|
||||
//Debug.Print("Window: {0}", windowRef);
|
||||
//Debug.Print("Window Target: {0}", windowTarget);
|
||||
//Debug.Print("Handler: {0}", uppHandlerProc);
|
||||
//Debug.Print("Num Events: {0}", eventTypes.Length);
|
||||
//Debug.Print("User Data: {0}", userData);
|
||||
//Debug.Print("Handler Ref: {0}", handlerRef);
|
||||
|
||||
OSStatus error = _InstallEventHandler(windowTarget, uppHandlerProc,
|
||||
eventTypes.Length, eventTypes,
|
||||
userData, handlerRef);
|
||||
|
||||
Debug.Print("Status: {0}", error);
|
||||
//Debug.Print("Status: {0}", error);
|
||||
|
||||
if (error != OSStatus.NoError)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenTK.Platform.MacOS
|
|||
string title = "OpenTK Window";
|
||||
Rectangle bounds, windowedBounds, clientRectangle;
|
||||
bool mIsDisposed = false;
|
||||
bool mExists = true;
|
||||
|
||||
WindowAttributes mWindowAttrib;
|
||||
WindowClass mWindowClass;
|
||||
|
@ -112,6 +113,7 @@ namespace OpenTK.Platform.MacOS
|
|||
Debug.Print("Disposing of CarbonGLNative window.");
|
||||
|
||||
mIsDisposed = true;
|
||||
mExists = false;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
|
@ -289,8 +291,8 @@ namespace OpenTK.Platform.MacOS
|
|||
return OSStatus.EventNotHandled;
|
||||
}
|
||||
|
||||
EventInfo evt = new EventInfo(inEvent);
|
||||
CarbonGLNative window = (CarbonGLNative)reference.Target;
|
||||
CarbonGLNative window = (CarbonGLNative)reference.Target;
|
||||
EventInfo evt = new EventInfo(inEvent);
|
||||
|
||||
//Debug.Print("Processing {0} event for {1}.", evt, window.window);
|
||||
|
||||
|
@ -366,7 +368,8 @@ namespace OpenTK.Platform.MacOS
|
|||
return OSStatus.EventNotHandled;
|
||||
|
||||
case WindowEventKind.WindowClosed:
|
||||
OnClosed();
|
||||
mExists = false;
|
||||
OnClosed();
|
||||
|
||||
return OSStatus.NoError;
|
||||
|
||||
|
@ -639,7 +642,7 @@ namespace OpenTK.Platform.MacOS
|
|||
|
||||
public bool Exists
|
||||
{
|
||||
get { return !mIsDisposed; }
|
||||
get { return mExists; }
|
||||
}
|
||||
|
||||
public IWindowInfo WindowInfo
|
||||
|
|
Loading…
Reference in a new issue