[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Support more than two outputs with xrandr >= 1.2

Jérôme Guelfucci noreply at xfce.org
Sat Jun 5 23:56:06 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to 1232aa86a0d09f8588a4a6813c407e183be4bafb (commit)
       from 7abcea5f3654c9ab6751e93c36b3d5528e536888 (commit)

commit 1232aa86a0d09f8588a4a6813c407e183be4bafb
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Sat Jun 5 20:27:02 2010 +0200

    Support more than two outputs with xrandr >= 1.2

 dialogs/display-settings/xfce-randr.c |   38 +++++++++++++++++---------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index ccf666b..43d102b 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -278,6 +278,15 @@ xfce_randr_save_device (XfceRandr     *randr,
     else
         xfconf_channel_reset_property (channel, property, FALSE);
 
+#ifdef HAS_RANDR_ONE_POINT_THREE
+    /* is it the primary output? */
+    g_snprintf (property, sizeof (property), "/%s/%s/Primary", scheme, distinct);
+    if (randr->status[output] == XFCE_OUTPUT_STATUS_PRIMARY)
+        xfconf_channel_set_bool (channel, property, TRUE);
+    else
+        xfconf_channel_reset_property (channel, property, FALSE);
+#endif
+
     /* save the position */
     g_snprintf (property, sizeof (property), "/%s/%s/Position", scheme, distinct);
     if (randr->layout == XFCE_DISPLAY_LAYOUT_EXTEND
@@ -311,7 +320,7 @@ xfce_randr_save (XfceRandr     *randr,
 {
     gchar        property[512];
     const gchar *layout_name;
-    gint         n;
+    gint         n, num_outputs = 0;
 
     g_return_if_fail (XFCONF_IS_CHANNEL (channel));
 
@@ -327,28 +336,21 @@ xfce_randr_save (XfceRandr     *randr,
     g_snprintf (property, sizeof (property), "/%s/Layout", scheme);
     xfconf_channel_set_string (channel, property, layout_name);
 
-    /* find the primary layout */
+    /* parse all outputs */
     for (n = 0; n < randr->resources->noutput; n++)
     {
-        switch (randr->status[n])
+        /* do not save disconnected ones */
+        if (randr->status[n] != XFCE_OUTPUT_STATUS_NONE)
         {
-            /* save the primary device */
-            case XFCE_OUTPUT_STATUS_PRIMARY:
-                xfce_randr_save_device (randr, scheme, channel, n, "Primary");
-                break;
-                
-            /* save the secondary device */
-            case XFCE_OUTPUT_STATUS_SECONDARY:
-                if (randr->mode != XFCE_DISPLAY_LAYOUT_SINGLE)
-                    xfce_randr_save_device (randr, scheme, channel, n, "Secondary");
-                break;
-            
-            /* ignore */
-            case XFCE_OUTPUT_STATUS_NONE:
-                break;
+            g_snprintf (property, sizeof (property), "Output%d", num_outputs++);
+            xfce_randr_save_device (randr, scheme, channel, n, property);
         }
     }
-    
+
+    /* store the number of outputs saved */
+    g_snprintf (property, sizeof (property), "/%s/NumOutputs", scheme);
+    xfconf_channel_set_int (channel, property, num_outputs);
+
     /* tell the helper to apply this theme */
     xfconf_channel_set_string (channel, "/Schemes/Apply", scheme);
 }



More information about the Xfce4-commits mailing list