[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Revert "Initial work of Lionel Le Folgoc."

Jérôme Guelfucci noreply at xfce.org
Thu May 27 17:38:02 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to e175ddd17579aa37c89460fe7209a1e62cb051db (commit)
       from e82ee0d6dfddbbc835f353d44180a8a8e17115aa (commit)

commit e175ddd17579aa37c89460fe7209a1e62cb051db
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Thu May 27 17:33:09 2010 +0200

    Revert "Initial work of Lionel Le Folgoc."
    
    This reverts commit e82ee0d6dfddbbc835f353d44180a8a8e17115aa.

 dialogs/display-settings/main.c       |   51 ++++++++-------------
 dialogs/display-settings/xfce-randr.c |   78 ++++----------------------------
 dialogs/display-settings/xfce-randr.h |    7 ---
 3 files changed, 30 insertions(+), 106 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 861e335..5ff49fb 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -43,6 +43,9 @@
 #include "xfce-randr-legacy.h"
 #include "display-dialog_ui.h"
 
+/* not available yet */
+#undef HAS_RANDR_ONE_POINT_TWO
+
 enum
 {
     COLUMN_OUTPUT_NAME,
@@ -149,9 +152,7 @@ display_setting_rotations_populate (GtkBuilder *builder)
 #ifdef HAS_RANDR_ONE_POINT_TWO
     if (xfce_randr)
     {
-        /* load only supported rotations */
-        rotations = XFCE_RANDR_ROTATIONS (xfce_randr);
-        active_rotation = XFCE_RANDR_ROTATION (xfce_randr);
+        rotations = active_rotation = RR_Rotate_0;
     }
     else
 #endif
@@ -173,13 +174,8 @@ display_setting_rotations_populate (GtkBuilder *builder)
                                 COLUMN_COMBO_VALUE, rotation_names[n].rotation, -1);
 
             /* select active rotation */
-#ifdef HAS_RANDR_ONE_POINT_TWO
-            if (xfce_randr && XFCE_RANDR_MODE (xfce_randr) != None)
-#endif
-            {
-                if (rotation_names[n].rotation == active_rotation)
-                    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-            }
+            if (rotation_names[n].rotation == active_rotation)
+                gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
         }
     }
 }
@@ -195,7 +191,7 @@ display_setting_refresh_rates_changed (GtkComboBox *combobox,
     if (!display_setting_combo_box_get_value (combobox, &value))
         return;
 
-    /* set new rate */
+    /* set new rotation */
 #ifdef HAS_RANDR_ONE_POINT_TWO
     if (xfce_randr)
         XFCE_RANDR_MODE (xfce_randr) = value;
@@ -234,7 +230,7 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
     /* get the selected resolution mode */
     rescombo = gtk_builder_get_object (builder, "randr-resolution");
     if (!display_setting_combo_box_get_value (GTK_COMBO_BOX (rescombo), (gint *) &active_mode))
-        active_mode = None;
+        active_mode = 0;
 
     if (xfce_randr)
     {
@@ -258,7 +254,7 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
                     rate = (gfloat) mode_info->dotClock / ((gfloat) mode_info->hTotal * (gfloat) mode_info->vTotal);
 
                     /* insert in the combo box */
-                    name = g_strdup_printf (_("%.1f Hz"), rate);
+                    name = g_strdup_printf (_("%d Hz"), (gint) rate);
                     gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
                     gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                                         COLUMN_COMBO_NAME, name,
@@ -270,6 +266,10 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
                         gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
                 }
 
+                /* select the first item if there is no active */
+                if (gtk_combo_box_get_active (GTK_COMBO_BOX (combobox)) == -1)
+                    gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
+
                 /* finished */
                 break;
             }
