mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-09 08:00:40 +00:00
MacOS: Fix bug where application started from the command line would not be in the foreground and not respond to keyboard events.
This commit is contained in:
parent
fe01e67d39
commit
6979e24254
|
@ -40,8 +40,21 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
API.Gestalt(GestaltSelector.SystemVersionBugFix, out osBugfix);
|
API.Gestalt(GestaltSelector.SystemVersionBugFix, out osBugfix);
|
||||||
|
|
||||||
Debug.Print("Running on Mac OS X {0}.{1}.{2}.", osMajor, osMinor, osBugfix);
|
Debug.Print("Running on Mac OS X {0}.{1}.{2}.", osMajor, osMinor, osBugfix);
|
||||||
|
|
||||||
|
TransformProcessToForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void TransformProcessToForeground()
|
||||||
|
{
|
||||||
|
Carbon.ProcessSerialNumber psn = new ProcessSerialNumber();
|
||||||
|
|
||||||
|
Debug.Print("Setting process to be foreground application.");
|
||||||
|
|
||||||
|
API.GetCurrentProcess(ref psn);
|
||||||
|
API.TransformProcessType(ref psn, ProcessApplicationTransformState.kProcessTransformToForegroundApplication);
|
||||||
|
API.SetFrontProcess(ref psn);
|
||||||
|
}
|
||||||
|
|
||||||
internal static CarbonGLNative WindowEventHandler
|
internal static CarbonGLNative WindowEventHandler
|
||||||
{
|
{
|
||||||
get { return eventHandler; }
|
get { return eventHandler; }
|
||||||
|
|
|
@ -388,8 +388,22 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
};
|
};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
#region --- Process Manager ---
|
||||||
|
|
||||||
enum HICoordinateSpace
|
enum ProcessApplicationTransformState : int
|
||||||
|
{
|
||||||
|
kProcessTransformToForegroundApplication = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProcessSerialNumber
|
||||||
|
{
|
||||||
|
public ulong high;
|
||||||
|
public ulong low;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
enum HICoordinateSpace
|
||||||
{
|
{
|
||||||
_72DPIGlobal = 1,
|
_72DPIGlobal = 1,
|
||||||
ScreenPixel = 2,
|
ScreenPixel = 2,
|
||||||
|
@ -756,8 +770,18 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
internal static extern void DisposeEventHandlerUPP(IntPtr userUPP);
|
internal static extern void DisposeEventHandlerUPP(IntPtr userUPP);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
#region --- Process Manager ---
|
||||||
|
|
||||||
[DllImport(carbon)]
|
[DllImport(carbon)]
|
||||||
|
internal static extern int TransformProcessType(ref Carbon.ProcessSerialNumber psn, ProcessApplicationTransformState type);
|
||||||
|
[DllImport(carbon)]
|
||||||
|
internal static extern int GetCurrentProcess(ref Carbon.ProcessSerialNumber psn);
|
||||||
|
[DllImport(carbon)]
|
||||||
|
internal static extern int SetFrontProcess(ref Carbon.ProcessSerialNumber psn);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[DllImport(carbon)]
|
||||||
static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
|
static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
|
||||||
|
|
||||||
internal static Rect GetControlBounds(IntPtr control)
|
internal static Rect GetControlBounds(IntPtr control)
|
||||||
|
|
Loading…
Reference in a new issue