From 38ac9bd4d1fd69d80440e1b3a779cbec7fc91595 Mon Sep 17 00:00:00 2001 From: slamet kristanto Date: Tue, 5 Jan 2021 17:31:48 +0900 Subject: [PATCH] Fix meson dependency for MacOSX --- meson.build | 18 ++++++++++++++++-- zathura/main.c | 27 ++------------------------- zathura/os-dependency.h.in | 8 ++++++++ 3 files changed, 26 insertions(+), 27 deletions(-) create mode 100644 zathura/os-dependency.h.in diff --git a/meson.build b/meson.build index 8167691..61aff68 100644 --- a/meson.build +++ b/meson.build @@ -44,9 +44,15 @@ gthread = dependency('gthread-2.0', version: '>=2.50') gmodule = dependency('gmodule-no-export-2.0', version: '>=2.50') gtk3 = dependency('gtk+-3.0', version: '>=3.22') cairo = dependency('cairo') -gtk_mac_integration = dependency('gtk-mac-integration-gtk3') -build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo, gtk_mac_integration] +build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo] + +if host_machine.system() == 'darwin' + gtk_mac_integration = dependency('gtk-mac-integration-gtk3') + build_dependencies += gtk_mac_integration + conf_data.set('GTKOSXAPPLICATION', true) +endif + # defines defines = [ @@ -105,6 +111,13 @@ version_header = configure_file( output: 'zathura-version.h', configuration: conf_data ) + +os_dependency_header = configure_file( + input: 'zathura/os-dependency.h.in', + output: 'zathura-os-dependency.h', + configuration: conf_data +) + include_directories = [ include_directories('.') ] @@ -157,6 +170,7 @@ headers = files( 'zathura/types.h', ) headers += version_header +headers += os_dependency_header # zathura helper library libzathura = static_library('zathura', diff --git a/zathura/main.c b/zathura/main.c index bcb4e1c..9095e22 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Zlib */ -#include +#include "zathura-os-dependency.h" #include #include @@ -20,23 +20,6 @@ #include "synctex.h" #endif -/* Uncomment ONE of these to test menu-mangling: */ -//#define GTKMACINTEGRATION -#define GTKOSXAPPLICATION - -/* These others are optional */ -#define GTK_DISABLE_DEPRECATION_WARNINGS 1 -#define BUILT_UI //The built UI uses deprecated functions -//#define QUARTZ_HANDLERS - -/* GTKMACINTEGRATION uses Carbon, which isn't available for 64-bit builds. */ -#ifdef __x86_64__ -#undef GTKMACINTEGRATION -# ifndef GTKOSXAPPLICATION -#define GTKOSXAPPLICATION -# endif -#endif //__x86_64__ - /* Init locale */ static void init_locale(void) @@ -320,15 +303,8 @@ main(int argc, char* argv[]) #ifdef GTKOSXAPPLICATION GtkosxApplication *zathuraApp; -#endif //GTKOSXAPPLICATION zathuraApp = g_object_new (GTKOSX_TYPE_APPLICATION, NULL); - { - gboolean falseval = FALSE; - gboolean trueval = TRUE; - } -# ifndef QUARTZ_HANDLERS gtkosx_application_set_use_quartz_accelerators (zathuraApp, FALSE); -# endif //QUARTZ_HANDLERS gtkosx_application_ready (zathuraApp); { const gchar *id = gtkosx_application_get_bundle_id (); @@ -337,6 +313,7 @@ main(int argc, char* argv[]) g_print ("TestIntegration Error! Bundle Has ID %s\n", id); } } +#endif //GTKOSXAPPLICATION /* run zathura */ gtk_main(); diff --git a/zathura/os-dependency.h.in b/zathura/os-dependency.h.in new file mode 100644 index 0000000..2a71da4 --- /dev/null +++ b/zathura/os-dependency.h.in @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: Zlib */ + +#mesondefine GTKOSXAPPLICATION + +#ifdef GTKOSXAPPLICATION +#include +#endif +