[Xfce4-commits] <xfce4-settings:master> Fix regressions introduced with the UI refactoring

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


Updating branch refs/heads/master
         to 891dde2de9ec5bf7a3f3d24ab1bd3f3047f6e713 (commit)
       from 0699fea92b8030cd4c854c0c97e375590e0cfe8d (commit)

commit 891dde2de9ec5bf7a3f3d24ab1bd3f3047f6e713
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Thu Jun 24 18:54:54 2010 +0200

    Fix regressions introduced with the UI refactoring
    
    Correctly recalculate the refresh rate for the selected mode (not only for the
    current one).
    Pick up a (random) supported refresh rate when the user changes the resolution
    in the UI.

 dialogs/display-settings/main.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index b0fd2d4..532af5e 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -319,6 +319,8 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
     gint          n, active = -1;
     gshort        diff, active_diff = G_MAXSHORT;
 #ifdef HAS_RANDR_ONE_POINT_TWO
+    GObject      *res_combobox;
+    GtkTreeIter   dummy;
     XfceRRMode   *modes, *current_mode;
 #endif
 
@@ -333,10 +335,12 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
         /* disable it if no mode is selected */
         gtk_widget_set_sensitive (GTK_WIDGET (combobox), XFCE_RANDR_MODE (xfce_randr) != None);
 
-        /* get the current mode */
-        current_mode = xfce_randr_find_mode_by_id (xfce_randr, xfce_randr->active_output,
-                                                   XFCE_RANDR_MODE (xfce_randr));
+        /* fetch the selected resolution */
+        res_combobox = gtk_builder_get_object (builder, "randr-resolution");
+        if (!display_setting_combo_box_get_value (GTK_COMBO_BOX (res_combobox), &n))
+            return;
 
+        current_mode = xfce_randr_find_mode_by_id (xfce_randr, xfce_randr->active_output, n);
         if (!current_mode)
             return;
 
@@ -344,7 +348,7 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
         modes = XFCE_RANDR_SUPPORTED_MODES (xfce_randr);
         for (n = 0; n < XFCE_RANDR_OUTPUT_INFO (xfce_randr)->nmode; ++n)
         {
-            /* the mode resolution does not match the current one */
+            /* the mode resolution does not match the selected one */
             if (modes[n].width != current_mode->width
                 || modes[n].height != current_mode->height)
                 continue;
@@ -361,6 +365,10 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
             if (modes[n].id == XFCE_RANDR_MODE (xfce_randr))
                 gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
         }
+
+        /* if a new resolution was selected, set a refresh rate */
+        if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combobox), &dummy))
+            gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
     }
     else
 #endif



More information about the Xfce4-commits mailing list