forked from enlightenment/efl
eina: add comparison macros for Eina_Size2D and Eina_Position2D
Summary: I'm tired of typing all this out. it's exhausting. also add a couple usages internally to verify that this works as expected @feature Reviewers: cedric, bu5hm4n, devilhorns Reviewed By: devilhorns Subscribers: devilhorns, bu5hm4n, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10557
This commit is contained in:
parent
400e139efa
commit
f4019d3303
|
@ -62,6 +62,27 @@ typedef struct _Eina_Size2D
|
|||
int w, h;
|
||||
} Eina_Size2D;
|
||||
|
||||
|
||||
/**
|
||||
* @brief convenience macro for comparing two Eina_Size2D structs
|
||||
* @param[in] a An Eina_Size2D
|
||||
* @param[in] b An Eina_Size2D
|
||||
* @return 1 if the structs are equal, 0 if they are not
|
||||
* @since 1.24
|
||||
*/
|
||||
#define EINA_SIZE2D_EQ(a, b) \
|
||||
(((a).w == (b).w) && ((a).h == (b).h))
|
||||
|
||||
/**
|
||||
* @brief convenience macro for comparing two Eina_Position2D structs
|
||||
* @param[in] a An Eina_Position2D
|
||||
* @param[in] b An Eina_Position2D
|
||||
* @return 1 if the structs are equal, 0 if they are not
|
||||
* @since 1.24
|
||||
*/
|
||||
#define EINA_POSITION2D_EQ(a, b) \
|
||||
(((a).x == (b).x) && ((a).y == (b).y))
|
||||
|
||||
/**
|
||||
* @typedef Eina_Rectangle
|
||||
* Simple rectangle structure.
|
||||
|
|
|
@ -1471,7 +1471,7 @@ _efl_canvas_object_efl_gfx_hint_hint_size_restricted_max_set(Eo *eo_obj, Evas_Ob
|
|||
if (!sz.w && !sz.h) return;
|
||||
_evas_object_size_hint_alloc(eo_obj, obj);
|
||||
}
|
||||
if ((obj->size_hints->max.w == sz.w) && (obj->size_hints->max.h == sz.h)) return;
|
||||
if (EINA_SIZE2D_EQ(obj->size_hints->max, sz)) return;
|
||||
obj->size_hints->max = sz;
|
||||
if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->min.w))
|
||||
ERR("restricted max width hint is now smaller than restricted min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->min.w);
|
||||
|
@ -1502,7 +1502,7 @@ _efl_canvas_object_efl_gfx_hint_hint_size_restricted_min_set(Eo *eo_obj, Evas_Ob
|
|||
if (!sz.w && !sz.h) return;
|
||||
_evas_object_size_hint_alloc(eo_obj, obj);
|
||||
}
|
||||
if ((obj->size_hints->min.w == sz.w) && (obj->size_hints->min.h == sz.h)) return;
|
||||
if (EINA_SIZE2D_EQ(obj->size_hints->min, sz)) return;
|
||||
obj->size_hints->min = sz;
|
||||
if ((obj->size_hints->max.w != -1) && (obj->size_hints->max.w < obj->size_hints->min.w))
|
||||
ERR("restricted max width hint is now smaller than restricted min width hint! (%d < %d)", obj->size_hints->max.w, obj->size_hints->min.w);
|
||||
|
@ -1588,7 +1588,7 @@ _efl_canvas_object_efl_gfx_hint_hint_size_max_set(Eo *eo_obj, Evas_Object_Protec
|
|||
if ((sz.w == -1) && (sz.h == -1)) return;
|
||||
_evas_object_size_hint_alloc(eo_obj, obj);
|
||||
}
|
||||
if ((obj->size_hints->user_max.w == sz.w) && (obj->size_hints->user_max.h == sz.h)) return;
|
||||
if (EINA_SIZE2D_EQ(obj->size_hints->user_max, sz)) return;
|
||||
obj->size_hints->user_max.w = sz.w;
|
||||
obj->size_hints->user_max.h = sz.h;
|
||||
|
||||
|
@ -1652,7 +1652,7 @@ _efl_canvas_object_efl_gfx_hint_hint_size_min_set(Eo *eo_obj, Evas_Object_Protec
|
|||
if (!sz.w && !sz.h) return;
|
||||
_evas_object_size_hint_alloc(eo_obj, obj);
|
||||
}
|
||||
if ((obj->size_hints->user_min.w == sz.w) && (obj->size_hints->user_min.h == sz.h)) return;
|
||||
if (EINA_SIZE2D_EQ(obj->size_hints->user_min, sz)) return;
|
||||
obj->size_hints->user_min = sz;
|
||||
evas_object_inform_call_changed_size_hints(eo_obj, obj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue