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
This commit is contained in:
Mike Blumenkrantz 2015-12-11 16:17:57 -05:00
parent 41daddeacc
commit 6831544d71
2 changed files with 18 additions and 11 deletions

View File

@ -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);

View File

@ -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));
}