diff options
author | Armin K <krejzi@email.com> | 2013-09-16 20:25:29 +0200 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2014-04-28 14:41:30 -0400 |
commit | 81c4eead48192e41384e6096f122524c7e0e695e (patch) | |
tree | 0abceedcbf0232bc466501c25dc6490dae960589 /src | |
parent | 8fafde0c0849a5676743811a3baa893150346e4c (diff) | |
download | yelp-81c4eead48192e41384e6096f122524c7e0e695e.tar.gz |
yelp: check if running on X11 before running gdk_x11_* code
https://bugzilla.gnome.org/show_bug.cgi?id=708181
Diffstat (limited to 'src')
-rw-r--r-- | src/yelp-application.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/yelp-application.c b/src/yelp-application.c index 2ac1f998..6f125ba5 100644 --- a/src/yelp-application.c +++ b/src/yelp-application.c @@ -28,7 +28,9 @@ #include <gio/gsettingsbackend.h> #include <glib/gi18n.h> #include <gtk/gtk.h> +#ifdef GDK_WINDOWING_X11 #include <gdk/gdkx.h> +#endif #include <stdlib.h> #include "yelp-bookmarks.h" @@ -467,18 +469,25 @@ application_uri_resolved (YelpUri *uri, /* Metacity no longer does anything useful with gtk_window_present */ gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); - if (gdk_window) - gdk_x11_window_move_to_current_desktop (gdk_window); - /* Ensure we actually present the window when invoked from the command - * line. This is somewhat evil, but the minor evil of Yelp stealing - * focus (after you requested it) is outweighed for me by the major - * evil of no help window appearing when you click Help. - */ - if (data->timestamp == 0) - data->timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window))); +#ifdef GDK_WINDOWING_X11 + if (GDK_IS_X11_WINDOW (gdk_window)){ + if (gdk_window) + gdk_x11_window_move_to_current_desktop (gdk_window); + + /* Ensure we actually present the window when invoked from the command + * line. This is somewhat evil, but the minor evil of Yelp stealing + * focus (after you requested it) is outweighed for me by the major + * evil of no help window appearing when you click Help. + */ + if (data->timestamp == 0) + data->timestamp = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window))); - gtk_window_present_with_time (GTK_WINDOW (window), data->timestamp); + gtk_window_present_with_time (GTK_WINDOW (window), data->timestamp); + } + else +#endif + gtk_window_present (GTK_WINDOW (window)); g_object_unref (uri); g_free (data); |