From 5305ef253f59f99acb64e4bd5c56bfa6b1a3a76d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 12 Nov 2015 14:47:25 -0500 Subject: preview: Don't assume X We need to check at runtime if we are actually running under X, before calling gdk_x11 API. http://bugzilla.gnome.org/show_bug.cgi?id=758026 --- src/nautilus-files-view.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index 683bd51f2..38b180045 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -1141,13 +1141,19 @@ nautilus_files_view_preview_files (NautilusFilesView *view, GArray *locations) { gchar *uri; - guint xid; + guint xid = 0; GtkWidget *toplevel; + GdkWindow *window; uri = nautilus_file_get_uri (files->data); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view)); - xid = gdk_x11_window_get_xid (gtk_widget_get_window (toplevel)); +#ifdef GDK_WINDOWING_X11 + window = gtk_widget_get_window (toplevel); + if (GDK_IS_X11_WINDOW (window)) + xid = gdk_x11_window_get_xid (gtk_widget_get_window (toplevel)); +#endif + nautilus_previewer_call_show_file (uri, xid, TRUE); g_free (uri); -- cgit v1.2.1