mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-25 23:21:08 +00:00
Closing should occur in ProcessEvents.
This commit is contained in:
parent
ed87814a7f
commit
46856dc21d
|
@ -100,11 +100,12 @@ namespace OpenTK.Platform.MacOS
|
||||||
private MacOSKeyMap keyMap = new MacOSKeyMap();
|
private MacOSKeyMap keyMap = new MacOSKeyMap();
|
||||||
private OpenTK.Input.KeyboardKeyEventArgs keyArgs = new OpenTK.Input.KeyboardKeyEventArgs();
|
private OpenTK.Input.KeyboardKeyEventArgs keyArgs = new OpenTK.Input.KeyboardKeyEventArgs();
|
||||||
private KeyPressEventArgs keyPressArgs = new KeyPressEventArgs((char)0);
|
private KeyPressEventArgs keyPressArgs = new KeyPressEventArgs((char)0);
|
||||||
string title;
|
private string title;
|
||||||
RectangleF normalBounds;
|
private RectangleF normalBounds;
|
||||||
int normalLevel;
|
private int normalLevel;
|
||||||
|
private bool shouldClose;
|
||||||
|
|
||||||
const bool exclusiveFullscreen = true;
|
private const bool exclusiveFullscreen = false;
|
||||||
|
|
||||||
public CocoaNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
public CocoaNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
|
||||||
{
|
{
|
||||||
|
@ -280,19 +281,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
// PerformClose is equivalent to pressing the close-button, which
|
shouldClose = true;
|
||||||
// does not work in a borderless window. Handle this special case.
|
|
||||||
if (GetStyleMask() == NSWindowStyle.Borderless)
|
|
||||||
{
|
|
||||||
if (WindowShouldClose(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero))
|
|
||||||
{
|
|
||||||
Cocoa.SendVoid(windowInfo.Handle, selClose);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Cocoa.SendVoid(windowInfo.Handle, selPerformClose, windowInfo.Handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyModifiers GetModifiers(NSEventModifierMask mask)
|
private KeyModifiers GetModifiers(NSEventModifierMask mask)
|
||||||
|
@ -462,6 +451,26 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
Cocoa.SendVoid(NSApplication.Handle, selSendEvent, e);
|
Cocoa.SendVoid(NSApplication.Handle, selSendEvent, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle closing
|
||||||
|
if (shouldClose)
|
||||||
|
{
|
||||||
|
shouldClose = false;
|
||||||
|
|
||||||
|
// PerformClose is equivalent to pressing the close-button, which
|
||||||
|
// does not work in a borderless window. Handle this special case.
|
||||||
|
if (GetStyleMask() == NSWindowStyle.Borderless)
|
||||||
|
{
|
||||||
|
if (WindowShouldClose(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
Cocoa.SendVoid(windowInfo.Handle, selClose);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Cocoa.SendVoid(windowInfo.Handle, selPerformClose, windowInfo.Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Drawing.Point PointToClient(System.Drawing.Point point)
|
public System.Drawing.Point PointToClient(System.Drawing.Point point)
|
||||||
|
|
Loading…
Reference in a new issue