From: Jean-Philippe Andre Date: Fri, 30 Jun 2017 08:26:16 +0000 (+0900) Subject: win: Fix some sizing issues with main menu X-Git-Tag: upstream/1.20.0~361 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4488c51c5fb8d2a5e06bbfdfe622af11bc78c296;p=platform%2Fupstream%2Fefl.git 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 --- diff --git a/src/bin/elementary/test_main_menu.c b/src/bin/elementary/test_main_menu.c index 507a138..40a52c5 100644 --- a/src/bin/elementary/test_main_menu.c +++ b/src/bin/elementary/test_main_menu.c @@ -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); diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index a87985f..f7b20b8 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -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); }