From 521f41f536efcd5e269dcc4279d88348173933e2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 18 Jul 2017 14:35:40 +0900 Subject: [PATCH] win: Fix main menu when not in framespace On OSX the framespace and CSD (Client-Side Decorations) are not supported at all... I am not able to test this case. This patch restores the main menu functionality based on pre 1.19 themes, where it was located inside win.edc (app content) and not in border.edc (framespace). Note that the initial size of a window may be wrong, eg as in elementary_test -to "Main Menu" Fixes T5734 (hopefully!) --- data/elementary/themes/edc/elm/win.edc | 22 ++++++++++++++++++++-- src/lib/elementary/efl_ui_win.c | 26 +++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/data/elementary/themes/edc/elm/win.edc b/data/elementary/themes/edc/elm/win.edc index a9c98a0bfa..9999cabb49 100644 --- a/data/elementary/themes/edc/elm/win.edc +++ b/data/elementary/themes/edc/elm/win.edc @@ -1,13 +1,31 @@ group { name: "elm/win/base/default"; data.item: "version" "119"; parts { - rect { "client_clip"; nomouse; + rect { "client_clip"; nomouse; } + swallow { "elm.swallow.menu"; + clip_to: "client_clip"; desc { "default"; - rel.to: "elm.swallow.contents"; + rel2.relative: 1 0; + link.base: "elm,action,hide" "elm"; + align: 0.5 0.0; + hid; + } + desc { "visible"; + inherit: "default"; + link.base: "elm,action,show_menu" "elm"; + fixed: 0 1; + vis; } } swallow { "elm.swallow.contents"; clip_to: "client_clip"; + desc { "default"; + } + desc { "with_menu"; + rel1.to: "elm.swallow.menu"; + rel1.relative: 0 1; + link.base: "elm,action,show_menu" "elm"; + } } } } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index c7cfa7f67d..47c85ef2b4 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5659,7 +5659,19 @@ _efl_ui_win_fullscreen_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) static inline Eo * _main_menu_swallow_get(Efl_Ui_Win_Data *sd) { - if (edje_object_part_exists(sd->legacy.edje, "elm.swallow.menu")) + Eina_Bool legacy_menu_swallow = EINA_TRUE; + const char *data; + int version; + + data = edje_object_data_get(sd->legacy.edje, "version"); + version = data ? atoi(data) : 0; + if (version >= 119) legacy_menu_swallow = EINA_FALSE; + +#ifdef HAVE_ELEMENTARY_COCOA + if (sd->cocoa.win) legacy_menu_swallow = EINA_TRUE; +#endif + + if (legacy_menu_swallow) { DBG("Detected legacy theme, using legacy swallows."); return sd->legacy.edje; @@ -5688,6 +5700,13 @@ _dbus_menu_set(Eina_Bool dbus_connect, void *data) sd->csd.need_menu = EINA_FALSE; _elm_menu_menu_bar_hide(sd->main_menu); _elm_win_resize_objects_eval(sd->obj, EINA_FALSE); + if (swallow != sd->frame_obj) + { + // Note: Based on EFL 1.18 the signal was "elm,action,hide" + // and not "elm,action,hide_menu" as expected. + edje_object_signal_emit(swallow, "elm,action,hide", "elm"); + edje_object_message_signal_recursive_process(swallow); + } } else { @@ -5700,6 +5719,11 @@ _dbus_menu_set(Eina_Bool dbus_connect, void *data) efl_canvas_object_is_frame_object_set(sd->main_menu, EINA_TRUE); sd->csd.need_menu = EINA_TRUE; } + else + { + edje_object_signal_emit(swallow, "elm,action,show_menu", "elm"); + edje_object_message_signal_recursive_process(swallow); + } } _elm_win_frame_style_update(sd, 0, 1); //sd->deferred_resize_job = EINA_TRUE;