[gtk-osx] Two Gtk fixes for macOS 11 and 12.



commit 343a9e0fb4966a82aa73e6fdf2ce296ff42812a7
Author: John Ralls <jralls ceridwen us>
Date:   Fri Sep 24 10:38:47 2021 -0700

    Two Gtk fixes for macOS 11 and 12.

 modulesets-stable/gtk-osx-python.modules           |  1 +
 modulesets-stable/gtk-osx.modules                  |  5 +-
 .../Quartz-version-detection-for-macOS-12.patch    | 67 ++++++++++++++++++++++
 ...ac-integration-work-around-svg-locale-bug.patch | 33 +++++++++++
 4 files changed, 104 insertions(+), 2 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx-python.modules b/modulesets-stable/gtk-osx-python.modules
index dddc85fe..c795d31a 100644
--- a/modulesets-stable/gtk-osx-python.modules
+++ b/modulesets-stable/gtk-osx-python.modules
@@ -137,6 +137,7 @@
     <branch module="gtk-mac-integration/3.0/gtk-mac-integration-3.0.1.tar.xz"
             version="3.0.1"
             hash="sha256:f19e35bc4534963127bbe629b9b3ccb9677ef012fc7f8e97fd5e890873ceb22d">
+      <patch file="gtk-mac-integration-work-around-svg-locale-bug.patch" strip="1"/>
     </branch>
     <dependencies>
     </dependencies>
diff --git a/modulesets-stable/gtk-osx.modules b/modulesets-stable/gtk-osx.modules
index 5bac1ad7..d5b678ba 100644
--- a/modulesets-stable/gtk-osx.modules
+++ b/modulesets-stable/gtk-osx.modules
@@ -298,6 +298,7 @@
              mesonargs="-Dquartz-backend=true -Dx11-backend=false -Dmedia=none">
     <branch module="gtk+/3.24/gtk+-3.24.30.tar.xz" version="3.24.30"
             hash="sha256:ba75bfff320ad1f4cfbee92ba813ec336322cc3c660d406aad014b07087a3ba9">
+      <patch file="Quartz-version-detection-for-macOS-12.patch" strip="1"/>
     </branch>
     <dependencies>
       <dep package="glib"/>
@@ -348,8 +349,8 @@
              autogenargs="--disable-python">
     <branch module="gtk-mac-integration/3.0/gtk-mac-integration-3.0.1.tar.xz"
             version="3.0.1"
-            hash="sha256:f19e35bc4534963127bbe629b9b3ccb9677ef012fc7f8e97fd5e890873ceb22d"
-            >
+            hash="sha256:f19e35bc4534963127bbe629b9b3ccb9677ef012fc7f8e97fd5e890873ceb22d">
+      <patch file="gtk-mac-integration-work-around-svg-locale-bug.patch" strip="1"/>
     </branch>
     <dependencies>
     </dependencies>
diff --git a/patches/Quartz-version-detection-for-macOS-12.patch 
b/patches/Quartz-version-detection-for-macOS-12.patch
new file mode 100644
index 00000000..69c75869
--- /dev/null
+++ b/patches/Quartz-version-detection-for-macOS-12.patch
@@ -0,0 +1,67 @@
+From a752e338381bc37dbe8d4c04ec23e4f6fd911b30 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls ceridwen us>
+Date: Wed, 8 Sep 2021 18:01:50 -0700
+Subject: [PATCH] Update Quartz version detection for macOS 12.
+
+---
+ gdk/quartz/gdkglobals-quartz.c | 16 +++++++---------
+ gdk/quartz/gdkquartz.h         |  3 ++-
+ 2 files changed, 9 insertions(+), 10 deletions(-)
+
+diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c
+index 72aed1c92d..30649efe8a 100644
+--- a/gdk/quartz/gdkglobals-quartz.c
++++ b/gdk/quartz/gdkglobals-quartz.c
+@@ -29,28 +29,26 @@ GdkWindow *_gdk_root = NULL;
+ GdkOSXVersion
+ gdk_quartz_osx_version (void)
+ {
+-  static gint32 minor = GDK_OSX_UNSUPPORTED;
++  static gint32 vkey = GDK_OSX_UNSUPPORTED;
+ 
+-  if (minor == GDK_OSX_UNSUPPORTED)
++  if (vkey == GDK_OSX_UNSUPPORTED)
+     {
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
+-      OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
++      OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&vkey);
+ 
+       g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
+ #else
+       NSOperatingSystemVersion version;
+ 
+       version = [[NSProcessInfo processInfo] operatingSystemVersion];
+-      minor = version.minorVersion;
+-      if (version.majorVersion == 11)
+-        minor += 16;
++      vkey = version.majorVersion == 10 ? version.minorVersion : version.majorVersion + 5;
+ #endif
+     }
+ 
+-  if (minor < GDK_OSX_MIN)
++  if (vkey < GDK_OSX_MIN)
+     return GDK_OSX_UNSUPPORTED;
+-  else if (minor > GDK_OSX_CURRENT)
++  else if (vkey > GDK_OSX_CURRENT)
+     return GDK_OSX_NEW;
+   else
+-    return minor;
++    return vkey;
+ }
+diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
+index dd1b4f41af..2d53dcbce6 100644
+--- a/gdk/quartz/gdkquartz.h
++++ b/gdk/quartz/gdkquartz.h
+@@ -42,7 +42,8 @@ typedef enum
+   GDK_OSX_MOJAVE = 14,
+   GDK_OSX_CATALINA = 15,
+   GDK_OSX_BIGSUR = 16,
+-  GDK_OSX_CURRENT = 15,
++  GDK_OSX_MONTEREY = 17,
++  GDK_OSX_CURRENT = 17,
+   GDK_OSX_NEW = 99
+ } GdkOSXVersion;
+ 
+-- 
+2.30.1 (Apple Git-130)
+
diff --git a/patches/gtk-mac-integration-work-around-svg-locale-bug.patch 
b/patches/gtk-mac-integration-work-around-svg-locale-bug.patch
new file mode 100644
index 00000000..9f0be23f
--- /dev/null
+++ b/patches/gtk-mac-integration-work-around-svg-locale-bug.patch
@@ -0,0 +1,33 @@
+From 9774a706d1d89abaaf3dfbd9522b28934cc29138 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls ceridwen us>
+Date: Sat, 18 Sep 2021 13:11:02 -0700
+Subject: [PATCH] Set C locale when creating a menu item.
+
+Works around macOS bug described in https://gitlab.gnome.org/GNOME/gtk-mac-integration/-/issues/14.
+---
+ src/GNSMenuItem.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/GNSMenuItem.c b/src/GNSMenuItem.c
+index 48ec0d1..81d2547 100644
+--- a/src/GNSMenuItem.c
++++ b/src/GNSMenuItem.c
+@@ -44,6 +44,7 @@ idle_call_activate (ClosureData *action)
+ 
+   /* All menu items have the action "activate", which will be handled by this child class
+    */
++  const char* locale = setlocale(LC_NUMERIC, "C");
+   self = [ super initWithTitle: title action: @selector (activate: ) keyEquivalent: @"" ];
+ 
+   if (self)
+@@ -58,6 +59,7 @@ idle_call_activate (ClosureData *action)
+       notUsed = NO;
+       g_weak_ref_set (&menuItem, GTK_MENU_ITEM (gtkmenuitem));
+     }
++  setlocale(LC_NUMERIC, locale);
+   return self;
+ }
+ 
+-- 
+2.30.1 (Apple Git-130)
+


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