[gnote/gnome-3-18] Fix crash when running with X11 support under Wayland
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote/gnome-3-18] Fix crash when running with X11 support under Wayland
- Date: Sat, 28 Nov 2015 16:16:55 +0000 (UTC)
commit 532195db8e984239e0898d451eccceb0e3c4dc8c
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 9 14:48:56 2015 +0100
Fix crash when running with X11 support under Wayland
https://bugzilla.gnome.org/show_bug.cgi?id=757632
libtomboy/tomboyutil.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libtomboy/tomboyutil.c b/libtomboy/tomboyutil.c
index 661cb9f..68cd076 100644
--- a/libtomboy/tomboyutil.c
+++ b/libtomboy/tomboyutil.c
@@ -41,6 +41,7 @@
# define TRACE(x) do {} while (FALSE);
#endif
+#ifdef GDK_WINDOWING_X11
gint
tomboy_window_get_workspace (GtkWindow *window)
{
@@ -71,6 +72,7 @@ tomboy_window_get_workspace (GtkWindow *window)
void
tomboy_window_move_to_current_workspace (GtkWindow *window)
{
+ GdkDisplay *display;
GdkWindow *gdkwin = gtk_widget_get_window(GTK_WIDGET (window));
GdkWindow *rootwin =
gdk_screen_get_root_window (gdk_window_get_screen (gdkwin));
@@ -84,6 +86,10 @@ tomboy_window_move_to_current_workspace (GtkWindow *window)
int workspace;
XEvent xev;
+ display = gdk_display_get_default ();
+ if (!GDK_IS_X11_DISPLAY (display))
+ return;
+
if (!gdk_property_get (rootwin,
current_desktop,
_GDK_MAKE_ATOM (XA_CARDINAL),
@@ -124,7 +130,14 @@ tomboy_window_move_to_current_workspace (GtkWindow *window)
static void
tomboy_window_override_user_time (GtkWindow *window)
{
- guint32 ev_time = gtk_get_current_event_time();
+ GdkDisplay *display;
+ guint32 ev_time;
+
+ display = gdk_display_get_default ();
+ if (!GDK_IS_X11_DISPLAY (display))
+ return;
+
+ ev_time= gtk_get_current_event_time();
if (ev_time == 0) {
/*
@@ -150,16 +163,19 @@ tomboy_window_override_user_time (GtkWindow *window)
TRACE (g_print("Setting _NET_WM_USER_TIME to: %d\n", ev_time));
gdk_x11_window_set_user_time (gtk_widget_get_window(GTK_WIDGET(window)), ev_time);
}
+#endif /* GDK_WINDOWING_X11 */
void
tomboy_window_present_hardcore (GtkWindow *window)
{
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
gtk_widget_realize (GTK_WIDGET (window));
+#ifdef GDK_WINDOWING_X11
else if (gtk_widget_get_visible (GTK_WIDGET (window)))
tomboy_window_move_to_current_workspace (window);
tomboy_window_override_user_time (window);
+#endif /* GDK_WINDOWING_X11 */
gtk_window_present (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]