Revert "win: Move main menu back to win.edc (fix sizing)"

This reverts commit 8a21384759.
The following commit will reintroduce the menu slot inside the
border edc.
This commit is contained in:
Jean-Philippe Andre 2016-11-28 17:24:18 +09:00
parent f927169a10
commit c7f2308e6c
3 changed files with 62 additions and 50 deletions

View File

@ -1,12 +1,10 @@
/* Window client-side decorations and extra slots
* Includes swallows for:
* - app content
* - main menu
* - indicator
* - soft key
* - virtual keyboard
*
* Not included:
* - main menu (sizing issues - needs rework of the menu itself)
*/
group { name: "elm/border/base/default";
@ -93,11 +91,34 @@ group { name: "elm/border/base/default";
required; // @since 1.19
clip: "client_clip";
}
/* main menu */
rect { "menu_bg";
desc { "default";
color: 64 64 64 255; // FIXME: color_class
align: 0.5 0.0;
rel.to: "elm.swallow.menu";
}
}
swallow { "elm.swallow.menu";
required: 1; // since 1.19
desc { "default";
rel.to: "top_clip";
rel1.relative: 0.0 1.0;
rel1.offset: 0 -1;
visible: 0;
align: 0.5 0.0;
fixed: 1 1;
}
desc { "visible"; inherit: "default";
visible: 1;
fixed: 0 1;
}
}
/* application contents - spacer and clipper */
/* application contents - spacer and clipper (without main menu) */
spacer { "client_spacer";
desc { "default";
rel1.to: "top_clip";
rel1.to: "elm.swallow.menu";
rel1.relative: 0.0 1.0;
rel2.to: "bottom_clip";
rel2.relative: 1.0 0.0;
@ -784,6 +805,18 @@ group { name: "elm/border/base/default";
UNSET_MODE(MAXIMIZED);
}
/* application desktop menu */
program { name: "show_menu";
signal: "elm,action,show_menu"; source: "elm";
action: STATE_SET "visible";
target: "elm.swallow.menu";
}
program { name: "hide_menu";
signal: "elm,action,hide"; source: "elm";
action: STATE_SET "default";
target: "elm.swallow.menu";
}
/* modal windows */
program { name: "hide_blocker";
signal: "elm,action,hide_blocker"; source: "elm";

View File

@ -1,28 +1,6 @@
group { name: "elm/win/base/default";
data.item: "elm_win_version" "119";
parts {
/* main menu */
part { name: "menu_bg"; type: RECT;
description { state: "default" 0.0;
color: 64 64 64 255;
align: 0.5 0;
rel2.to: "elm.swallow.menu";
}
}
part { name: "elm.swallow.menu"; type: SWALLOW;
description { state: "default" 0.0;
rel2.relative: 1.0 0.0;
visible: 0;
align: 0.5 0;
fixed: 1 1;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
fixed: 0 1;
}
}
/* application content */
rect { "client_clip"; nomouse;
desc { "default";
rel.to: "elm.swallow.contents";
@ -30,24 +8,6 @@ group { name: "elm/win/base/default";
}
swallow { "elm.swallow.contents";
clip_to: "client_clip";
desc { "default";
rel1.to: "elm.swallow.menu";
rel1.relative: 0.0 1.0;
}
}
}
programs {
program { name: "show_menu";
signal: "elm,action,show_menu";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "elm.swallow.menu";
}
program { name: "hide_menu";
signal: "elm,action,hide";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.menu";
}
}
}

View File

@ -212,12 +212,14 @@ struct _Efl_Ui_Win_Data
Eina_Bool need_shadow : 1; /**< if true, application draws its csd and shadow */
Eina_Bool need_borderless : 1;
Eina_Bool need_bg_solid : 1;
Eina_Bool need_menu : 1;
Eina_Bool need_unresizable : 1;
Eina_Bool cur_borderless : 1;
Eina_Bool cur_shadow : 1;
Eina_Bool cur_focus : 1;
Eina_Bool cur_maximized : 1;
Eina_Bool cur_bg_solid : 1;
Eina_Bool cur_menu : 1;
Eina_Bool cur_unresizable : 1;
Eina_Bool wayland : 1;
} csd;
@ -4136,7 +4138,8 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *style)
static void
_elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool calc)
{
Eina_Bool borderless, maximized, shadow, focus, bg_solid, unresizable, alpha;
Eina_Bool borderless, maximized, shadow, focus, bg_solid, menu, unresizable,
alpha;
Eina_Bool changed = EINA_FALSE;
if (!sd->frame_obj)
@ -4152,6 +4155,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
sd->csd.need_shadow = EINA_FALSE;
sd->csd.need_borderless = EINA_TRUE;
sd->csd.need_unresizable = EINA_TRUE;
sd->csd.need_menu = EINA_FALSE;
}
else
{
@ -4166,6 +4170,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
focus = ecore_evas_focus_get(sd->ee);
bg_solid = sd->csd.need_bg_solid;
unresizable = sd->csd.need_unresizable;
menu = sd->csd.need_menu;
/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
* At the moment, E Wayland uses SSD for its internal windows. Which means
@ -4191,6 +4196,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
STATE_SET(focus, "elm,action,focus", "elm,action,unfocus");
STATE_SET(bg_solid, "elm,state,background,solid,on", "elm,state,background,solid,off");
STATE_SET(unresizable, "elm,state,unresizable,on", "elm,state,unresizable,off");
STATE_SET(menu, "elm,action,show_menu", "elm,action,hide_menu");
#undef STATE_SET
@ -5325,25 +5331,38 @@ _efl_ui_win_fullscreen_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
return sd->fullscreen;
}
static inline Eo *
_main_menu_swallow_get(Efl_Ui_Win_Data *sd)
{
if (edje_object_part_exists(sd->legacy.edje, "elm.swallow.menu"))
{
DBG("Detected legacy theme, using legacy swallows.");
return sd->legacy.edje;
}
return sd->legacy.edje;
}
static void
_dbus_menu_set(Eina_Bool dbus_connect, void *data)
{
ELM_WIN_DATA_GET_OR_RETURN(data, sd);
Eo *swallow = _main_menu_swallow_get(sd);
if (dbus_connect)
{
DBG("Setting menu to D-Bus");
edje_object_part_unswallow(sd->legacy.edje, sd->main_menu);
edje_object_signal_emit(sd->legacy.edje, "elm,action,hide", "elm");
edje_object_part_unswallow(swallow, sd->main_menu);
sd->csd.need_menu = EINA_FALSE;
_elm_menu_menu_bar_hide(sd->main_menu);
}
else
{
DBG("Setting menu to local mode");
edje_object_part_swallow(sd->legacy.edje, "elm.swallow.menu", sd->main_menu);
edje_object_signal_emit(sd->legacy.edje, "elm,action,show_menu", "elm");
edje_object_part_swallow(swallow, "elm.swallow.menu", sd->main_menu);
sd->csd.need_menu = EINA_TRUE;
evas_object_show(sd->main_menu);
}
_elm_win_frame_style_update(sd, 0, 1);
}
EOLIAN static void