summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-panel/libegg/eggdesktopfile.c54
-rw-r--r--mate-panel/libegg/eggsmclient-xsmp.c8
2 files changed, 47 insertions, 15 deletions
diff --git a/mate-panel/libegg/eggdesktopfile.c b/mate-panel/libegg/eggdesktopfile.c
index 84e611f7..5e069770 100644
--- a/mate-panel/libegg/eggdesktopfile.c
+++ b/mate-panel/libegg/eggdesktopfile.c
@@ -31,9 +31,12 @@
#include <unistd.h>
#include <glib/gi18n.h>
-#include <gdk/gdkx.h>
#include <gtk/gtk.h>
+#ifdef HAVE_X11
+#include <gdk/gdkx.h>
+#endif
+
struct EggDesktopFile {
GKeyFile *key_file;
char *source;
@@ -909,6 +912,7 @@ parse_link (EggDesktopFile *desktop_file,
return TRUE;
}
+#ifdef HAVE_X11
static char *
start_startup_notification (GdkDisplay *display,
EggDesktopFile *desktop_file,
@@ -922,6 +926,8 @@ start_startup_notification (GdkDisplay *display,
char *description, *wmclass;
char *screen_str, *workspace_str;
+ g_assert(GDK_IS_X11_DISPLAY (display));
+
if (g_key_file_has_key (desktop_file->key_file,
EGG_DESKTOP_FILE_GROUP,
EGG_DESKTOP_FILE_KEY_STARTUP_NOTIFY,
@@ -1019,6 +1025,7 @@ set_startup_notification_timeout (GdkDisplay *display,
g_timeout_add_seconds (EGG_DESKTOP_FILE_SN_TIMEOUT_LENGTH,
startup_notification_timeout, sn_data);
}
+#endif // HAVE_X11
static GPtrArray *
array_putenv (GPtrArray *env, char *variable)
@@ -1072,7 +1079,7 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file,
EggDesktopFileLaunchOption option;
GSList *translated_documents = NULL, *docs = NULL;
char *command, **argv;
- int argc, i, screen_num;
+ int argc, i;
gboolean success, current_success;
GdkDisplay *display;
char *startup_id;
@@ -1184,7 +1191,6 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file,
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
}
- screen_num = gdk_x11_screen_get_screen_number (screen);
translated_documents = translate_document_list (desktop_file, documents);
docs = translated_documents;
@@ -1204,16 +1210,31 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file,
}
g_free (command);
- startup_id = start_startup_notification (display, desktop_file,
- argv[0], screen_num,
- workspace, launch_time);
- if (startup_id)
- {
- char *startup_id_env = g_strdup_printf ("DESKTOP_STARTUP_ID=%s",
- startup_id);
- env = array_putenv (env, startup_id_env);
- g_free (startup_id_env);
- }
+ startup_id = NULL;
+
+#ifdef HAVE_X11
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ int screen_num;
+
+ screen_num = gdk_x11_screen_get_screen_number (screen);
+ startup_id = start_startup_notification (display, desktop_file,
+ argv[0], screen_num,
+ workspace, launch_time);
+
+ if (startup_id)
+ {
+ char *startup_id_env = g_strdup_printf ("DESKTOP_STARTUP_ID=%s",
+ startup_id);
+ env = array_putenv (env, startup_id_env);
+ g_free (startup_id_env);
+ }
+ }
+#else
+ // Suppress unused variable warnings when not compiling with X
+ (void)workspace;
+ (void)launch_time;
+#endif
if (env != NULL)
g_ptr_array_add (env, NULL);
@@ -1233,7 +1254,12 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file,
{
if (current_success)
{
- set_startup_notification_timeout (display, startup_id);
+#ifdef HAVE_X11
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ set_startup_notification_timeout (display, startup_id);
+ }
+#endif
if (ret_startup_id)
*ret_startup_id = startup_id;
diff --git a/mate-panel/libegg/eggsmclient-xsmp.c b/mate-panel/libegg/eggsmclient-xsmp.c
index 2b707a76..98cd85d5 100644
--- a/mate-panel/libegg/eggsmclient-xsmp.c
+++ b/mate-panel/libegg/eggsmclient-xsmp.c
@@ -37,7 +37,10 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
+
+#ifdef HAVE_X11
#include <gdk/gdkx.h>
+#endif
#define EGG_TYPE_SM_CLIENT_XSMP (egg_sm_client_xsmp_get_type ())
#define EGG_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
@@ -368,7 +371,10 @@ sm_client_xsmp_startup (EggSMClient *client,
xsmp->client_id = g_strdup (ret_client_id);
free (ret_client_id);
- gdk_x11_set_sm_client_id (xsmp->client_id);
+#ifdef HAVE_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
+ gdk_x11_set_sm_client_id (xsmp->client_id);
+#endif
g_debug ("Got client ID \"%s\"", xsmp->client_id);
}