elm: resolve float comparison warnings

Summary: Depends on D11790

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11791
This commit is contained in:
Mike Blumenkrantz 2020-05-09 09:25:21 +01:00 committed by Carsten Haitzler (Rasterman)
parent c323199f3c
commit 823b7b05cd
31 changed files with 134 additions and 132 deletions

View File

@ -39,23 +39,23 @@ _elm_notify_orient_get(const Evas_Object *obj)
elm_notify_align_get(obj, &horizontal, &vertical);
if ((horizontal == 0.5) && (vertical == 0.0))
if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 0.0))
orient = ELM_NOTIFY_ORIENT_TOP;
else if ((horizontal == 0.5) && (vertical == 0.5))
else if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 0.5))
orient = ELM_NOTIFY_ORIENT_CENTER;
else if ((horizontal == 0.5) && (vertical == 1.0))
else if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 1.0))
orient = ELM_NOTIFY_ORIENT_BOTTOM;
else if ((horizontal == 0.0) && (vertical == 0.5))
else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 0.5))
orient = ELM_NOTIFY_ORIENT_LEFT;
else if ((horizontal == 1.0) && (vertical == 0.5))
else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 0.5))
orient = ELM_NOTIFY_ORIENT_RIGHT;
else if ((horizontal == 0.0) && (vertical == 0.0))
else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 0.0))
orient = ELM_NOTIFY_ORIENT_TOP_LEFT;
else if ((horizontal == 1.0) && (vertical == 0.0))
else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 0.0))
orient = ELM_NOTIFY_ORIENT_TOP_RIGHT;
else if ((horizontal == 0.0) && (vertical == 1.0))
else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 1.0))
orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT;
else if ((horizontal == 1.0) && (vertical == 1.0))
else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 1.0))
orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT;
else
orient = ELM_NOTIFY_ORIENT_TOP;

View File

@ -536,7 +536,7 @@ _state_update(Evas_Object *obj)
if (mx < 1) mx = 1; // quick hack to keep curl line visible
if (mgrad == 0.0) // special horizontal case
if (EINA_DBL_EQ(mgrad, 0.0)) // special horizontal case
mgrad = 0.001; // quick dirty hack for now
// else
{
@ -2099,7 +2099,7 @@ _efl_ui_flip_interaction_direction_hitsize_set(Eo *obj, Efl_Ui_Flip_Data *sd, Ef
else if (hitsize > 1.0)
hitsize = 1.0;
if (sd->dir_hitsize[i] == hitsize) return;
if (EINA_DBL_EQ(sd->dir_hitsize[i], hitsize)) return;
sd->dir_hitsize[i] = hitsize;
if (hitsize >= 0.0)

View File

@ -2451,7 +2451,7 @@ _efl_ui_image_zoomable_efl_ui_zoom_zoom_level_set(Eo *obj, Efl_Ui_Image_Zoomable
z = (double)sd->size.imw / pw;
else
z = (double)sd->size.imh / ph;
if (z != sd->zoom)
if (!EINA_DBL_EQ(z, sd->zoom))
zoom_changed = 1;
sd->zoom = z;
sd->size.nw = pw;

View File

@ -497,9 +497,9 @@ _progressbar_part_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *pa
else
{
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL);
if (sd->val == min)
if (EINA_DBL_EQ(sd->val, min))
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL);
if (sd->val == max)
if (EINA_DBL_EQ(sd->val, max))
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL);
}
}

View File

@ -1628,7 +1628,7 @@ _efl_ui_scroll_manager_post_event_move_on_hold_eval(Efl_Ui_Scroll_Manager_Data *
_elm_config->thumbscroll_hold_threshold;
}
if ((vx != 0.0) || (vy != 0.0)) _scroll_manager_on_hold_animator_add(sd, vx*sx, vy*sy);
if (EINA_DBL_NONZERO(vx) || EINA_DBL_NONZERO(vy)) _scroll_manager_on_hold_animator_add(sd, vx*sx, vy*sy);
else _scroll_manager_on_hold_animator_del(sd);
}

View File

@ -67,10 +67,10 @@ _emit_events(Eo *obj, Efl_Ui_Slider_Data *sd)
{
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL);
if (sd->val == sd->val_min)
if (EINA_DBL_EQ(sd->val, sd->val_min))
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL);
if (sd->val == sd->val_max)
if (EINA_DBL_EQ(sd->val, sd->val_max))
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL);
// emit accessibility event also if value was changed by API
@ -133,7 +133,7 @@ _drag_value_fetch(Evas_Object *obj)
static void
_adjust_to_step(Efl_Ui_Slider *obj, Efl_Ui_Slider_Data *pd)
{
if (pd->step)
if (EINA_DBL_NONZERO(pd->step))
{
double relative_step = pd->step/(pd->val_max - pd->val_min);
double new_value = (round(pd->val/relative_step))*relative_step;
@ -777,7 +777,7 @@ _efl_ui_slider_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Efl_
return;
}
if (sd->step == step) return;
if (EINA_DBL_EQ(sd->step, step)) return;
sd->step = step;
}

View File

