]> spindle.queued.net Git - midori/commitdiff
Enclose screen saver and root window in IS_X11_DISPLAY
authorChristian Dywan <christian@twotoasts.de>
Tue, 18 Sep 2012 19:29:38 +0000 (21:29 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 18 Sep 2012 19:29:38 +0000 (21:29 +0200)
If building with a Wayland-enabled GTK+3 the GdkDisplay
can be something other than GdkX11Display at runtime.

Fixes: https://bugs.launchpad.net/midori/+bug/975355
katze/gtk3-compat.h
midori/main.c
midori/sokoke.c

index 12981b1a49fb62f96aacf11a0ab381984e6bc8d7..a8450af23f427e2ab595f6d6ba752e8ff8a0a975 100644 (file)
@@ -116,6 +116,10 @@ G_BEGIN_DECLS
     #define GDK_KEY_Return GDK_Return
 #endif
 
+#ifndef GDK_IS_X11_DISPLAY
+    #define GDK_IS_X11_DISPLAY(display) TRUE
+#endif
+
 G_END_DECLS
 
 #endif
index d2104d70e3f5e47244d5b22eb541eebf3fd7f6c1..2d3af37a4ddf01afc3f3efffb1e765659767162b 100644 (file)
@@ -1599,9 +1599,16 @@ midori_inactivity_timeout (gpointer data)
     if (has_extension == -1)
     {
         GdkDisplay* display = gtk_widget_get_display (GTK_WIDGET (mit->browser));
-        xdisplay = GDK_DISPLAY_XDISPLAY (display);
-        has_extension = XScreenSaverQueryExtension (xdisplay,
-                                                    &event_base, &error_base);
+        if (GDK_IS_X11_DISPLAY (display))
+        {
+            xdisplay = GDK_DISPLAY_XDISPLAY (display);
+            has_extension = XScreenSaverQueryExtension (xdisplay,
+                                                        &event_base, &error_base);
+        }
+        else
+        {
+            has_extension = 0;
+        }
     }
 
     if (has_extension)
index 8efc18483dfc4f6303eac5575b5e98a03c3106d2..a303bfbf486ccd5110a407f77f9975354708d4d3 100644 (file)
@@ -688,26 +688,29 @@ sokoke_get_desktop (void)
         }
         else
         {
-        /* Are we running in Xfce <= 4.6? */
-        GdkDisplay* display = gdk_display_get_default ();
-        Display* xdisplay = GDK_DISPLAY_XDISPLAY (display);
-        Window root_window = RootWindow (xdisplay, 0);
-        Atom save_mode_atom = gdk_x11_get_xatom_by_name_for_display (
-            display, "_DT_SAVE_MODE");
-        Atom actual_type;
-        int actual_format;
-        unsigned long n_items, bytes;
-        gchar* value;
-        int status = XGetWindowProperty (xdisplay, root_window,
-            save_mode_atom, 0, (~0L),
-            False, AnyPropertyType, &actual_type, &actual_format,
-            &n_items, &bytes, (unsigned char**)&value);
-        if (status == Success)
-        {
-            if (n_items == 6 && !strncmp (value, "xfce4", 6))
-                desktop = SOKOKE_DESKTOP_XFCE;
-            XFree (value);
-        }
+            /* Are we running in Xfce <= 4.6? */
+            GdkDisplay* display = gdk_display_get_default ();
+            if (GDK_IS_X11_DISPLAY (display))
+            {
+                Display* xdisplay = GDK_DISPLAY_XDISPLAY (display);
+                Window root_window = RootWindow (xdisplay, 0);
+                Atom save_mode_atom = gdk_x11_get_xatom_by_name_for_display (
+                    display, "_DT_SAVE_MODE");
+                Atom actual_type;
+                int actual_format;
+                unsigned long n_items, bytes;
+                gchar* value;
+                int status = XGetWindowProperty (xdisplay, root_window,
+                    save_mode_atom, 0, (~0L),
+                    False, AnyPropertyType, &actual_type, &actual_format,
+                    &n_items, &bytes, (unsigned char**)&value);
+                if (status == Success)
+                {
+                    if (n_items == 6 && !strncmp (value, "xfce4", 6))
+                        desktop = SOKOKE_DESKTOP_XFCE;
+                    XFree (value);
+                }
+            }
         }
     }