[Xfce4-commits] <xfce4-settings:master> Drop the layout enum, unused/useless

Nick Schermer noreply at xfce.org
Sat Aug 28 23:04:22 CEST 2010


Updating branch refs/heads/master
         to 70c520fc006bcf07a297ff986e46344777f6d879 (commit)
       from eea68a7cb1a5f076bf06802e34983b322100ee48 (commit)

commit 70c520fc006bcf07a297ff986e46344777f6d879
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Tue Jun 15 23:38:26 2010 +0200

    Drop the layout enum, unused/useless
    
    With xrandr 1.2, it's possible to have (e.g.) three outputs: two clones, and
    one that extends the desktop, so a single layout value has little meaning.

 dialogs/display-settings/xfce-randr.c |   32 +++++++---------------------
 dialogs/display-settings/xfce-randr.h |   11 ---------
 xfce4-settings-helper/displays.c      |   37 +++++---------------------------
 3 files changed, 14 insertions(+), 66 deletions(-)

diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index f967855..129c6e4 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -134,9 +134,6 @@ xfce_randr_populate (XfceRandr *randr,
     g_return_val_if_fail (randr != NULL, FALSE);
     g_return_val_if_fail (randr->resources != NULL, FALSE);
 
-    /* set some layout */
-    randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
-
     /* allocate space for the settings */
     randr->mode = g_new0 (RRMode, randr->resources->noutput);
     randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
@@ -358,20 +355,16 @@ xfce_randr_save_device (XfceRandr     *randr,
     gint         n;
     gint         degrees;
 
-    /* find the resolution name and refresh rate (only for primary device */
-    if (randr->layout != XFCE_DISPLAY_LAYOUT_CLONE
-        || (randr->status[output] & XFCE_OUTPUT_STATUS_PRIMARY) != 0)
+    /* find the resolution name and refresh rate */
+    for (n = 0; n < randr->resources->nmode; n++)
     {
-        for (n = 0; n < randr->resources->nmode; n++)
+        if (randr->resources->modes[n].id == randr->mode[output])
         {
-            if (randr->resources->modes[n].id == randr->mode[output])
-            {
-                mode = &randr->resources->modes[n];
-                resolution_name = mode->name;
-                refresh_rate = (gdouble) mode->dotClock / ((gdouble) mode->hTotal * (gdouble) mode->vTotal);
+            mode = &randr->resources->modes[n];
+            resolution_name = mode->name;
+            refresh_rate = (gdouble) mode->dotClock / ((gdouble) mode->hTotal * (gdouble) mode->vTotal);
 
-                break;
-            }
+            break;
         }
     }
 
@@ -459,22 +452,13 @@ xfce_randr_save (XfceRandr     *randr,
                  XfconfChannel *channel)
 {
     gchar        property[512];
-    const gchar *layout_name;
     gint         n, num_outputs = 0;
 
     g_return_if_fail (XFCONF_IS_CHANNEL (channel));
 
-    /* convert the layout into a string */
-    switch (randr->layout)
-    {
-        case XFCE_DISPLAY_LAYOUT_CLONE:  layout_name = "Clone";  break;
-        case XFCE_DISPLAY_LAYOUT_EXTEND: layout_name = "Extend"; break;
-        default:                         layout_name = "Single"; break;
-    }
-
     /* store the layout type */
     g_snprintf (property, sizeof (property), "/%s/Layout", scheme);
-    xfconf_channel_set_string (channel, property, layout_name);
+    xfconf_channel_set_string (channel, property, "Outputs");
 
     /* parse all outputs */
     for (n = 0; n < randr->resources->noutput; n++)
diff --git a/dialogs/display-settings/xfce-randr.h b/dialogs/display-settings/xfce-randr.h
index 1b354b2..1ba6a49 100644
--- a/dialogs/display-settings/xfce-randr.h
+++ b/dialogs/display-settings/xfce-randr.h
@@ -50,16 +50,8 @@
 #ifdef HAS_RANDR_ONE_POINT_TWO
 typedef struct _XfceRandr                XfceRandr;
 typedef struct _XfceOutputPosition       XfceOutputPosition;
-typedef enum   _XfceDisplayLayout        XfceDisplayLayout;
 typedef enum   _XfceOutputStatus         XfceOutputStatus;
 
-enum _XfceDisplayLayout
-{
-    XFCE_DISPLAY_LAYOUT_SINGLE,
-    XFCE_DISPLAY_LAYOUT_CLONE,
-    XFCE_DISPLAY_LAYOUT_EXTEND
-};
-
 enum _XfceOutputStatus
 {
     XFCE_OUTPUT_STATUS_NONE,
@@ -93,9 +85,6 @@ struct _XfceRandr
     /* cache for the output info */
     XRROutputInfo      **output_info;
 
-    /* selected display layout */
-    XfceDisplayLayout    layout;
-
     /* modes common to all enabled outputs */
     RRMode              *clone_modes;
 
diff --git a/xfce4-settings-helper/displays.c b/xfce4-settings-helper/displays.c
index 4b4fbef..563fe1f 100644
--- a/xfce4-settings-helper/displays.c
+++ b/xfce4-settings-helper/displays.c
@@ -75,16 +75,6 @@ struct _XfceDisplaysHelper
 #endif
 };
 
-#ifdef HAS_RANDR_ONE_POINT_TWO
-typedef enum _XfceDisplayLayout XfceDisplayLayout;
-enum _XfceDisplayLayout
-{
-    XFCE_DISPLAY_LAYOUT_SINGLE,
-    XFCE_DISPLAY_LAYOUT_CLONE,
-    XFCE_DISPLAY_LAYOUT_EXTEND
-};
-#endif
-
 
 
 G_DEFINE_TYPE (XfceDisplaysHelper, xfce_displays_helper, G_TYPE_OBJECT);
@@ -651,9 +641,6 @@ xfce_displays_helper_channel_property_changed (XfconfChannel      *channel,
 {
     gchar             *property;
     gchar             *layout_name;
-#ifdef HAS_RANDR_ONE_POINT_TWO
-    XfceDisplayLayout  layout;
-#endif
 
     if (G_UNLIKELY (G_VALUE_HOLDS_STRING(value) && strcmp (property_name, "/Schemes/Apply") == 0))
     {
@@ -664,29 +651,17 @@ xfce_displays_helper_channel_property_changed (XfconfChannel      *channel,
         
         if (G_LIKELY (layout_name))
         {
-            if (strcmp (layout_name, "Screens") == 0)
-            {
-                xfce_displays_helper_channel_apply_legacy (helper, g_value_get_string (value));
-            }
 #ifdef HAS_RANDR_ONE_POINT_TWO
+            if (strcmp (layout_name, "Outputs") == 0)
+                xfce_displays_helper_channel_apply (helper, g_value_get_string (value));
             else
+#endif
             {
-                /* detect the layout */
-                if (strcmp (layout_name, "Single") == 0)
-                    layout = XFCE_DISPLAY_LAYOUT_SINGLE;
-                else if (strcmp (layout_name, "Clone") == 0)
-                    layout = XFCE_DISPLAY_LAYOUT_CLONE;
-                else if (strcmp (layout_name, "Extend") == 0)
-                    layout = XFCE_DISPLAY_LAYOUT_EXTEND;
+                if (strcmp (layout_name, "Screens") == 0)
+                    xfce_displays_helper_channel_apply_legacy (helper, g_value_get_string (value));
                 else
-                    goto unknow_scheme_layout;
-                
-                /* apply the layout */
-                xfce_displays_helper_channel_apply (helper, g_value_get_string (value));
+                    g_warning ("Unknown layout: %s\n", layout_name);
             }
-            
-            unknow_scheme_layout:
-#endif
 
             /* cleanup */
             g_free (layout_name);



More information about the Xfce4-commits mailing list