[gtk+/gtk-2-24] quartz: call Gestalt() only once per session in gdk_quartz_osx_version()



commit d6533ffc44d77b42cce7987f249fa481581b7c50
Author: Michael Natterer <mitch gimp org>
Date:   Thu Nov 29 14:44:04 2012 +0100

    quartz: call Gestalt() only once per session in gdk_quartz_osx_version()
    
    Thanks to Paul Davis for pointing this out.

 gdk/quartz/gdkglobals-quartz.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
index 53c6d5e..c829b5c 100644
--- a/gdk/quartz/gdkglobals-quartz.c
+++ b/gdk/quartz/gdkglobals-quartz.c
@@ -30,9 +30,14 @@ GdkWindow *_gdk_root = NULL;
 GdkOSXVersion
 gdk_quartz_osx_version (void)
 {
-  gint32 minor;
-  OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
-  g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
+  static gint32 minor = 0;
+
+  if (!minor)
+    {
+      OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
+
+      g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
+    }
 
   if (minor < GDK_OSX_MIN)
     return GDK_OSX_UNSUPPORTED;



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