[glade] Build: use gtk-mac-integration only when creating bundle



commit ce473462ed65be1cf2d5e5478737461c927b345f
Author: Tom Schoonjans <Tom Schoonjans rfi ac uk>
Date:   Thu May 7 09:07:43 2020 +0100

    Build: use gtk-mac-integration only when creating bundle
    
    Gtk-mac-integration was used only when creating the bundle,
    So there's no need to drag it as a dependency just because the build
    occurs on a macOS with a Gtk installation with Quartz backend.

 configure.ac          | 2 +-
 gladeui/glade-app.c   | 6 +++---
 gladeui/glade-popup.c | 2 +-
 gladeui/meson.build   | 2 +-
 meson.build           | 2 +-
 src/glade-window.c    | 5 -----
 6 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 32d939bd..efa2d3e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -306,7 +306,6 @@ dnl ================================================================
 _gdk_tgt=`$PKG_CONFIG --variable=targets gdk-3.0`
 AM_CONDITIONAL([GDK_TARGET_QUARTZ], [test x$_gdk_tgt = xquartz])
 if test "x$_gdk_tgt" = xquartz; then 
-   PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk3)
 
    GTK_MAC_BUNDLE_FLAG=
 
@@ -315,6 +314,7 @@ if test "x$_gdk_tgt" = xquartz; then
       build_bundle=yes, build_bundle=no)
 
    if test "x$build_bundle" = xyes; then
+      PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk3)
       AC_MSG_NOTICE([enableing mac bundle..])
 
       GTK_MAC_BUNDLE_FLAG=-DMAC_BUNDLE
diff --git a/gladeui/glade-app.c b/gladeui/glade-app.c
index f60b9b8a..f99c09b7 100644
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@ -47,7 +47,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#ifdef MAC_INTEGRATION
+#ifdef MAC_BUNDLE
 #  include <gtkosxapplication.h>
 #endif
 
@@ -166,13 +166,13 @@ build_package_paths (void)
   if (path)
     pixmaps_dir = g_strdup (path);
 
-#if defined (G_OS_WIN32) || (defined (MAC_INTEGRATION) && defined (MAC_BUNDLE))
+#if defined (G_OS_WIN32) || defined (MAC_BUNDLE)
   gchar *prefix;
 
 # ifdef G_OS_WIN32
   prefix = g_win32_get_package_installation_directory_of_module (NULL);
 
-# else // defined (MAC_INTEGRATION) && defined (MAC_BUNDLE)
+# else // defined (MAC_BUNDLE)
   prefix = quartz_application_get_resource_path ();
 
 # endif
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index 04f902c9..28621634 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -671,7 +671,7 @@ glade_popup_is_popup_event (GdkEventButton *event)
 {
   g_return_val_if_fail (event, FALSE);
 
-#ifdef MAC_INTEGRATION
+#ifdef __APPLE__
   return (event->type == GDK_BUTTON_PRESS && event->button == 1 &&
           ((event->state & GDK_MOD1_MASK) != 0));
 #else
diff --git a/gladeui/meson.build b/gladeui/meson.build
index a4cdcb29..484bf389 100644
--- a/gladeui/meson.build
+++ b/gladeui/meson.build
@@ -176,8 +176,8 @@ c_flags = common_flags
 ldflags = []
 
 if enable_mac_integration
-  private_deps += gtk_mac_integration_gtk3_dep
   if get_option('mac_bundle')
+    private_deps += gtk_mac_integration_gtk3_dep
     c_flags += '-DMAC_BUNDLE'
   endif
 endif
diff --git a/meson.build b/meson.build
index 201f16c2..71f3f6d7 100644
--- a/meson.build
+++ b/meson.build
@@ -147,9 +147,9 @@ have_webkit2gtk = webkit2gtk_dep.found()
 # Check for GDK Quartz and MacOSX integration package
 enable_mac_integration = dependency('gdk-3.0').get_pkgconfig_variable('targets').contains('quartz')
 if enable_mac_integration
-  gtk_mac_integration_gtk3_dep = dependency('gtk-mac-integration-gtk3')
 
   if get_option('mac_bundle')
+    gtk_mac_integration_gtk3_dep = dependency('gtk-mac-integration-gtk3')
     gtk_mac_bundle_flags = '-DMAC_BUNDLE'
   endif
 endif
diff --git a/src/glade-window.c b/src/glade-window.c
index 305c0ac8..a2fa889a 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -47,11 +47,6 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
-#ifdef MAC_INTEGRATION
-#  include <gtkosxapplication.h>
-#endif
-
-
 #define ACTION_GROUP_STATIC             "GladeStatic"
 #define ACTION_GROUP_PROJECT            "GladeProject"
 #define ACTION_GROUP_PROJECTS_LIST_MENU "GladeProjectsList"


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