From 57410e2dffde5271443809a0dbd0280be262ba47 Mon Sep 17 00:00:00 2001
From: Alexander Schwinn <alexxcons@xfce.org>
Date: Fri, 20 Nov 2020 23:31:57 +0100
Subject: [PATCH] No startup notification in wayland to prevent crash (Issue
 #17)

Additional guard required to dont trigger the code without wayland
support
---
 libxfce4ui/xfce-spawn.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libxfce4ui/xfce-spawn.c b/libxfce4ui/xfce-spawn.c
index 1280ca02..cb5deb01 100644
--- a/libxfce4ui/xfce-spawn.c
+++ b/libxfce4ui/xfce-spawn.c
@@ -52,6 +52,10 @@
 #undef HAVE_LIBSTARTUP_NOTIFICATION
 #endif
 
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+
 #ifdef HAVE_LIBSTARTUP_NOTIFICATION
 #include <libsn/sn.h>
 #endif
@@ -307,11 +311,14 @@ xfce_spawn_process (GdkScreen    *screen,
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
 #ifdef GDK_WINDOWING_WAYLAND
-  if (startup_notify == TRUE)
+  if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
     {
-      /* 'sn_display_new' crashes when used via wayland, so no startup notification support here */
-      g_warning ("startup notification not supported for wayland sessions");
-      startup_notify = FALSE;
+      if (startup_notify == TRUE)
+        {
+          /* 'sn_display_new' crashes when used via wayland, so no startup notification support here */
+          g_warning ("startup notification not supported for wayland sessions");
+          startup_notify = FALSE;
+        }
     }
 #endif
 
-- 
GitLab