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 | |
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
-rw-r--r-- | libyelp/yelp-view.c | 6 | ||||
-rw-r--r-- | src/yelp-application.c | 29 |
2 files changed, 24 insertions, 11 deletions
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c index f27dd2e8..1ec960a9 100644 --- a/libyelp/yelp-view.c +++ b/libyelp/yelp-view.c @@ -26,7 +26,9 @@ #include <glib-object.h> #include <gio/gio.h> #include <gtk/gtk.h> +#ifdef GDK_WINDOWING_X11 #include <gdk/gdkx.h> +#endif #include <webkit/webkit.h> #include "yelp-debug.h" @@ -785,8 +787,10 @@ view_install_uri (YelpView *view, gtkwin = gtk_widget_get_toplevel (GTK_WIDGET (view)); if (gtkwin != NULL && gtk_widget_is_toplevel (gtkwin)) { gdkwin = gtk_widget_get_window (gtkwin); - if (gdkwin != NULL) +#ifdef GDK_WINDOWING_X11 + if (gdkwin != NULL && GDK_IS_X11_WINDOW (gdkwin)) xid = gdk_x11_window_get_xid (gdkwin); +#endif } if (priv->state == YELP_VIEW_STATE_ERROR) 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); |