summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-01-26 12:44:18 +0100
committerJan Tojnar <jtojnar@gmail.com>2020-05-16 11:57:46 +0200
commitfeb20b877d82db6ec79e96fd3a3cc81e3c4365fa (patch)
treef8d37b59afb31bb53ec83b746cd900ff7152ad34
parentf4d3d8e27c87b7979699f8bd71e044f4bd98703e (diff)
downloadgtk+-wip/jtojnar/gdk4-x11-darwin.tar.gz
osx: Fix building gdk-x11wip/jtojnar/gdk4-x11-darwin
Glib linked against Apple libraries does not provide <gio/gdesktopappinfo.h> header. When building X11 GTK backend on MacOS against such Glib, it fails because it cannot find the header. X11 backend is still required by programs like vim or Emacs. Let’s use the same trick gtk-launch.c uses to solve this issue. https://github.com/NixOS/nixpkgs/issues/54424
-rw-r--r--gdk/x11/gdkapplaunchcontext-x11.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdk/x11/gdkapplaunchcontext-x11.c b/gdk/x11/gdkapplaunchcontext-x11.c
index adc11bf4ec..0828aa7438 100644
--- a/gdk/x11/gdkapplaunchcontext-x11.c
+++ b/gdk/x11/gdkapplaunchcontext-x11.c
@@ -27,7 +27,9 @@
#include "gdkdisplay-x11.h"
#include <glib.h>
+#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
#include <gio/gdesktopappinfo.h>
+#endif
#include <string.h>
#include <unistd.h>
@@ -349,10 +351,16 @@ gdk_x11_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
else
workspace_str = NULL;
+#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
if (G_IS_DESKTOP_APP_INFO (info))
application_id = g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info));
else
application_id = NULL;
+#else
+ /* GDesktopAppInfo files are not available with Cocoa
+ * and startup-notification-spec only cares about desktop files. */
+ application_id = NULL;
+#endif
startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
g_get_prgname (),