resolve winlist float-equal warnings

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
Mike Blumenkrantz 2017-01-06 12:56:22 -05:00
parent 3ad6c0c88c
commit e88d1af101
2 changed files with 18 additions and 16 deletions

View File

@ -146,7 +146,9 @@ static int
_basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata) _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
{ {
#define DO(_e_config, _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_iconified, iconified);
DO(list_show_other_desk_iconified, iconified_other_desks); 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(warp_at_end, warp_at_end);
DO(no_warp_on_direction, no_warp_on_direction); DO(no_warp_on_direction, no_warp_on_direction);
DO(scroll_animate, scroll_animate); DO(scroll_animate, scroll_animate);
DO(scroll_speed, scroll_speed); DO_DBL(scroll_speed, scroll_speed);
DO(list_focus_while_selecting, focus); DO(list_focus_while_selecting, focus);
DO(list_raise_while_selecting, raise); DO(list_raise_while_selecting, raise);
DO(pos_align_x, align_x); DO_DBL(pos_align_x, align_x);
DO(pos_align_y, align_y); DO_DBL(pos_align_y, align_y);
DO(pos_min_w, min_w); DO(pos_min_w, min_w);
DO(pos_min_h, min_h); DO(pos_min_h, min_h);
DO(pos_max_w, max_w); DO(pos_max_w, max_w);

View File

@ -378,18 +378,18 @@ e_winlist_prev(void)
static int static int
point_line_dist(int x, int y, int lx1, int ly1, int lx2, int ly2) point_line_dist(int x, int y, int lx1, int ly1, int lx2, int ly2)
{ {
double xx, yy, dx, dy, dist; int xx, yy, dx, dy;
double a = x - lx1; int a = x - lx1;
double b = y - ly1; int b = y - ly1;
double c = lx2 - lx1; int c = lx2 - lx1;
double d = ly2 - ly1; int d = ly2 - ly1;
double dot = (a * c) + (b * d); int dot = (a * c) + (b * d);
double len_sq = (c * c) + (d * d); int len_sq = (c * c) + (d * d);
double param = -1; double dist, param = -1.0;
// if line is 0 length // if line is 0 length
if (len_sq != 0) param = dot / len_sq; if (len_sq) param = (double)dot / len_sq;
if (param < 0) if (param < 0)
{ {
@ -403,14 +403,14 @@ point_line_dist(int x, int y, int lx1, int ly1, int lx2, int ly2)
} }
else else
{ {
xx = lx1 + (param * c); xx = lx1 + lround(param * c);
yy = ly1 + (param * d); yy = ly1 + lround(param * d);
} }
dx = x - xx; dx = x - xx;
dy = y - yy; dy = y - yy;
dist = sqrt((dx * dx) + (dy * dy)); dist = sqrt((dx * dx) + (dy * dy));
return (int)dist; return lround(dist);
} }
void void