discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=e88d1af101b32a626c5c00adb2e4aa413d825928

commit e88d1af101b32a626c5c00adb2e4aa413d825928
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Jan 6 12:56:22 2017 -0500

    resolve winlist float-equal warnings
    
    Reviewed-by: Derek Foreman <[email protected]>
---
 src/modules/winlist/e_int_config_winlist.c | 10 ++++++----
 src/modules/winlist/e_winlist.c            | 24 ++++++++++++------------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/modules/winlist/e_int_config_winlist.c 
b/src/modules/winlist/e_int_config_winlist.c
index 4216768..a65e405 100644
--- a/src/modules/winlist/e_int_config_winlist.c
+++ b/src/modules/winlist/e_int_config_winlist.c
@@ -146,7 +146,9 @@ static int
 _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data 
*cfdata)
 {
 #define DO(_e_config, _cfdata) \
-  if (e_config->winlist_##_e_config != cfdata->_cfdata) return 1;
+  if (e_config->winlist_##_e_config != cfdata->_cfdata) return 1
+#define DO_DBL(_e_config, _cfdata) \
+  if (!EINA_DBL_CMP(e_config->winlist_##_e_config, cfdata->_cfdata)) return 1
 
    DO(list_show_iconified, iconified);
    DO(list_show_other_desk_iconified, iconified_other_desks);
@@ -160,11 +162,11 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, 
E_Config_Dialog_Data *cfd
    DO(warp_at_end, warp_at_end);
    DO(no_warp_on_direction, no_warp_on_direction);
    DO(scroll_animate, scroll_animate);
-   DO(scroll_speed, scroll_speed);
+   DO_DBL(scroll_speed, scroll_speed);
    DO(list_focus_while_selecting, focus);
    DO(list_raise_while_selecting, raise);
-   DO(pos_align_x, align_x);
-   DO(pos_align_y, align_y);
+   DO_DBL(pos_align_x, align_x);
+   DO_DBL(pos_align_y, align_y);
    DO(pos_min_w, min_w);
    DO(pos_min_h, min_h);
    DO(pos_max_w, max_w);
diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c
index d7ff140..4e62d27 100644
--- a/src/modules/winlist/e_winlist.c
+++ b/src/modules/winlist/e_winlist.c
@@ -378,18 +378,18 @@ e_winlist_prev(void)
 static int
 point_line_dist(int x, int y, int lx1, int ly1, int lx2, int ly2)
 {
-   double xx, yy, dx, dy, dist;
-   double a = x - lx1;
-   double b = y - ly1;
-   double c = lx2 - lx1;
-   double d = ly2 - ly1;
+   int xx, yy, dx, dy;
+   int a = x - lx1;
+   int b = y - ly1;
+   int c = lx2 - lx1;
+   int d = ly2 - ly1;
 
-   double dot = (a * c) + (b * d);
-   double len_sq = (c * c) + (d * d);
-   double param = -1;
+   int dot = (a * c) + (b * d);
+   int len_sq = (c * c) + (d * d);
+   double dist, param = -1.0;
 
    // if line is 0 length
-   if (len_sq != 0) param = dot / len_sq;
+   if (len_sq) param = (double)dot / len_sq;
 
    if (param < 0)
      {
@@ -403,14 +403,14 @@ point_line_dist(int x, int y, int lx1, int ly1, int lx2, 
int ly2)
      }
    else
      {
-        xx = lx1 + (param * c);
-        yy = ly1 + (param * d);
+        xx = lx1 + lround(param * c);
+        yy = ly1 + lround(param * d);
    }
 
    dx = x - xx;
    dy = y - yy;
    dist = sqrt((dx * dx) + (dy * dy));
-   return (int)dist;
+   return lround(dist);
 }
 
 void

-- 


Reply via email to