[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Correctly get the ModeInfo associated to the requested mode

Jérôme Guelfucci noreply at xfce.org
Sun Jun 6 10:00:01 CEST 2010


Updating branch refs/heads/xrandr-display-settings
         to 18ea1a5dad6edc661215609bf537069268583737 (commit)
       from 72a6ffb19507571c969dbc9d4b8a886f92136c5a (commit)

commit 18ea1a5dad6edc661215609bf537069268583737
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Sun Jun 6 00:04:15 2010 +0200

    Correctly get the ModeInfo associated to the requested mode

 xfce4-settings-helper/displays.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/xfce4-settings-helper/displays.c b/xfce4-settings-helper/displays.c
index c9b3e1d..b370251 100644
--- a/xfce4-settings-helper/displays.c
+++ b/xfce4-settings-helper/displays.c
@@ -174,7 +174,7 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper,
     GdkWindow          *root_window;
     XRRScreenResources *resources;
     gchar               property[512];
-    gint                l, m, n, num_outputs, output_rot, noutput;
+    gint                j, l, m, n, num_outputs, output_rot, noutput;
 #ifdef HAS_RANDR_ONE_POINT_THREE
     gint                is_primary;
 #endif
@@ -254,23 +254,35 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper,
                 continue;
             }
 
-            /* walk all supported modes */
+            /* walk supported modes */
             mode = None;
             for (l = 0; l < output_info->nmode; ++l)
             {
-                /* get the mode info */
-                mode_info = &resources->modes[m];
+                /* walk all modes */
+                for (j = 0; j < resources->nmode; ++j)
+                {
+                    /* get the mode info */
+                    mode_info = &resources->modes[l];
 
-                /* calculate the refresh rate */
-                rate = (gfloat) mode_info->dotClock / ((gfloat) mode_info->hTotal * (gfloat) mode_info->vTotal);
+                    /* does the mode info match the mode we seek? */
+                    if (mode_info->id != output_info->mode[j])
+                        continue;
 
-                /* find the mode corresponding to the saved values */
-                if (((int) rate == (int) output_rate)
-                    && (g_strcmp0 (mode_info->name, output_res) == 0))
-                {
-                    mode = mode_info->id;
-                    break;
+                    /* calculate the refresh rate */
+                    rate = (gfloat) mode_info->dotClock / ((gfloat) mode_info->hTotal * (gfloat) mode_info->vTotal);
+
+                    /* find the mode corresponding to the saved values */
+                    if (((int) rate == (int) output_rate)
+                        && (g_strcmp0 (mode_info->name, output_res) == 0))
+                    {
+                        mode = mode_info->id;
+                        break;
+                    }
                 }
+
+                /* found it */
+                if (mode != None)
+                    break;
             }
 
             /* unsupported mode, abort for this output */



More information about the Xfce4-commits mailing list