[Xfce4-commits] <xfce4-settings:master> Properly round display refresh rate to find match.

Nick Schermer noreply at xfce.org
Sun Mar 25 19:56:01 CEST 2012


Updating branch refs/heads/master
         to 2ed1bc33786ecfbef756a9f2581c367cb5f07476 (commit)
       from 80d63c1050211973a2e38dc1afde2f170bd8197b (commit)

commit 2ed1bc33786ecfbef756a9f2581c367cb5f07476
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Mar 25 19:54:36 2012 +0200

    Properly round display refresh rate to find match.

 xfsettingsd/Makefile.am |    3 ++-
 xfsettingsd/displays.c  |    5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xfsettingsd/Makefile.am b/xfsettingsd/Makefile.am
index 0adaa5d..8850d07 100644
--- a/xfsettingsd/Makefile.am
+++ b/xfsettingsd/Makefile.am
@@ -71,7 +71,8 @@ xfsettingsd_LDADD = \
 	$(XI_LIBS) \
 	$(LIBX11_LIBS) \
 	$(LIBNOTIFY_LIBS) \
-	$(FONTCONFIG_LIBS)
+	$(FONTCONFIG_LIBS) \
+	-lm
 
 #
 # Optional support for the display settings
diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c
index 2e41a35..0728b91 100644
--- a/xfsettingsd/displays.c
+++ b/xfsettingsd/displays.c
@@ -24,6 +24,9 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
 
 #include <glib.h>
 #include <gdk/gdkx.h>
@@ -613,7 +616,7 @@ xfce_displays_helper_channel_apply (XfceDisplaysHelper *helper,
                     continue;
 
                 /* calculate the refresh rate */
-                rate = (gfloat) mode_info->dotClock / ((gfloat) mode_info->hTotal * (gfloat) mode_info->vTotal);
+                rate = rint ((gdouble) mode_info->dotClock / ((gdouble) mode_info->hTotal * (gdouble) mode_info->vTotal));
 
                 /* find the mode corresponding to the saved values */
                 if (((int) rate == (int) output_rate)


More information about the Xfce4-commits mailing list