@ -48,9 +48,9 @@ static void
_emit_events(Eo *obj, Efl_Ui_Slider_Interval_Data *sd)
{
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL);
if (sd->val == sd->val_min)
if (EINA_DBL_EQ(sd->val, sd->val_min))
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL);
if (sd->val == sd->val_max)
if (EINA_DBL_EQ(sd->val, sd->val_max))
efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL);
}
@ -850,7 +850,7 @@ _efl_ui_slider_interval_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNU
return;
}
if (sd->step == step) return;
if (EINA_DBL_EQ(sd->step, step)) return;
sd->step = step;
}

View File

@ -144,7 +144,7 @@ _transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data
pd->show_request.to = -1;
_transition_end(obj, pd);
}
if (pd->position == pd->show_request.to)
if (EINA_DBL_EQ(pd->position, pd->show_request.to))
{
//successfully there
_transition_end(obj, pd);
@ -707,7 +707,7 @@ _efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Da
//the api indicates that the caller passes ownership to this function, so we need to unref here
efl_unref(pd->indicator);
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
if (pd->position != -1)
if (!EINA_DBL_EQ(pd->position, -1))
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->position);
}
}

View File

@ -21,7 +21,7 @@ static void
_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Plain_Manager_Data *pd)
{
double absolut_position = efl_pack_index_get(pd->container, pd->current_content);
if (pd->last_pos != absolut_position)
if (!EINA_DBL_EQ(pd->last_pos, absolut_position))
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
pd->last_pos = absolut_position;

View File

@ -619,7 +619,7 @@ _path_start_angle_adjust(Eo *obj, Efl_Ui_Textpath_Data *pd)
eina_vector2_normalize(&first, &first);
eina_vector2_normalize(&last, &last);
rad = acos(eina_vector2_dot_product(&first, &last));
if (rad == 0) return;
if (EINA_DBL_EQ(rad, 0)) return;
offset_angle = _rad_to_deg(rad);
if (r.w > pd->total_length / 2)
@ -851,8 +851,8 @@ _efl_ui_textpath_circular_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double radius,
Eina_Size2D text_size;
double sweep_length, x, y;
if (pd->circle.radius == radius &&
pd->circle.start_angle == start_angle &&
if (EINA_DBL_EQ(pd->circle.radius, radius) &&
EINA_DBL_EQ(pd->circle.start_angle, start_angle) &&
pd->direction == direction &&
_map_point_calc(pd) > 0)
return;
@ -984,9 +984,9 @@ elm_textpath_circle_set(Eo *obj, double x, double y, double radius, double start
EFL_UI_TEXTPATH_DATA_GET(obj, pd);
if (!pd) return;
if (pd->circle.x == x && pd->circle.y == y &&
pd->circle.radius == radius &&
pd->circle.start_angle == start_angle &&
if (EINA_DBL_EQ(pd->circle.x, x) && EINA_DBL_EQ(pd->circle.y, y) &&
EINA_DBL_EQ(pd->circle.radius, radius) &&
EINA_DBL_EQ(pd->circle.start_angle, start_angle) &&
pd->direction == direction &&
_map_point_calc(pd) > 0)
return;

View File

@ -49,8 +49,8 @@ _sizing_eval(Eo *obj, void *data)
Eina_Size2D size = efl_canvas_vg_object_default_size_get(pd->vg);
Eina_Size2D min = {-1, -1};
if (hw == 0) min.w = size.w;
if (hh == 0) min.h = size.h;
if (EINA_DBL_EQ(hw, 0)) min.w = size.w;
if (EINA_DBL_EQ(hh, 0)) min.h = size.h;
efl_gfx_hint_size_min_set(obj, min);
}
@ -148,8 +148,8 @@ _transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
EFL_UI_VG_ANIMATION_DATA_GET(obj, pd);
if (!pd) return;
if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING && pd->progress == 1) ||
(pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS && pd->progress == 0))
if ((pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING && EINA_DBL_EQ(pd->progress, 1)) ||
(pd->state == EFL_UI_VG_ANIMATION_STATE_PLAYING_BACKWARDS && EINA_DBL_EQ(pd->progress, 0)))
{
if (elm_widget_is_legacy(obj))
evas_object_smart_callback_call(obj, SIG_PLAY_DONE, NULL);
@ -212,7 +212,7 @@ _transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
int update_frame = (int)((maxframe - minframe) * progress) + minframe;
int current_frame = evas_object_vg_animated_frame_get(pd->vg);
if (pd->playback_speed == 0)
if (EINA_DBL_EQ(pd->playback_speed, 0))
update_frame = current_frame;
evas_object_vg_animated_frame_set(pd->vg, update_frame);
@ -308,7 +308,7 @@ _update_frame_duration(Efl_Ui_Vg_Animation_Data *pd)
pd->frame_duration = (double)(max_frame - min_frame) / frame_rate;
if (pd->transit)
elm_transit_duration_set(pd->transit, speed != 0 ? pd->frame_duration * (1 / speed) : 0);
elm_transit_duration_set(pd->transit, EINA_DBL_NONZERO(speed) ? pd->frame_duration * (1 / speed) : 0);
}
static Eina_Bool
@ -333,10 +333,10 @@ _ready_play(Eo *obj, Efl_Ui_Vg_Animation_Data *pd)
elm_transit_objects_final_state_keep_set(transit, EINA_TRUE);
elm_transit_event_enabled_set(transit, EINA_TRUE);
pd->transit = transit;
if (pd->min_progress != 0.0 || pd->max_progress != 1.0)
if (EINA_DBL_NONZERO(pd->min_progress) || !EINA_DBL_EQ(pd->max_progress, 1.0))
_update_frame_duration(pd);
else
elm_transit_duration_set(transit, speed != 0 ? pd->frame_duration * (1 / speed) : 0);
elm_transit_duration_set(transit, EINA_DBL_NONZERO(speed) ? pd->frame_duration * (1 / speed) : 0);
return EINA_TRUE;
}
@ -710,7 +710,7 @@ _efl_ui_vg_animation_efl_player_playing_set(Eo *obj, Efl_Ui_Vg_Animation_Data *p
if (pd->state == EFL_UI_VG_ANIMATION_STATE_STOPPED)
{
if (pd->playing_reverse && pd->progress == 0) pd->progress = 1.0;
if (pd->playing_reverse && EINA_DBL_EQ(pd->progress, 0)) pd->progress = 1.0;
_transit_go_facade(obj, pd);
}
else if (rewind)
@ -785,7 +785,7 @@ _efl_ui_vg_animation_efl_player_playback_position_set(Eo *obj, Efl_Ui_Vg_Animati
EINA_SAFETY_ON_TRUE_RETURN(sec < 0);
EINA_SAFETY_ON_TRUE_RETURN(sec > pd->frame_duration);
efl_player_playback_progress_set(obj, pd->frame_duration != 0 ? sec / pd->frame_duration : 0);
efl_player_playback_progress_set(obj, EINA_DBL_NONZERO(pd->frame_duration) ? sec / pd->frame_duration : 0);
}
EOLIAN static double
@ -805,7 +805,7 @@ _efl_ui_vg_animation_efl_player_playback_progress_set(Eo *obj EINA_UNUSED, Efl_U
{
if (progress < 0) progress = 0;
else if (progress > 1) progress = 1;
if (pd->progress == progress) return;
if (EINA_DBL_EQ(pd->progress, progress)) return;
pd->progress = progress;
@ -844,7 +844,7 @@ _efl_ui_vg_animation_efl_player_playback_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_V
pd->playback_speed = speed;
speed = speed < 0 ? speed * -1 : speed;
if (pd->transit)
elm_transit_duration_set(pd->transit, pd->playback_speed != 0 ? pd->frame_duration * (1 / speed) : 0);
elm_transit_duration_set(pd->transit, EINA_DBL_NONZERO(pd->playback_speed) ? pd->frame_duration * (1 / speed) : 0);
}
EOLIAN static double

View File

@ -1482,7 +1482,7 @@ _efl_ui_widget_widget_parent_set(Eo *obj, Elm_Widget_Smart_Data *pd, Efl_Ui_Widg
if (!pd->on_create)
{
if ((scale != prev_scale) || (th != prev_th) ||
if (!EINA_DBL_EQ(scale, prev_scale) || (th != prev_th) ||
(pmirrored != mirrored))
elm_widget_theme(obj);
}
@ -2343,7 +2343,7 @@ EOLIAN static void
_efl_ui_widget_efl_gfx_entity_scale_set(Eo *obj, Elm_Widget_Smart_Data *sd, double scale)
{
if (scale < 0.0) scale = 0.0;
if (sd->scale != scale)
if (!EINA_DBL_EQ(sd->scale, scale))
{
sd->scale = scale;
elm_widget_theme(obj);
@ -2354,7 +2354,7 @@ EOLIAN static double
_efl_ui_widget_efl_gfx_entity_scale_get(const Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
{
// FIXME: save walking up the tree by storing/caching parent scale
if (sd->scale == 0.0)
if (EINA_DBL_EQ(sd->scale, 0.0))
{
if (sd->parent_obj && elm_widget_is(sd->parent_obj))
{

View File

@ -3745,12 +3745,12 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize)
maxh = sd->max_h;
// Compatibility hack (for E)
if (sd->single_edje_content && !wx && !wy)
if (sd->single_edje_content && EINA_DBL_EQ(wx, 0) && EINA_DBL_EQ(wy, 0))
wx = wy = 1;
if (!wx) maxw = minw;
if (EINA_DBL_EQ(wx, 0)) maxw = minw;
if (maxw < 1) maxw = 32767;
if (!wy) maxh = minh;
if (EINA_DBL_EQ(wy, 0)) maxh = minh;
if (maxh < 1) maxh = 32767;
if (maxw < minw) maxw = minw;
if (maxh < minh) maxh = minh;

View File

@ -2602,7 +2602,7 @@ _value_properties_set(const Eldbus_Service_Interface *interface, const char *pro
ret = efl_access_value_and_text_set(obj, value, NULL);
else if(efl_isa(obj, EFL_UI_RANGE_DISPLAY_INTERFACE)) {
efl_ui_range_value_set(obj, value);
ret = (efl_ui_range_value_get(obj) == value);
ret = EINA_DBL_EQ(efl_ui_range_value_get(obj), value);
}
else ret = EINA_FALSE;
Eldbus_Message *answer = eldbus_message_method_return_new(request_msg);

View File

@ -2112,10 +2112,10 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline)
return;
}
if (pd->gravity_x == 1.0 || pd->gravity_y == 1.0)
if (EINA_DBL_EQ(pd->gravity_x, 1.0) || EINA_DBL_EQ(pd->gravity_y, 1.0))
_elm_code_widget_scroll_by(widget,
(pd->gravity_x == 1.0 && ww > old_width) ? ww - old_width : 0,
(pd->gravity_y == 1.0 && wh > old_height) ? wh - old_height : 0);
(EINA_DBL_EQ(pd->gravity_x, 1.0) && ww > old_width) ? ww - old_width : 0,
(EINA_DBL_EQ(pd->gravity_y, 1.0) && wh > old_height) ? wh - old_height : 0);
}
EOAPI void

View File

@ -398,10 +398,10 @@ _rgb_to_hsl(Elm_Colorselector_Data *sd)
g2 = (v - g) / vm;
b2 = (v - b) / vm;
if (r == v) sd->h = (g == m ? 5.0 + b2 : 1.0 - g2);
else if (g == v)
sd->h = (b == m ? 1.0 + r2 : 3.0 - b2);
else sd->h = (r == m ? 3.0 + g2 : 5.0 - r2);
if (EINA_DBL_EQ(r, v)) sd->h = (EINA_DBL_EQ(g, m) ? 5.0 + b2 : 1.0 - g2);
else if (EINA_DBL_EQ(g, v))
sd->h = (EINA_DBL_EQ(b, m) ? 1.0 + r2 : 3.0 - b2);
else sd->h = (EINA_DBL_EQ(r, m) ? 3.0 + g2 : 5.0 - r2);
sd->h *= 60.0;
}
@ -418,16 +418,16 @@ _hsl_to_rgb(Elm_Colorselector_Data *sd)
_s = sd->s;
_l = sd->l;
if (_s == 0.0) r = g = b = _l;
if (EINA_DBL_EQ(_s, 0.0)) r = g = b = _l;
else
{
if (_h == 360.0) _h = 0.0;
if (EINA_DBL_EQ(_h, 360.0)) _h = 0.0;
_h /= 60.0;
v = (_l <= 0.5) ? (_l * (1.0 + _s)) : (_l + _s - (_l * _s));
p = _l + _l - v;
if (v) sv = (v - p) / v;
if (EINA_DBL_NONZERO(v)) sv = (v - p) / v;
else sv = 0;
i = (int)_h;
@ -489,7 +489,7 @@ _hsl_to_rgb(Elm_Colorselector_Data *sd)
f = (b * 255.0) - i;
b = (f <= 0.5) ? i : (i + 1);
if (sd->r == r && sd->g == g && sd->b == b) return EINA_FALSE;
if (EINA_DBL_EQ(sd->r, r) && EINA_DBL_EQ(sd->g, g) && EINA_DBL_EQ(sd->b, b)) return EINA_FALSE;
sd->r = r;
sd->g = g;

View File

@ -2047,7 +2047,7 @@ _config_flush_get(void)
evas_font_reinit();
_elm_config_font_overlay_apply();
_elm_config_color_overlay_apply();
if (pre_scale != _elm_config->scale)
if (!EINA_DBL_EQ(pre_scale, _elm_config->scale))
_elm_rescale();
_elm_old_clouseau_reload();
_elm_config_key_binding_hash();
@ -2997,7 +2997,7 @@ elm_config_scale_set(double scale)
{
_elm_config->priv.scale = EINA_TRUE;
if (scale < 0.0) return;
if (_elm_config->scale == scale) return;
if (EINA_DBL_EQ(_elm_config->scale, scale)) return;
_elm_config->scale = scale;
_elm_rescale();
}
@ -3049,7 +3049,7 @@ elm_config_password_show_last_timeout_set(double password_show_last_timeout)
{
_elm_config->priv.password_show_last_timeout = EINA_TRUE;
if (password_show_last_timeout < 0.0) return;
if (_elm_config->password_show_last_timeout == password_show_last_timeout) return;
if (EINA_DBL_EQ(_elm_config->password_show_last_timeout, password_show_last_timeout)) return;
_elm_config->password_show_last_timeout = password_show_last_timeout;
edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
}
@ -4494,12 +4494,13 @@ _elm_config_reload(void)
_elm_config_font_overlay_apply();
_elm_config_color_overlay_apply();
#define CMP(x) (p##x != _elm_config->x)
#define DBL_CMP(x) !EINA_DBL_EQ(p##x, _elm_config->x)
if (
CMP(scale)
DBL_CMP(scale)
|| CMP(finger_size)
|| CMP(icon_size)
|| CMP(password_show_last)
|| CMP(password_show_last_timeout)
|| DBL_CMP(password_show_last_timeout)
|| CMP(week_start)
|| CMP(weekend_start)
|| CMP(weekend_len)
@ -4513,6 +4514,7 @@ _elm_config_reload(void)
|| CMP(icon_theme)
)
_elm_rescale();
#undef DBL_CMP
#undef CMP
_elm_old_clouseau_reload();
_elm_config_key_binding_hash();
@ -4695,7 +4697,7 @@ elm_config_transition_duration_factor_set(double factor)
{
_elm_config->priv.transition_duration_factor = EINA_TRUE;
if (factor < 0.0) return;
if (_elm_config->transition_duration_factor == factor) return;
if (EINA_DBL_EQ(_elm_config->transition_duration_factor, factor)) return;
_elm_config->transition_duration_factor = factor;
edje_transition_duration_factor_set(_elm_config->transition_duration_factor);
}

View File

@ -417,7 +417,7 @@ _cont_obj_anim_start(void *data)
_drag_anim_start(st);
else
{
if (st->anim_tm)
if (EINA_DBL_NONZERO(st->anim_tm))
{
// even if we don't manage the icons animation, we have
// to wait until it is finished before beginning drag.

View File

@ -476,7 +476,7 @@ _items_add(Evas_Object *obj)
EOLIAN static void
_elm_flipselector_efl_ui_range_display_range_limits_set(Eo *obj, Elm_Flipselector_Data *sd, double min, double max)
{
if ((sd->val_min == min) && (sd->val_max == max)) return;
if (EINA_DBL_EQ(sd->val_min, min) && EINA_DBL_EQ(sd->val_max, max)) return;
sd->val_min = min;
sd->val_max = max;
@ -494,9 +494,9 @@ _elm_flipselector_efl_ui_range_display_range_limits_get(const Eo *obj EINA_UNUSE
EOLIAN static void
_elm_flipselector_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd, double step)
{
if (sd->step == step) return;
if (EINA_DBL_EQ(sd->step, step)) return;
if (step == 0.0) step = 1.0;
if (EINA_DBL_EQ(step, 0.0)) step = 1.0;
else if (step < 0.0) step *= -1;
sd->step = step;
@ -512,7 +512,7 @@ _elm_flipselector_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNU
EOLIAN static double
_elm_flipselector_efl_ui_range_display_range_value_get(const Eo *obj EINA_UNUSED, Elm_Flipselector_Data *sd)
{
if (sd->val_min == 0 && sd->val_max == 0)
if (EINA_DBL_EQ(sd->val_min, 0) && EINA_DBL_EQ(sd->val_max, 0))
{
WRN("This API can be used only if you set min and max and flipselector values are numericals");
return 0;

View File

@ -4452,7 +4452,7 @@ _elm_gengrid_align_set(Eo *obj EINA_UNUSED, Elm_Gengrid_Data *sd, double align_x
align_y = 0.0;
sd->align_y = align_y;
if ((old_h != sd->align_x) || (old_y != sd->align_y))
if (!EINA_DBL_EQ(old_h, sd->align_x) || !EINA_DBL_EQ(old_y, sd->align_y))
evas_object_smart_calculate(sd->pan_obj);
}

View File

@ -3582,7 +3582,7 @@ _rotate_test(Evas_Object *obj,
Gesture_Info *gesture;
Rotate_Type *st = NULL;
if (!_elm_config->glayer_rotate_finger_enable)
if (EINA_DBL_EQ(_elm_config->glayer_rotate_finger_enable, 0))
return;
if (!pe)

View File

@ -946,8 +946,8 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
-((double)sid->page.y * ((double)vh / (double)h)) / 100.0);
elm_obj_pan_pos_get(sid->pan_obj, &px, &py);
if (vx != mx) x = px;
if (vy != my) y = py;
if (!EINA_DBL_EQ(vx, mx)) x = px;
if (!EINA_DBL_EQ(vy, my)) y = py;
elm_obj_pan_pos_set(sid->pan_obj, x, y);
if (mx > 0) vx = (double)(x - minx) / (double)mx;
@ -2292,8 +2292,8 @@ _elm_scroll_post_event_up(void *data,
static Eina_Bool
_paging_is_enabled(Elm_Scrollable_Smart_Interface_Data *sid)
{
if ((sid->pagerel_h == 0.0) && (!sid->pagesize_h) &&
(sid->pagerel_v == 0.0) && (!sid->pagesize_v))
if (EINA_DBL_EQ(sid->pagerel_h, 0.0) && (!sid->pagesize_h) &&
EINA_DBL_EQ(sid->pagerel_v, 0.0) && (!sid->pagesize_v))
return EINA_FALSE;
return EINA_TRUE;
}
@ -2314,7 +2314,7 @@ _elm_scroll_momentum_animator(void *data, const Efl_Event *event EINA_UNUSED)
t = ecore_loop_time_get();
if (sid->down.anim_dur == 0) dt = 1.0;
if (EINA_DBL_EQ(sid->down.anim_dur, 0)) dt = 1.0;
else dt = (t - sid->down.anim_start) / sid->down.anim_dur;
if (dt >= 0.0)
@ -2675,7 +2675,7 @@ _elm_scroll_momentum_calc(int dx, int dy, double dt, double *vx, double *vy, int
double r = _elm_config->thumbscroll_momentum_friction;
const int min_px = 3;
if ( dt == 0 ) return EINA_FALSE;
if (EINA_DBL_EQ(dt, 0)) return EINA_FALSE;
// store sign value of distance
sign_dx = (dx > 0) - (dx < 0);
@ -3749,7 +3749,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
else
vy = 1.0;
}
if ((vx != 0.0) || (vy != 0.0))
if (EINA_DBL_NONZERO(vx) || EINA_DBL_NONZERO(vy))
{
sid->down.onhold_vx = vx;
sid->down.onhold_vy = vy;

View File

@ -4331,7 +4331,7 @@ _elm_map_efl_ui_zoom_zoom_level_set(Eo *obj, Elm_Map_Data *sd, double zoom)
if (sd->mode != EFL_UI_ZOOM_MODE_MANUAL) return;
if (zoom < 0) zoom = 0;
if (sd->zoom == zoom) return;
if (EINA_DBL_EQ(sd->zoom, zoom)) return;
sd->calc_job.zoom = zoom;
sd->calc_job.zoom_mode_set = _zoom_mode_set;

View File

@ -32,29 +32,29 @@ _notify_theme_apply(Evas_Object *obj)
ax = sd->horizontal_align;
ay = sd->vertical_align;
if (ay == 0.0)
if (EINA_DBL_EQ(ay, 0.0))
{
if (ax == 0.0)
if (EINA_DBL_EQ(ax, 0.0))
position = "top_left";
else if (ax == 1.0)
else if (EINA_DBL_EQ(ax, 1.0))
position = "top_right";
else
position = "top";
}
else if (ay == 1.0)
else if (EINA_DBL_EQ(ay, 1.0))
{
if (ax == 0.0)
if (EINA_DBL_EQ(ax, 0.0))
position = "bottom_left";
else if (ax == 1.0)
else if (EINA_DBL_EQ(ax, 1.0))
position = "bottom_right";
else
position = "bottom";
}
else
{
if (ax == 0.0)
if (EINA_DBL_EQ(ax, 0.0))
position = "left";
else if (ax == 1.0)
else if (EINA_DBL_EQ(ax, 1.0))
position = "right";
else
position = "center";
@ -88,10 +88,10 @@ _notify_move_to_orientation(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_C
ax = sd->horizontal_align;
ay = sd->vertical_align;
if ((efl_ui_mirrored_get(obj)) && (ax != ELM_NOTIFY_ALIGN_FILL)) ax = 1.0 - ax;
if ((efl_ui_mirrored_get(obj)) && (!EINA_DBL_EQ(ax, ELM_NOTIFY_ALIGN_FILL))) ax = 1.0 - ax;
if (ax == ELM_NOTIFY_ALIGN_FILL) minw = w;
if (ay == ELM_NOTIFY_ALIGN_FILL) minh = h;
if (EINA_DBL_EQ(ax, ELM_NOTIFY_ALIGN_FILL)) minw = w;
if (EINA_DBL_EQ(ay, ELM_NOTIFY_ALIGN_FILL)) minh = h;
x = x + ((w - minw) * ax);
y = y + ((h - minh) * ay);
@ -609,23 +609,23 @@ elm_notify_orient_get(const Evas_Object *obj)
elm_notify_align_get(obj, &horizontal, &vertical);
if ((horizontal == 0.5) && (vertical == 0.0))
if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 0.0))
orient = ELM_NOTIFY_ORIENT_TOP;
else if ((horizontal == 0.5) && (vertical == 0.5))
else if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 0.5))
orient = ELM_NOTIFY_ORIENT_CENTER;
else if ((horizontal == 0.5) && (vertical == 1.0))
else if (EINA_DBL_EQ(horizontal, 0.5) && EINA_DBL_EQ(vertical, 1.0))
orient = ELM_NOTIFY_ORIENT_BOTTOM;
else if ((horizontal == 0.0) && (vertical == 0.5))
else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 0.5))
orient = ELM_NOTIFY_ORIENT_LEFT;
else if ((horizontal == 1.0) && (vertical == 0.5))
else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 0.5))
orient = ELM_NOTIFY_ORIENT_RIGHT;
else if ((horizontal == 0.0) && (vertical == 0.0))
else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 0.0))
orient = ELM_NOTIFY_ORIENT_TOP_LEFT;
else if ((horizontal == 1.0) && (vertical == 0.0))
else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 0.0))
orient = ELM_NOTIFY_ORIENT_TOP_RIGHT;
else if ((horizontal == 0.0) && (vertical == 1.0))
else if (EINA_DBL_EQ(horizontal, 0.0) && EINA_DBL_EQ(vertical, 1.0))
orient = ELM_NOTIFY_ORIENT_BOTTOM_LEFT;
else if ((horizontal == 1.0) && (vertical == 1.0))
else if (EINA_DBL_EQ(horizontal, 1.0) && EINA_DBL_EQ(vertical, 1.0))
orient = ELM_NOTIFY_ORIENT_BOTTOM_RIGHT;
else
orient = ELM_NOTIFY_ORIENT_TOP;

View File

@ -1501,7 +1501,7 @@ elm_slider_step_set(Evas_Object *obj, double step)
ERR("Wrong param. The step(%lf) should be greater than 0.0", step);
return;
}
if (sd->step == step) return;
if (EINA_DBL_EQ(sd->step, step)) return;
sd->step = step;
}

View File

@ -63,7 +63,7 @@ _key_action_pause(Evas_Object *obj, const char *params EINA_UNUSED)
{
ELM_SLIDESHOW_DATA_GET(obj, sd);
if (sd->timeout)
if (EINA_DBL_NONZERO(sd->timeout))
{
if (sd->timer)
ELM_SAFE_FREE(sd->timer, ecore_timer_del);

View File

@ -134,7 +134,7 @@ _entry_show(Elm_Spinner_Data *sd)
EINA_LIST_FOREACH(sd->special_values, l, sv)
{
if (sv->value == sd->val)
if (EINA_DBL_EQ(sv->value, sd->val))
{
snprintf(buf, sizeof(buf), "%s", sv->label);
goto apply;
@ -196,7 +196,7 @@ _label_write(Evas_Object *obj)
EINA_LIST_FOREACH(sd->special_values, l, sv)
{
if (sv->value == sd->val)
if (EINA_DBL_EQ(sv->value, sd->val))
{
snprintf(buf, sizeof(buf), "%s", sv->label);
goto apply;
@ -245,7 +245,7 @@ _value_set(Evas_Object *obj,
if (sd->round > 0)
{
//Spin value changed by entry input.
if (changed != 0)
if (EINA_DBL_NONZERO(changed))
new_val = sd->val_base +
(double)((((int)((val + changed) - sd->val_base)) / sd->round) * sd->round);
else
@ -270,12 +270,12 @@ _value_set(Evas_Object *obj,
new_val = sd->val_max;
}
if (new_val == sd->val) return EINA_FALSE;
if (EINA_DBL_EQ(new_val, sd->val)) return EINA_FALSE;
sd->val = new_val;
if (sd->val == sd->val_min)
if (EINA_DBL_EQ(sd->val, sd->val_min))
efl_event_callback_legacy_call(obj, ELM_SPINNER_EVENT_MIN_REACHED, NULL);
else if (sd->val == sd->val_max)
else if (EINA_DBL_EQ(sd->val, sd->val_max))
efl_event_callback_legacy_call(obj, ELM_SPINNER_EVENT_MAX_REACHED, NULL);
efl_event_callback_legacy_call(obj, ELM_SPINNER_EVENT_CHANGED, NULL);
@ -334,7 +334,7 @@ _drag_cb(void *data,
else
efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable.slider"), &pos, NULL);
if (sd->drag_prev_pos != 0)
if (EINA_DBL_NONZERO(sd->drag_prev_pos))
sd->drag_val_step = pow((pos - sd->drag_prev_pos), 2);
else
sd->drag_val_step = 1;
@ -688,7 +688,7 @@ _spin_value(void *data)
double real_speed = sd->spin_speed;
/* Sanity check: our step size should be at least as large as our rounding value */
if ((sd->spin_speed != 0.0) && (fabs(sd->spin_speed) < sd->round))
if (EINA_DBL_NONZERO(sd->spin_speed) && (fabs(sd->spin_speed) < sd->round))
{
WRN("The spinning step is smaller than the rounding value, please check your code");
real_speed = sd->spin_speed > 0 ? sd->round : -sd->round;
@ -800,11 +800,11 @@ _button_inc_dec_start_cb(void *data,
{
if (sd->inc_btn_activated)
{
if (sd->val == sd->val_min) return;
if (EINA_DBL_EQ(sd->val, sd->val_min)) return;
}
else
{
if (sd->val == sd->val_max) return;
if (EINA_DBL_EQ(sd->val, sd->val_max)) return;
}
}
}
@ -1438,7 +1438,7 @@ _elm_spinner_label_format_get(const Eo *obj EINA_UNUSED, Elm_Spinner_Data *sd)
EOLIAN static void
_elm_spinner_efl_ui_range_display_range_limits_set(Eo *obj, Elm_Spinner_Data *sd, double min, double max)
{
if ((sd->val_min == min) && (sd->val_max == max)) return;
if (EINA_DBL_EQ(sd->val_min, min) && EINA_DBL_EQ(sd->val_max, max)) return;
sd->val_min = min;
sd->val_max = max;
@ -1472,7 +1472,7 @@ _elm_spinner_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNUSED,
EOLIAN static void
_elm_spinner_efl_ui_range_display_range_value_set(Eo *obj, Elm_Spinner_Data *sd, double val)
{
if (sd->val == val) return;
if (EINA_DBL_EQ(sd->val, val)) return;
sd->val = (sd->round <= 0) ? val : sd->val_base +
(double)((((int)(val - sd->val_base + (sd->round / 2))) / sd->round) * sd->round);
@ -1520,7 +1520,7 @@ _elm_spinner_special_value_add(Eo *obj, Elm_Spinner_Data *sd, double value, cons
EINA_LIST_FOREACH(sd->special_values, l, sv)
{
if (sv->value != value)
if (!EINA_DBL_EQ(sv->value, value))
continue;
eina_stringshare_replace(&sv->label, label);
@ -1549,7 +1549,7 @@ elm_spinner_special_value_del(Evas_Object *obj,
EINA_LIST_FOREACH(sd->special_values, l, sv)
{
if (sv->value != value)
if (!EINA_DBL_EQ(sv->value, value))
continue;
sd->special_values = eina_list_remove_list(sd->special_values, l);
@ -1572,7 +1572,7 @@ elm_spinner_special_value_get(Evas_Object *obj,
EINA_LIST_FOREACH(sd->special_values, l, sv)
{
if (sv->value == value)
if (EINA_DBL_EQ(sv->value, value))
return sv->label;
}

View File

@ -3498,12 +3498,12 @@ _elm_toolbar_align_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, double align)
{
if (!efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE))
{
if (sd->align != align)
if (!EINA_DBL_EQ(sd->align, align))
evas_object_box_align_set(sd->bx, 0.5, align);
}
else
{
if (sd->align != align)
if (!EINA_DBL_EQ(sd->align, align))
evas_object_box_align_set(sd->bx, align, 0.5);
}
sd->align = align;

View File

@ -346,7 +346,7 @@ _transit_animate_cb(void *data)
duration = transit->time.duration;
transit->progress = elapsed_time / duration;
if (transit->revert_mode && transit->revert_begin_progress == 0)
if (transit->revert_mode && EINA_DBL_EQ(transit->revert_begin_progress, 0))
{
transit->revert_begin_progress = transit->progress;
transit->time.revert_start = transit->time.current;
@ -932,14 +932,14 @@ elm_transit_paused_set(Elm_Transit *transit, Eina_Bool paused)
{
if (transit->revert_mode)
{
if (transit->time.revert_paused == 0) return;
if (EINA_DBL_EQ(transit->time.revert_paused, 0)) return;
ecore_animator_thaw(transit->animator);
transit->time.revert_delayed += (ecore_loop_time_get() - transit->time.revert_paused);
transit->time.revert_paused = 0;
}
else
{
if (transit->time.paused == 0) return;
if (EINA_DBL_EQ(transit->time.paused, 0)) return;
ecore_animator_thaw(transit->animator);
transit->time.delayed += (ecore_loop_time_get() - transit->time.paused);
transit->time.paused = 0;
@ -952,7 +952,7 @@ elm_transit_paused_get(const Elm_Transit *transit)
{
ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
if (transit->time.paused == 0)
if (EINA_DBL_EQ(transit->time.paused, 0))
return EINA_FALSE;
return EINA_TRUE;

View File

@ -395,7 +395,7 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal
}
count = eina_list_count(priv->children);
if (!expand)
if (EINA_DBL_EQ(expand, 0))
{
if (rtl) ax = 1.0 - ax;
if (horizontal)
@ -435,8 +435,8 @@ _els_box_layout(Evas_Object *o, Evas_Object_Box_Data *priv, Eina_Bool horizontal
fw = fh = 0;
xw = xh = 0;
/* align(-1) means fill to maximum apportioned size */
if (ax == -1.0) {fw = 1; ax = 0.5;}
if (ay == -1.0) {fh = 1; ay = 0.5;}
if (EINA_DBL_EQ(ax, -1.0)) {fw = 1; ax = 0.5;}
if (EINA_DBL_EQ(ay, -1.0)) {fh = 1; ay = 0.5;}
if (rtl) ax = 1.0 - ax;
if (wx > 0.0) xw = 1;
if (wy > 0.0) xh = 1;

View File

@ -385,7 +385,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt,
{
dx = -mx;
mx = -(px / 2);
if (tt->rel_pos.x == 0.5)
if (EINA_DBL_EQ(tt->rel_pos.x, 0.5))
{
tt->rel_pos.x = 0.5 - dx / (double)tcw;
if (tt->rel_pos.x < 0.0) tt->rel_pos.x = 0.0;
@ -395,7 +395,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt,
{
dx = mx + tw - cw;
mx = cw - tw + px / 2;
if (tt->rel_pos.x == 0.5)
if (EINA_DBL_EQ(tt->rel_pos.x, 0.5))
{
tt->rel_pos.x = 0.5 + dx / (double)tcw;
if (tt->rel_pos.x > 1.0) tt->rel_pos.x = 1.0;
@ -406,7 +406,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt,
{
dy = -my;
my = -(py / 2);
if (tt->rel_pos.y == 0.5)
if (EINA_DBL_EQ(tt->rel_pos.y, 0.5))
{
tt->rel_pos.y = 0.5 - dy / (double)tch;
if (tt->rel_pos.y < 0.0) tt->rel_pos.y = 0.0;
@ -416,7 +416,7 @@ _elm_tooltip_reconfigure_orient(Elm_Tooltip *tt,
{
dy = my + th - ch;
my = ch - th + py / 2;
if (tt->rel_pos.y == 0.5)
if (EINA_DBL_EQ(tt->rel_pos.y, 0.5))
{
tt->rel_pos.y = 0.5 + dy / (double)tch;
if (tt->rel_pos.y > 1.0) tt->rel_pos.y = 1.0;