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

Nick Schermer noreply at xfce.org
Sat Aug 28 23:02:15 CEST 2010


Updating branch refs/heads/master
         to 3094451e9b4831f8f27f5cbd95780308627bcdf8 (commit)
       from 94dbf1137c9e0ae982e0df72a66b38f9371221be (commit)

commit 3094451e9b4831f8f27f5cbd95780308627bcdf8
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