@@ -321,12 +321,6 @@ display_setting_resolutions_changed (GtkComboBox *combobox,
         return;
 
     /* set new rotation */
-#ifdef HAS_RANDR_ONE_POINT_TWO
-    if (xfce_randr)
-        XFCE_RANDR_MODE (xfce_randr) = value;
-    else
-#endif
-    /* set new rotation */
     if (xfce_randr_legacy)
         XFCE_RANDR_LEGACY_RESOLUTION (xfce_randr_legacy) = value;
 
@@ -358,16 +352,15 @@ display_setting_resolutions_populate (GtkBuilder *builder)
 #ifdef HAS_RANDR_ONE_POINT_TWO
     if (xfce_randr)
     {
-        /* walk all supported modes */
-        for (m = 0; m < XFCE_RANDR_OUTPUT_INFO (xfce_randr)->nmode; ++m)
+        /* walk all the modes */
+        for (n = 0; n < xfce_randr->resources->nmode; n++)
         {
-            /* walk all the modes */
-            for (n = 0; n < xfce_randr->resources->nmode; ++n)
-            {
-                /* get the mode */
-                mode = &xfce_randr->resources->modes[n];
+            /* get the mode */
+            mode = &xfce_randr->resources->modes[n];
 
-                /* check if this mode is supported by the output */
+            /* check if this mode is supported by the output */
+            for (m = 0; m < XFCE_RANDR_OUTPUT_INFO (xfce_randr)->nmode; m++)
+            {
                 if (XFCE_RANDR_OUTPUT_INFO (xfce_randr)->modes[m] == mode->id)
                 {
                     /* avoid dupplicates */
@@ -379,10 +372,6 @@ display_setting_resolutions_populate (GtkBuilder *builder)
                                             COLUMN_COMBO_NAME, mode->name,
                                             COLUMN_COMBO_VALUE, mode->id, -1);
 
-                        /* select the active mode */
-                        if (mode->id == XFCE_RANDR_MODE (xfce_randr))
-                            gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-
                         /* set the previous mode */
                         prev = mode;
                     }
diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index dd197c5..c30047f 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -37,16 +37,11 @@ XfceRandr *
 xfce_randr_new (GdkDisplay  *display,
                 GError     **error)
 {
-    XfceRandr              *randr;
-    Display                *xdisplay;
-    GdkWindow              *root_window;
-    XRRScreenConfiguration *screen_config;
-    XRRCrtcInfo            *crtc_info;
-#ifdef HAS_RANDR_ONE_POINT_THREE
-    gint                    has_1_3 = FALSE;
-#endif
-    gint                    n;
-    gint                    major, minor;
+    XfceRandr    *randr;
+    Display      *xdisplay;
+    GdkWindow    *root_window;
+    gint          n;
+    gint          major, minor;
 
     g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
     g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -69,10 +64,6 @@ xfce_randr_new (GdkDisplay  *display,
                                     "version 1.1 is required at least"), major, minor); 
         return NULL;
     }
-#ifdef HAS_RANDR_ONE_POINT_THREE
-    else if (major == 1 && minor >= 3)
-        has_1_3 = TRUE;
-#endif
 
     /* allocate the structure */
     randr = g_slice_new0 (XfceRandr);
@@ -84,17 +75,7 @@ xfce_randr_new (GdkDisplay  *display,
     root_window = gdk_get_default_root_window ();
 
     /* get the screen resource */
-#ifdef HAS_RANDR_ONE_POINT_THREE
-    if (has_1_3)
-    {
-        /*XXX: faster, doesn't probe the hw, only returns the current config. Remove after debug? */
-        randr->resources = XRRGetScreenResourcesCurrent (xdisplay, GDK_WINDOW_XID (root_window));
-    }
-    else
-#endif
-    {
-        randr->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window));
-    }
+    randr->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window));
 
     /* set some layout */
     randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
