win: Fix some sizing issues with main menu

This should fix issues when the main menu is wider than the
window content. This assumes that the menu is horizontal and
aligned with the client content.

The theme should probably handle this case better but right
now I am lost in the spaghetti resizes happening between
edje, elm, evas and X...

I am not very happy with this patch, and I think border.edc
needs some love in order to make it more robust and simpler
to read.

Ref T5482
This commit is contained in:
Jean-Philippe Andre 2017-06-30 17:26:16 +09:00
parent 722725dfc5
commit 4488c51c5f
2 changed files with 9 additions and 4 deletions

View File

@ -35,8 +35,9 @@ test_main_menu(void *data EINA_UNUSED,
label = elm_label_add(win);
elm_object_text_set(label, "Note: the D-Bus menu example requires support from the "
"desktop environment to display the application menu");
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_label_line_wrap_set(label, ELM_WRAP_WORD);
elm_box_pack_end(bx, label);
evas_object_show(label);

View File

@ -7962,12 +7962,16 @@ _window_layout_stack(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
const Eina_List *l;
Evas_Object *child;
Evas_Object_Box_Option *opt;
Evas_Coord x, y, w, h;
Evas_Coord x, y, w, h, menuw = 0;
double wx, wy;
Evas_Coord minw = -1, minh = -1;
double weight_x = EVAS_HINT_EXPAND;
double weight_y = EVAS_HINT_EXPAND;
ELM_WIN_DATA_GET(data, sd);
if (sd->main_menu && efl_gfx_visible_get(sd->main_menu))
efl_gfx_size_hint_combined_min_get(sd->main_menu, &menuw, NULL);
EINA_LIST_FOREACH(p->children, l, opt)
{
child = opt->obj;
@ -7980,6 +7984,7 @@ _window_layout_stack(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
if (h > minh) minh = h;
}
if (minw < menuw) minw = menuw;
efl_gfx_size_hint_restricted_min_set(o, minw, minh);
evas_object_geometry_get(o, &x, &y, &w, &h);
if (w < minw) w = minw;
@ -7993,7 +7998,6 @@ _window_layout_stack(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
evas_object_resize(child, w, h);
}
ELM_WIN_DATA_GET(data, sd);
efl_gfx_size_hint_weight_set(sd->legacy.edje, weight_x, weight_y);
evas_object_smart_changed(sd->legacy.edje);
}