[PATCH 6/15] gnome-settings-daemon: Xrandr version checks



gnome-settings-daemon:  92_gsd-xrandr-version-check.patch

Probably unnecessary, but this adds another check for xrandr 1.2, lifted
from the old Screen Resolution code.


diff -Nur -x '*.orig' -x '*~' gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c gnome-settings-daemon-2.22.1.new/plugins/xrandr/gsd-xrandr-manager.c
--- gnome-settings-daemon-2.22.1/plugins/xrandr/gsd-xrandr-manager.c	2008-04-07 15:02:40.000000000 +0200
+++ gnome-settings-daemon-2.22.1.new/plugins/xrandr/gsd-xrandr-manager.c	2008-04-07 15:05:21.000000000 +0200
@@ -144,8 +144,30 @@
 gsd_xrandr_manager_start (GsdXrandrManager *manager,
                           GError          **error)
 {
+#ifdef HAVE_RANDR
+        RWScreen *rw_screen;
+        int major, minor;
+        int event_base, error_base;
+        GdkDisplay *display;
+        Display    *xdisplay;
+        
         g_debug ("Starting xrandr manager");
 
+        display = gdk_display_get_default ();
+        xdisplay = gdk_x11_display_get_xdisplay (display);
+
+        if (!XRRQueryExtension (xdisplay, &event_base, &error_base) ||
+            XRRQueryVersion (xdisplay, &major, &minor) == 0)
+        {
+                g_warning( _("The X Server does not support the XRandR extension.  Runtime resolution changes to the display size are not available.") );
+                return TRUE;  /* Or should this return FALSE? */
+        }
+        else if (major != 1 || minor < 2)
+        {
+                g_warning( _("The version of the XRandR extension is incompatible with this program. Runtime changes to the display size are not available."));
+                return TRUE;  /* Or should this return FALSE? */
+        }
+
         manager->priv->running = TRUE;
         
         if (manager->priv->keycode) {
@@ -169,7 +191,8 @@
         gdk_add_client_message_filter (gnome_randr_atom(),
                                        on_client_message,
                                        manager->priv->rw_screen);
-        
+
+#endif /* HAVE_RANDR */
         return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]