From d066020beaf77eb5ef146230b8ff35cf2e5a9b9d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 11 Dec 2015 16:17:57 -0500 Subject: [PATCH] use current box geometry for calculating desktop ibar/ibox sizing desktop gadgets don't have minimum size set from parent objects, so it's necessary to use the current object geometry in order to correctly size these gadgets since the top-most widget is from elm fix T2907 --- src/modules/ibar/e_mod_main.c | 21 +++++++++++---------- src/modules/ibox/e_mod_main.c | 8 +++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 4980fe37e..4a8a9a7a1 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -268,7 +268,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) ci = _ibar_config_item_get(id); inst->ci = ci; if (!ci->dir) ci->dir = eina_stringshare_add("default"); - b = _ibar_new(gc->o_container, inst); + b = _ibar_new(gc->o_container ?: e_comp->elm, inst); gcc = e_gadcon_client_new(gc, name, id, style, b->o_outerbox); e_gadcon_client_autoscroll_toggle_disabled_set(gcc, !ci->dont_add_nonorder); gcc->data = inst; @@ -287,6 +287,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) evas_object_event_callback_add(b->o_outerbox, EVAS_CALLBACK_RESIZE, _ibar_cb_obj_moveresize, inst); ibar_config->instances = eina_list_append(ibar_config->instances, inst); + _ibar_resize_handle(b); inst->iconify_provider = e_comp_object_effect_mover_add(80, "e,action,*iconify", _ibar_cb_iconify_provider, inst); return gcc; } @@ -638,16 +639,17 @@ _ibar_resize_handle(IBar *b) IBar_Icon *ic; Evas_Coord w, h; + if (!b->inst->gcc) return; elm_box_recalculate(b->o_box); elm_box_recalculate(b->o_outerbox); - evas_object_size_hint_min_get(b->o_outerbox, &w, &h); - if (b->inst->gcc) - { - if (b->inst->gcc->max.w) - w = MIN(w, b->inst->gcc->max.w); - if (b->inst->gcc->max.h) - h = MIN(h, b->inst->gcc->max.h); - } + if (!e_gadcon_site_is_desktop(b->inst->gcc->gadcon->location->site)) + evas_object_size_hint_min_get(b->o_outerbox, &w, &h); + else + evas_object_geometry_get(b->o_outerbox, NULL, NULL, &w, &h); + if (b->inst->gcc->max.w) + w = MIN(w, b->inst->gcc->max.w); + if (b->inst->gcc->max.h) + h = MIN(h, b->inst->gcc->max.h); if (elm_box_horizontal_get(b->o_box)) w = h; else @@ -666,7 +668,6 @@ _ibar_resize_handle(IBar *b) evas_object_size_hint_min_set(b->o_sep, 8, 8); evas_object_size_hint_max_set(b->o_sep, w, h); } - if (!b->inst->gcc) return; elm_box_recalculate(b->o_box); elm_box_recalculate(b->o_outerbox); evas_object_size_hint_min_get(b->o_outerbox, &w, &h); diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c index 3a09bb87e..254bd6218 100644 --- a/src/modules/ibox/e_mod_main.c +++ b/src/modules/ibox/e_mod_main.c @@ -184,7 +184,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) ci = _ibox_config_item_get(id); inst->ci = ci; - b = _ibox_new(gc->o_container, gc->zone); + b = _ibox_new(gc->o_container ?: e_comp->elm, gc->zone); b->inst = inst; inst->ibox = b; o = b->o_box; @@ -448,6 +448,8 @@ _ibox_fill(IBox *b) if (!e_gadcon_site_is_desktop(b->inst->gcc->gadcon->location->site)) return; elm_box_recalculate(b->o_box); evas_object_size_hint_min_get(b->o_box, &mw, &mh); + if ((!mw) && (!mh)) + evas_object_geometry_get(b->o_box, NULL, NULL, &mw, &mh); evas_object_geometry_get(b->inst->gcc->o_frame, NULL, NULL, NULL, &h); evas_object_resize(b->inst->gcc->o_frame, MIN(mw, b->inst->gcc->gadcon->zone->w), MAX(h, mh)); } @@ -1111,6 +1113,8 @@ _ibox_cb_event_client_iconify(void *data EINA_UNUSED, int type EINA_UNUSED, void if (!e_gadcon_site_is_desktop(b->inst->gcc->gadcon->location->site)) continue; elm_box_recalculate(b->o_box); evas_object_size_hint_min_get(b->o_box, &mw, &mh); + if ((!mw) && (!mh)) + evas_object_geometry_get(b->o_box, NULL, NULL, &mw, &mh); evas_object_geometry_get(b->inst->gcc->o_frame, NULL, NULL, NULL, &h); evas_object_resize(b->inst->gcc->o_frame, MIN(mw, b->inst->gcc->gadcon->zone->w), MAX(h, mh)); } @@ -1143,6 +1147,8 @@ _ibox_cb_event_client_uniconify(void *data EINA_UNUSED, int type EINA_UNUSED, vo if (!e_gadcon_site_is_desktop(b->inst->gcc->gadcon->location->site)) continue; elm_box_recalculate(b->o_box); evas_object_size_hint_min_get(b->o_box, &mw, &mh); + if ((!mw) && (!mh)) + evas_object_geometry_get(b->o_box, NULL, NULL, &mw, &mh); evas_object_geometry_get(b->inst->gcc->o_frame, NULL, NULL, NULL, &h); evas_object_resize(b->inst->gcc->o_frame, MIN(mw, b->inst->gcc->gadcon->zone->w), MAX(h, mh)); }