diff options
author | Iago Toral Quiroga <itoral@igalia.com> | 2013-05-20 15:07:10 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2013-05-20 18:00:15 +0800 |
commit | d5ddd68f50bafcbdc45870ef7f8f92f57e516587 (patch) | |
tree | e2485a40f016cce91f1079eeb24196661524013a | |
parent | 3e5dd0736a1119f5099bcec7b8323c9fb093d926 (diff) | |
download | gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.tar gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.tar.gz gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.tar.bz2 gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.tar.lz gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.tar.xz gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.tar.zst gsoc2013-epiphany-d5ddd68f50bafcbdc45870ef7f8f92f57e516587.zip |
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
-rw-r--r-- | src/ephy-main.c | 18 |
1 files 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 <errno.h> -#include <gdk/gdkx.h> #include <glib/gi18n.h> #include <gtk/gtk.h> #include <libnotify/notify.h> #include <libxml/xmlversion.h> #include <string.h> +#ifdef GDK_WINDOWING_X11 +#include <gdk/gdkx.h> +#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 (). */ |