From d5ddd68f50bafcbdc45870ef7f8f92f57e516587 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 20 May 2013 09:07:10 +0200 Subject: Make sure we only rely on X11 to obtain timestamps when we are running in a X session This avoids a startup crash when running on Wayland. https://bugzilla.gnome.org/show_bug.cgi?id=700691 --- src/ephy-main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ephy-main.c b/src/ephy-main.c index 665739bc3..38b0c8a5f 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -34,13 +34,16 @@ #include "ephy-web-app-utils.h" #include -#include #include #include #include #include #include +#ifdef GDK_WINDOWING_X11 +#include +#endif + static gboolean open_in_new_tab = FALSE; static gboolean open_in_new_window = FALSE; @@ -128,6 +131,7 @@ get_startup_id (void) return retval; } +#ifdef GDK_WINDOWING_X11 /* Copied from libnautilus/nautilus-program-choosing.c; Needed in case * we have no DESKTOP_STARTUP_ID (with its accompanying timestamp). */ @@ -178,6 +182,7 @@ slowly_and_stupidly_obtain_timestamp (Display *xdisplay) return event.xproperty.time; } +#endif static void show_error_message (GError **error) @@ -398,9 +403,16 @@ main (int argc, arguments = args; } +#ifdef GDK_WINDOWING_X11 /* Get a timestamp manually if need be */ - if (user_time == 0) - user_time = slowly_and_stupidly_obtain_timestamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); + if (user_time == 0) { + GdkDisplay* display = + gdk_display_manager_get_default_display (gdk_display_manager_get ()); + if (GDK_IS_X11_DISPLAY (display)) + user_time = + slowly_and_stupidly_obtain_timestamp (GDK_DISPLAY_XDISPLAY (display)); + } +#endif /* Delete the requested web application, if any. Must happen after * ephy_file_helpers_init (). */ -- cgit v1.2.3