| 1 |
/* gdkglobals-quartz.c |
| 2 |
* |
| 3 |
* Copyright (C) 2005 Imendio AB |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
#include "gdktypes.h" |
| 21 |
#include "gdkprivate.h" |
| 22 |
#include "gdkquartz.h" |
| 23 |
#include "gdkinternal-quartz.h" |
| 24 |
|
| 25 |
GdkDisplay *_gdk_display = NULL; |
| 26 |
GdkScreen *_gdk_screen = NULL; |
| 27 |
GdkWindow *_gdk_root = NULL; |
| 28 |
|
| 29 |
GdkOSXVersion |
| 30 |
gdk_quartz_osx_version (void) |
| 31 |
{ |
| 32 |
static gint32 vkey = GDK_OSX_UNSUPPORTED; |
| 33 |
|
| 34 |
if (vkey == GDK_OSX_UNSUPPORTED) |
| 35 |
{ |
| 36 |
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 |
| 37 |
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&vkey); |
| 38 |
|
| 39 |
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED); |
| 40 |
#else |
| 41 |
NSOperatingSystemVersion version; |
| 42 |
|
| 43 |
version = [[NSProcessInfo processInfo] operatingSystemVersion]; |
| 44 |
vkey = version.majorVersion == 10 ? version.minorVersion : version.majorVersion + 5; |
| 45 |
#endif |
| 46 |
} |
| 47 |
|
| 48 |
if (vkey < GDK_OSX_MIN) |
| 49 |
return GDK_OSX_UNSUPPORTED; |
| 50 |
else if (vkey > GDK_OSX_CURRENT) |
| 51 |
return GDK_OSX_NEW; |
| 52 |
else |
| 53 |
return vkey; |
| 54 |
} |