[gtk+] Bug 655122: Detect OSX version for handling version-dependent special cases (the one at hand is wind



commit fc7dfd7246d31c4007ab64957345c113492f6f5c
Author: John Ralls <jralls ceridwen us>
Date:   Sat Aug 13 15:29:11 2011 -0700

    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).

 gdk/quartz/gdkglobals-quartz.c |   17 +++++++++++++++++
 gdk/quartz/gdkquartz.h         |   15 +++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
index 6dd43dc..edfd587 100644
--- a/gdk/quartz/gdkglobals-quartz.c
+++ b/gdk/quartz/gdkglobals-quartz.c
@@ -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;
+
+}
diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
index ea00837..d85c3e5 100644
--- a/gdk/quartz/gdkquartz.h
+++ b/gdk/quartz/gdkquartz.h
@@ -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__



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]