mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-01 21:08:17 +00:00
Add MacOS code to call gestalt to detect OS version.
This commit is contained in:
parent
4ac210a991
commit
ebc3490243
|
@ -20,6 +20,7 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
static bool mInitialized = false;
|
static bool mInitialized = false;
|
||||||
static IntPtr uppHandler;
|
static IntPtr uppHandler;
|
||||||
static CarbonGLNative eventHandler;
|
static CarbonGLNative eventHandler;
|
||||||
|
static int osMajor, osMinor, osBugfix;
|
||||||
|
|
||||||
static Application()
|
static Application()
|
||||||
{
|
{
|
||||||
|
@ -33,6 +34,12 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
API.AcquireRootMenu();
|
API.AcquireRootMenu();
|
||||||
|
|
||||||
ConnectEvents();
|
ConnectEvents();
|
||||||
|
|
||||||
|
API.Gestalt(GestaltSelector.SystemVersionMajor, out osMajor);
|
||||||
|
API.Gestalt(GestaltSelector.SystemVersionMinor, out osMinor);
|
||||||
|
API.Gestalt(GestaltSelector.SystemVersionBugFix, out osBugfix);
|
||||||
|
|
||||||
|
Debug.Print("Running on Mac OS X {0}.{1}.{2}.", osMajor, osMinor, osBugfix);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static CarbonGLNative WindowEventHandler
|
internal static CarbonGLNative WindowEventHandler
|
||||||
|
|
|
@ -370,6 +370,17 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
inStructure = 15,
|
inStructure = 15,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region --- Enums from gestalt.h ---
|
||||||
|
|
||||||
|
internal enum GestaltSelector
|
||||||
|
{
|
||||||
|
SystemVersion = 0x73797376, // FOUR_CHAR_CODE("sysv"), /* system version*/
|
||||||
|
SystemVersionMajor = 0x73797331, // FOUR_CHAR_CODE("sys1"), /* The major system version number; in 10.4.17 this would be the decimal value 10 */
|
||||||
|
SystemVersionMinor = 0x73797332, // FOUR_CHAR_CODE("sys2"), /* The minor system version number; in 10.4.17 this would be the decimal value 4 */
|
||||||
|
SystemVersionBugFix = 0x73797333, // FOUR_CHAR_CODE("sys3") /* The bug fix system version number; in 10.4.17 this would be the decimal value 17 */
|
||||||
|
};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region --- Carbon API Methods ---
|
#region --- Carbon API Methods ---
|
||||||
|
@ -873,6 +884,12 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||||
IntPtr displayID, out IntPtr displayDevice, Boolean failToMain);
|
IntPtr displayID, out IntPtr displayDevice, Boolean failToMain);
|
||||||
|
|
||||||
|
|
||||||
|
const string gestaltlib = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon";
|
||||||
|
|
||||||
|
|
||||||
|
[DllImport(gestaltlib)]
|
||||||
|
internal static extern OSStatus Gestalt(GestaltSelector selector, out int response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue