From 2315f45eea7b31df8daf767032540ed64382f58d Mon Sep 17 00:00:00 2001 From: slamet kristanto Date: Sun, 17 May 2020 12:18:09 +0900 Subject: [PATCH] enable dock integration --- meson.build | 3 ++- zathura/main.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 5aa78a1..8167691 100644 --- a/meson.build +++ b/meson.build @@ -44,8 +44,9 @@ 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] +build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo, gtk_mac_integration] # defines defines = [ diff --git a/zathura/main.c b/zathura/main.c index 024d3a9..bcb4e1c 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: Zlib */ +#include #include #include @@ -19,6 +20,23 @@ #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) @@ -300,6 +318,25 @@ main(int argc, char* argv[]) synctex_fwd); } +#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 (); + if (id != NULL) + { + g_print ("TestIntegration Error! Bundle Has ID %s\n", id); + } + } /* run zathura */ gtk_main();