Browse Source

Added OperatingSystemType::MacOSX for checking whether any version of OSX is running, and also Windows 10 detection.

tags/2021-05-28
jules 10 years ago
parent
commit
19b2beec63
2 changed files with 33 additions and 25 deletions
  1. +8
    -2
      modules/juce_core/native/juce_win32_SystemStats.cpp
  2. +25
    -23
      modules/juce_core/system/juce_SystemStats.h

+ 8
- 2
modules/juce_core/native/juce_win32_SystemStats.cpp View File

@@ -131,7 +131,12 @@ static bool isWindowsVersionOrLater (SystemStats::OperatingSystemType target)
zerostruct (info);
info.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
if (target >= SystemStats::WinVista)
if (target >= SystemStats::Windows10)
{
info.dwMajorVersion = 10;
info.dwMinorVersion = 0;
}
else if (target >= SystemStats::WinVista)
{
info.dwMajorVersion = 6;
@@ -166,7 +171,7 @@ static bool isWindowsVersionOrLater (SystemStats::OperatingSystemType target)
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
{
const SystemStats::OperatingSystemType types[]
= { Windows8_1, Windows8_0, Windows7, WinVista, WinXP, Win2000 };
= { Windows10, Windows8_1, Windows8_0, Windows7, WinVista, WinXP, Win2000 };
for (int i = 0; i < numElementsInArray (types); ++i)
if (isWindowsVersionOrLater (types[i]))
@@ -182,6 +187,7 @@ String SystemStats::getOperatingSystemName()
switch (getOperatingSystemType())
{
case Windows10: name = "Windows 10"; break;
case Windows8_1: name = "Windows 8.1"; break;
case Windows8_0: name = "Windows 8.0"; break;
case Windows7: name = "Windows 7"; break;


+ 25
- 23
modules/juce_core/system/juce_SystemStats.h View File

@@ -47,29 +47,31 @@ public:
/** The set of possible results of the getOperatingSystemType() method. */
enum OperatingSystemType
{
UnknownOS = 0,
Linux = 0x2000,
Android = 0x3000,
iOS = 0x8000,
MacOSX_10_4 = 0x1004,
MacOSX_10_5 = 0x1005,
MacOSX_10_6 = 0x1006,
MacOSX_10_7 = 0x1007,
MacOSX_10_8 = 0x1008,
MacOSX_10_9 = 0x1009,
MacOSX_10_10 = 0x100a,
Win2000 = 0x4105,
WinXP = 0x4106,
WinVista = 0x4107,
Windows7 = 0x4108,
Windows8_0 = 0x4109,
Windows8_1 = 0x410a,
Windows = 0x4000, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
UnknownOS = 0,
MacOSX = 0x0100, /**< To test whether any version of OSX is running,
you can use the expression ((getOperatingSystemType() & MacOSX) != 0). */
Windows = 0x0200, /**< To test whether any version of Windows is running,
you can use the expression ((getOperatingSystemType() & Windows) != 0). */
Linux = 0x0400,
Android = 0x0800,
iOS = 0x1000,
MacOSX_10_4 = MacOSX | 4,
MacOSX_10_5 = MacOSX | 5,
MacOSX_10_6 = MacOSX | 6,
MacOSX_10_7 = MacOSX | 7,
MacOSX_10_8 = MacOSX | 8,
MacOSX_10_9 = MacOSX | 9,
MacOSX_10_10 = MacOSX | 10,
Win2000 = Windows | 1,
WinXP = Windows | 2,
WinVista = Windows | 3,
Windows7 = Windows | 4,
Windows8_0 = Windows | 5,
Windows8_1 = Windows | 6,
Windows10 = Windows | 7
};
/** Returns the type of operating system we're running on.


Loading…
Cancel
Save