[gnome-flashback] backends: add some wiggle room for refresh rate comparisons



commit 021f2d6fc2e77a23e90abc76a2093fc51c960c5f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Sep 14 12:42:47 2017 +0200

    backends: add some wiggle room for refresh rate comparisons
    
    We have not enough control over the sources of the refresh rate
    float variable to make == comparisons reliable, add some room
    when comparing these.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787668

 backends/gf-monitor.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index b6efbe4..5a30f41 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -36,6 +36,7 @@
 #define MAXIMUM_SCALE_FACTOR 4.0f
 #define MINIMUM_LOGICAL_WIDTH 800
 #define MINIMUM_LOGICAL_HEIGHT 600
+#define MAXIMUM_REFRESH_RATE_DIFF 0.001
 
 /* The minimum screen height at which we turn on a window-scale of 2;
  * below this there just isn't enough vertical real estate for GNOME
@@ -91,9 +92,13 @@ static gboolean
 gf_monitor_mode_spec_equals (GfMonitorModeSpec *spec,
                              GfMonitorModeSpec *other_spec)
 {
+  gfloat refresh_rate_diff;
+
+  refresh_rate_diff = ABS (spec->refresh_rate - other_spec->refresh_rate);
+
   return (spec->width == other_spec->width &&
           spec->height == other_spec->height &&
-          spec->refresh_rate == other_spec->refresh_rate &&
+          refresh_rate_diff < MAXIMUM_REFRESH_RATE_DIFF &&
           spec->flags == other_spec->flags);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]