ibar: try to get a better min size

There are two cases, on a shelf and on the desktop.
If on a shelf we are using the height setting of the self, since max.w
max.h are only set after a few calcuations, and the gadget does not get
moved on a shelf which does not fade out, so the first min size
calculation must be correct.
If we are on the desktop max.w and max.h are not always 0.
There were some cases when none of this conditions are met. So this
patch enforces a mimum size of 40x40 pixels.
This commit is contained in:
Marcel Hollerbach 2016-09-01 21:49:31 +02:00
parent d98c24bbab
commit 50030dc693
1 changed files with 20 additions and 4 deletions

View File

@ -638,12 +638,28 @@ static void
_ibar_resize_handle(IBar *b)
{
IBar_Icon *ic;
Evas_Coord w, h, ww, hh;
Evas_Coord w, h, w2, h2, ww = 0, hh = 0;
int max_w, max_h;
if (!b->inst->gcc) return;
evas_object_geometry_get(b->o_outerbox, NULL, NULL, &ww, &hh);
if (b->inst->gcc->max.w) ww = MIN(ww, b->inst->gcc->max.w);
if (b->inst->gcc->max.h) hh = MIN(hh, b->inst->gcc->max.h);
if (b->inst->gcc->gadcon->shelf)
{
/* we are in a shelf */
ww = hh = b->inst->gcc->gadcon->shelf->cfg->size;
}
else if (b->inst->gcc->max.w || b->inst->gcc->max.h)
{
evas_object_geometry_get(b->o_outerbox, NULL, NULL, &ww, &hh);
ww = MIN(b->inst->gcc->max.w, ww);
hh = MIN(b->inst->gcc->max.h, hh);
}
/* Fallback to a size for the case noone gives a max size and no shelf config is there */
if (ww == 0) ww = 40;
if (hh == 0) hh = 40;
if (elm_box_horizontal_get(b->o_box)) ww = hh;
else hh = ww;
EINA_INLIST_FOREACH(b->icons, ic)