Bug 655122: Detect OSX version for handling version-dependent special

cases (the one at hand is window resizing, which is handled differently
on OSX 10.7 from earlier versions).
This commit is contained in:
John Ralls 2011-08-13 15:29:11 -07:00
parent 7862187015
commit fc7dfd7246
2 changed files with 32 additions and 0 deletions

View File

@ -21,7 +21,24 @@
#include "config.h"
#include "gdktypes.h"
#include "gdkprivate.h"
#include "gdkquartz.h"
GdkDisplay *_gdk_display = NULL;
GdkScreen *_gdk_screen = NULL;
GdkWindow *_gdk_root = NULL;
GdkOSXVersion
gdk_quartz_osx_version (void)
{
gint minor;
OSErr err = Gestalt(gestaltSystemVersionMinor, &minor);
g_return_val_if_fail(err == noErr, GDK_OSX_UNSUPPORTED);
if (minor < GDK_OSX_MIN)
return GDK_OSX_UNSUPPORTED;
else if (minor > GDK_OSX_CURRENT)
return GDK_OSX_NEW;
else
return minor;
}

View File

@ -1,3 +1,4 @@
/* gdkquartz.h
*
* Copyright (C) 2005-2007 Imendio AB
@ -41,6 +42,20 @@ typedef unsigned int NSUInteger;
typedef float CGFloat;
#endif
typedef enum
{
GDK_OSX_UNSUPPORTED = 0,
GDK_OSX_MIN = 4,
GDK_OSX_TIGER = 4,
GDK_OSX_LEOPARD = 5,
GDK_OSX_SNOW_LEOPARD = 6,
GDK_OSX_LION = 7,
GDK_OSX_CURRENT = 7,
GDK_OSX_NEW = 99
} GdkOSXVersion;
GdkOSXVersion gdk_quartz_osx_version (void);
G_END_DECLS
#define __GDKQUARTZ_H_INSIDE__