[gtk+/gtk-2-24: 3/4] Bug 655122: Detect OSX version for handling version-dependent special cases (the one in question is



commit 9edc6ca045499b49bf48cff5fdd36aa6cea25c86
Author: John Ralls <jralls ceridwen us>
Date:   Sat Aug 13 13:55:08 2011 -0700

    Bug 655122: Detect OSX version for handling version-dependent special cases (the one in question is resizing, which OSX 10.7 allows on all edges instead of the lower-right corner as on previous versions)

 gdk/quartz/gdkglobals-quartz.c |   17 +++++++++++++++++
 gdk/quartz/gdkquartz.h         |   13 +++++++++++++
 2 files changed, 30 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 48c4748..742d651 100644
--- a/gdk/quartz/gdkquartz.h
+++ b/gdk/quartz/gdkquartz.h
@@ -39,11 +39,24 @@ 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;
+
 NSWindow *gdk_quartz_window_get_nswindow                        (GdkWindow      *window);
 NSView   *gdk_quartz_window_get_nsview                          (GdkWindow      *window);
 NSImage  *gdk_quartz_pixbuf_to_ns_image_libgtk_only             (GdkPixbuf      *pixbuf);
 id        gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context);
 NSEvent  *gdk_quartz_event_get_nsevent                          (GdkEvent       *event);
+GdkOSXVersion gdk_quartz_osx_version                            (void);
 
 G_END_DECLS
 



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