@@ -102,7 +83,6 @@ xfce_randr_new (GdkDisplay  *display,
     /* allocate space for the settings */
     randr->mode = g_new0 (RRMode, randr->resources->noutput);
     randr->rotation = g_new0 (Rotation, randr->resources->noutput);
-    randr->rotations = g_new0 (Rotation, randr->resources->noutput);
     randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
     randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
     randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
@@ -130,44 +110,10 @@ xfce_randr_new (GdkDisplay  *display,
             return NULL;
         }
 
-        /* load defaults */
-        if (randr->resources && randr->output_info[n]->crtc != None)
-        {
-            crtc_info = XRRGetCrtcInfo (xdisplay, randr->resources, randr->output_info[n]->crtc);
-            randr->mode[n] = crtc_info->mode;
-            randr->rotation[n] = crtc_info->rotation;
-            randr->rotations[n] = crtc_info->rotations;
-            XRRFreeCrtcInfo (crtc_info);
-        }
-        else
-        {
-            randr->mode[n] = None;
-            screen_config = XRRGetScreenInfo (xdisplay, GDK_WINDOW_XID (root_window));
-            randr->rotations[n] = XRRConfigRotations (screen_config, &randr->rotation[n]);
-            XRRFreeScreenConfigInfo (screen_config);
-        }
-
-        if (randr->output_info[n]->connection == RR_Connected)
-        {
-#ifdef HAS_RANDR_ONE_POINT_THREE
-            if (has_1_3 && XRRGetOutputPrimary (xdisplay, GDK_WINDOW_XID (root_window)) == randr->resources->outputs[n])
-            {
-                randr->status[n] = XFCE_OUTPUT_STATUS_PRIMARY;
-                continue;
-            }
-            else
-#endif
-            {
-                /* for randr 1.2, no XRRGetOutputPrimary(), so use the first one */
-                if (G_UNLIKELY (n == 0))
-                {
-                    randr->status[n] = XFCE_OUTPUT_STATUS_PRIMARY;
-                    continue;
-                }
-            }
-
-            randr->status[n] = XFCE_OUTPUT_STATUS_SECONDARY;
-        }
+        /* TODO: load defaults */
+        randr->mode[n] = 0;
+        randr->rotation[n] = 0;
+        randr->status[n] = XFCE_OUTPUT_STATUS_NONE;
     }
 
     return randr;
@@ -191,7 +137,6 @@ xfce_randr_free (XfceRandr *randr)
     /* free the settings */
     g_free (randr->mode);
     g_free (randr->rotation);
-    g_free (randr->rotations);
     g_free (randr->status);
     g_free (randr->position);
     g_free (randr->output_info);
@@ -393,10 +338,7 @@ xfce_randr_friendly_name (const gchar *name)
 
     /* try to find a translated user friendly name
      * for the output name */
-    /*XXX: read EDID instead? */
     if (strcmp (name, "LVDS") == 0
-        || strcmp (name, "LVDS0") == 0
-        || strcmp (name, "LVDS1") == 0
         || strcmp (name, "PANEL") == 0)
         return _("Laptop");
     else if (strcmp (name, "VGA") == 0
diff --git a/dialogs/display-settings/xfce-randr.h b/dialogs/display-settings/xfce-randr.h
index 825f2ef..8254433 100644
--- a/dialogs/display-settings/xfce-randr.h
+++ b/dialogs/display-settings/xfce-randr.h
@@ -26,19 +26,13 @@
 
 #define XFCE_RANDR_MODE(randr)        (randr->mode[randr->active_output])
 #define XFCE_RANDR_ROTATION(randr)    (randr->rotation[randr->active_output])
-#define XFCE_RANDR_ROTATIONS(randr)   (randr->rotations[randr->active_output])
 #define XFCE_RANDR_OUTPUT_INFO(randr) (randr->output_info[randr->active_output])
 
 /* check for randr 1.2 or better */
 #if RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 2)
 #define HAS_RANDR_ONE_POINT_TWO
-/* check for randr 1.3 or better */
-#if RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)
-#define HAS_RANDR_ONE_POINT_THREE
-#endif
 #else
 #undef HAS_RANDR_ONE_POINT_TWO
-#undef HAS_RANDR_ONE_POINT_THREE
 #endif
 
 #ifdef HAS_RANDR_ONE_POINT_TWO
@@ -89,7 +83,6 @@ struct _XfceRandr
     /* selected settings for all outputs */
     RRMode              *mode;
     Rotation            *rotation;
-    Rotation            *rotations;
     XfceOutputPosition  *position;
     XfceOutputStatus    *status;
 };



More information about the Xfce4-commits mailing list