From fd6b264b1d726a3109332e0ca3a649f52d177d95 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 6 Dec 2016 11:23:19 -0500 Subject: [PATCH] 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 --- src/modules/ibar/e_mod_main.c | 44 ++++++++++++++--------------------- src/modules/ibox/e_mod_main.c | 40 +++++++++++++------------------ 2 files changed, 34 insertions(+), 50 deletions(-) diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 81710905c..6ecbe1495 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -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); diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c index 254bd6218..df755d7a6 100644 --- a/src/modules/ibox/e_mod_main.c +++ b/src/modules/ibox/e_mod_main.c @@ -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);