Merge branch 'macos_versionname12' of https://github.com/TcT2k/wxWidgets

Recognize Windows 11 and macOS 12 in wxGetOsDescription().

See https://github.com/wxWidgets/wxWidgets/pull/2580
This commit is contained in:
Vadim Zeitlin
2021-11-05 13:58:09 +01:00
3 changed files with 112 additions and 22 deletions

View File

@@ -917,7 +917,7 @@ wxString wxGetOsDescription();
numbers will have a value of -1. numbers will have a value of -1.
On systems where only the micro version can't be detected or doesn't make On systems where only the micro version can't be detected or doesn't make
sense such as Windows, it will have a value of 0. sense, it will have a value of 0.
For Unix-like systems (@c wxOS_UNIX) the major, minor, and micro version For Unix-like systems (@c wxOS_UNIX) the major, minor, and micro version
integers will contain the kernel's major, minor, and micro version integers will contain the kernel's major, minor, and micro version
@@ -928,24 +928,106 @@ wxString wxGetOsDescription();
natural version numbers associated with the OS; e.g. "10", "11" and "2" if natural version numbers associated with the OS; e.g. "10", "11" and "2" if
the machine is using macOS El Capitan 10.11.2. the machine is using macOS El Capitan 10.11.2.
For Windows-like systems (@c wxOS_WINDOWS) the major and minor version integers will For Windows-like systems (@c wxOS_WINDOWS) the major, minor and micro
contain the following values: (equal to the build number) version integers will contain the following values:
@beginTable <table>
@row3col{<b>Windows OS name</b>, <b>Major version</b>, <b>Minor version</b>} <tr>
@row3col{Windows 10, 10, 0} <th>Windows OS name</th>
@row3col{Windows Server 2016, 10, 0} <th>Major version</th>
@row3col{Windows 8.1, 6, 3} <th>Minor version</th>
@row3col{Windows Server 2012 R2, 6, 3} <th>Build number</th>
@row3col{Windows 8, 6, 2} </tr>
@row3col{Windows Server 2012, 6, 2} <tr>
@row3col{Windows 7, 6, 1} <td>Windows 11</td>
@row3col{Windows Server 2008 R2, 6, 1} <td>10</td>
@row3col{Windows Server 2008, 6, 0} <td>0</td>
@row3col{Windows Vista, 6, 0} <td>&gt;= 22000</td>
@row3col{Windows Server 2003 R2, 5, 2} </tr>
@row3col{Windows Server 2003, 5, 2} <tr>
@row3col{Windows XP, 5, 1} <td>Windows Server 2022</td>
@endDefList <td>10</td>
<td>0</td>
<td>&gt;= 22000</td>
</tr>
<tr>
<td>Windows 10</td>
<td>10</td>
<td>0</td>
<td></td>
</tr>
<tr>
<td>Windows Server 2016</td>
<td>10</td>
<td>0</td>
<td></td>
</tr>
<tr>
<td>Windows 8.1</td>
<td>6</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>Windows Server 2012 R2</td>
<td>6</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>Windows 8</td>
<td>6</td>
<td>2</td>
<td></td>
</tr>
<tr>
<td>Windows Server 2012</td>
<td>6</td>
<td>2</td>
<td></td>
</tr>
<tr>
<td>Windows 7</td>
<td>6</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>Windows 2008 R2</td>
<td>6</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>Windows Vista</td>
<td>6</td>
<td>0</td>
<td></td>
</tr>
<tr>
<td>Windows Server 2008</td>
<td>6</td>
<td>0</td>
<td></td>
</tr>
<tr>
<td>Windows Server 2003 R2</td>
<td>5</td>
<td>2</td>
<td></td>
</tr>
<tr>
<td>Windows Server 2003</td>
<td>5</td>
<td>2</td>
<td></td>
</tr>
<tr>
<td>Windows XP</td>
<td>5</td>
<td>1</td>
<td></td>
</tr>
</table>
See the <a href="http://msdn.microsoft.com/en-us/library/ms724832(VS.85).aspx">MSDN</a> See the <a href="http://msdn.microsoft.com/en-us/library/ms724832(VS.85).aspx">MSDN</a>
for more info about the values above. for more info about the values above.

View File

@@ -1134,9 +1134,14 @@ wxString wxGetOsDescription()
break; break;
case 10: case 10:
str = wxIsWindowsServer() == 1 if (info.dwBuildNumber >= 22000)
? "Windows Server 2016" str = wxIsWindowsServer() == 1
: "Windows 10"; ? "Windows Server 2022"
: "Windows 11";
else
str = wxIsWindowsServer() == 1
? "Windows Server 2016"
: "Windows 10";
break; break;
} }

View File

@@ -115,6 +115,9 @@ wxString wxGetOsDescription()
case 11: case 11:
osName = "Big Sur"; osName = "Big Sur";
break; break;
case 12:
osName = "Monterey";
break;
} }
} }
#else #else