maintain "empty" object's size hints when ibar/ibox resizes

the sizing issue in all of these tickets was caused by the "empty" object
being deleted, thus allowing the box to reset to 0x0 size hints and
returning this value as the overall size during recalc; the result is that
all icons would be sized at 0x0 instead of using the preserved orient size
as expected

fix T4509, T4647, T4830, T4733, T4524
This commit is contained in:
Mike Blumenkrantz 2016-12-06 11:23:19 -05:00
parent 3b1242e314
commit fd6b264b1d
2 changed files with 34 additions and 50 deletions

View File

@ -511,34 +511,19 @@ _ibar_cb_empty_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
static void
_ibar_empty_handle(IBar *b)
{
if (!b->icons)
if (!b->o_empty)
{
if (!b->o_empty)
{
Evas_Coord w, h;
b->o_empty = evas_object_rectangle_add(evas_object_evas_get(b->o_box));
E_EXPAND(b->o_empty);
E_FILL(b->o_empty);
evas_object_event_callback_add(b->o_empty,
EVAS_CALLBACK_MOUSE_DOWN,
_ibar_cb_empty_mouse_down, b);
evas_object_color_set(b->o_empty, 0, 0, 0, 0);
evas_object_show(b->o_empty);
elm_box_pack_end(b->o_box, b->o_empty);
evas_object_geometry_get(b->o_box, NULL, NULL, &w, &h);
if (elm_box_horizontal_get(b->o_box))
w = h;
else
h = w;
evas_object_size_hint_min_set(b->o_empty, w, h);
}
}
else if (b->o_empty)
{
evas_object_del(b->o_empty);
b->o_empty = NULL;
b->o_empty = evas_object_rectangle_add(evas_object_evas_get(b->o_box));
E_EXPAND(b->o_empty);
E_FILL(b->o_empty);
evas_object_event_callback_add(b->o_empty,
EVAS_CALLBACK_MOUSE_DOWN,
_ibar_cb_empty_mouse_down, b);
evas_object_color_set(b->o_empty, 0, 0, 0, 0);
}
if (b->icons) return;
evas_object_show(b->o_empty);
elm_box_pack_end(b->o_box, b->o_empty);
}
static void
@ -655,6 +640,13 @@ _ibar_resize_handle(IBar *b)
w = h;
else
h = w;
if (w || h)
evas_object_size_hint_min_set(b->o_empty, w, h);
if (b->icons && evas_object_visible_get(b->o_empty))
{
elm_box_unpack(b->o_box, b->o_empty);
evas_object_hide(b->o_empty);
}
EINA_INLIST_FOREACH(b->icons, ic)
{
evas_object_size_hint_min_set(ic->o_holder, w, h);

View File

@ -372,32 +372,17 @@ _ibox_cb_empty_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
static void
_ibox_empty_handle(IBox *b)
{
if (!b->icons)
if (!b->o_empty)
{
if (!b->o_empty)
{
Evas_Coord w, h;
b->o_empty = evas_object_rectangle_add(evas_object_evas_get(b->o_box));
evas_object_event_callback_add(b->o_empty, EVAS_CALLBACK_MOUSE_DOWN, _ibox_cb_empty_mouse_down, b);
evas_object_color_set(b->o_empty, 0, 0, 0, 0);
evas_object_show(b->o_empty);
elm_box_pack_end(b->o_box, b->o_empty);
evas_object_geometry_get(b->o_box, NULL, NULL, &w, &h);
if (elm_box_horizontal_get(b->o_box))
w = h;
else
h = w;
E_EXPAND(b->o_empty);
E_FILL(b->o_empty);
evas_object_size_hint_min_set(b->o_empty, w, h);
}
}
else if (b->o_empty)
{
evas_object_del(b->o_empty);
b->o_empty = NULL;
b->o_empty = evas_object_rectangle_add(evas_object_evas_get(b->o_box));
evas_object_event_callback_add(b->o_empty, EVAS_CALLBACK_MOUSE_DOWN, _ibox_cb_empty_mouse_down, b);
evas_object_color_set(b->o_empty, 0, 0, 0, 0);
E_EXPAND(b->o_empty);
E_FILL(b->o_empty);
}
if (b->icons) return;
evas_object_show(b->o_empty);
elm_box_pack_end(b->o_box, b->o_empty);
}
static void
@ -480,6 +465,13 @@ _ibox_resize_handle(IBox *b)
w = h;
else
h = w;
if (w || h)
evas_object_size_hint_min_set(b->o_empty, w, h);
if (b->icons && evas_object_visible_get(b->o_empty))
{
elm_box_unpack(b->o_box, b->o_empty);
evas_object_hide(b->o_empty);
}
EINA_LIST_FOREACH(b->icons, l, ic)
{
evas_object_size_hint_min_set(ic->o_holder, w, h);