[Xfce4-commits] r29337 - xfce4-settings/trunk/xfce4-settings-helper
Nick Schermer
nick at xfce.org
Sun Jan 25 12:03:57 CET 2009
Author: nick
Date: 2009-01-25 11:03:57 +0000 (Sun, 25 Jan 2009)
New Revision: 29337
Modified:
xfce4-settings/trunk/xfce4-settings-helper/displays.c
Log:
Check for the RANDR extension when starting the display
module and print some (untranslated) warnings to the
console if the display settings won't be applied because
of a missing/old randr extension.
Modified: xfce4-settings/trunk/xfce4-settings-helper/displays.c
===================================================================
--- xfce4-settings/trunk/xfce4-settings-helper/displays.c 2009-01-25 08:10:20 UTC (rev 29336)
+++ xfce4-settings/trunk/xfce4-settings-helper/displays.c 2009-01-25 11:03:57 UTC (rev 29337)
@@ -96,11 +96,35 @@
static void
xfce_displays_helper_init (XfceDisplaysHelper *helper)
{
- /* open the channel */
- helper->channel = xfconf_channel_new ("displays");
-
- /* monitor channel changes */
- g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_displays_helper_channel_property_changed), helper);
+ gint major = 0, minor = 0;
+ gint event_base, error_base;
+
+ /* check if the randr extension is running */
+ if (XRRQueryExtension (GDK_DISPLAY (), &event_base, &error_base))
+ {
+ /* query the version */
+ if (XRRQueryVersion (GDK_DISPLAY (), &major, &minor)
+ && major == 1 && minor >= 1)
+ {
+ /* open the channel */
+ helper->channel = xfconf_channel_new ("displays");
+
+ /* monitor channel changes */
+ g_signal_connect (G_OBJECT (helper->channel), "property-changed",
+ G_CALLBACK (xfce_displays_helper_channel_property_changed), helper);
+ }
+ else
+ {
+ g_critical ("RANDR extension is too old, version %d.%d. "
+ "Display settings won't be applied.",
+ major, minor);
+ }
+ }
+ else
+ {
+ g_critical ("No RANDR extension found in display %s. Display settings won't be applied.",
+ gdk_display_get_name (gdk_display_get_default ()));
+ }
}
More information about the Xfce4-commits
mailing list