mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 11:35:39 +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,6 +40,19 @@ namespace OpenTK.Platform.MacOS.Carbon
|
|||
API.Gestalt(GestaltSelector.SystemVersionBugFix, out 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
|
||||
|
|
|
@ -387,6 +387,20 @@ namespace OpenTK.Platform.MacOS.Carbon
|
|||
SystemVersionBugFix = 0x73797333, // FOUR_CHAR_CODE("sys3") /* The bug fix system version number; in 10.4.17 this would be the decimal value 17 */
|
||||
};
|
||||
|
||||
#endregion
|
||||
#region --- Process Manager ---
|
||||
|
||||
enum ProcessApplicationTransformState : int
|
||||
{
|
||||
kProcessTransformToForegroundApplication = 1,
|
||||
}
|
||||
|
||||
struct ProcessSerialNumber
|
||||
{
|
||||
public ulong high;
|
||||
public ulong low;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
enum HICoordinateSpace
|
||||
|
@ -755,6 +769,16 @@ namespace OpenTK.Platform.MacOS.Carbon
|
|||
[DllImport(carbon)]
|
||||
internal static extern void DisposeEventHandlerUPP(IntPtr userUPP);
|
||||
|
||||
#endregion
|
||||
#region --- Process Manager ---
|
||||
|
||||
[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)]
|
||||
|
|
Loading…
Reference in a new issue