summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-11-28 15:43:25 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-11-28 15:52:09 +0900
commit8a213847596376305d282e1ba26080b548a207f9 (patch)
treeb1ab18e07d33af30773afd6e71594db10c79a1fe
parent51ba193bdad7a8d1c3ac651dbee6551418f5e238 (diff)
downloadefl-8a213847596376305d282e1ba26080b548a207f9.tar.gz
win: Move main menu back to win.edc (fix sizing)
As Andy reported, the main menu geometry is not correct after my recent changes, as the application contents slide underneath the menu bar. In fact the menu bar is just floating above everything else. So I've tried to move the menu to the framespace (as it should belong to the frame), but the sizing algos for both the window and the menu make some assumptions that render this task quite difficult. Eventually I would like to be able to swallow the menu somewhere else inside the border... but not right now.
-rw-r--r--data/elementary/themes/edc/elm/border.edc43
-rw-r--r--data/elementary/themes/edc/elm/win.edc40
-rw-r--r--src/lib/elementary/efl_ui_win.c29
3 files changed, 50 insertions, 62 deletions
diff --git a/data/elementary/themes/edc/elm/border.edc b/data/elementary/themes/edc/elm/border.edc
index 1c5a25d834..72e84abc56 100644
--- a/data/elementary/themes/edc/elm/border.edc
+++ b/data/elementary/themes/edc/elm/border.edc
@@ -1,10 +1,12 @@
/* 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";
@@ -91,34 +93,11 @@ 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 (without main menu) */
+ /* application contents - spacer and clipper */
spacer { "client_spacer";
desc { "default";
- rel1.to: "elm.swallow.menu";
+ rel1.to: "top_clip";
rel1.relative: 0.0 1.0;
rel2.to: "bottom_clip";
rel2.relative: 1.0 0.0;
@@ -805,18 +784,6 @@ 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";
diff --git a/data/elementary/themes/edc/elm/win.edc b/data/elementary/themes/edc/elm/win.edc
index 8c6a08dd83..2c5e0dd930 100644
--- a/data/elementary/themes/edc/elm/win.edc
+++ b/data/elementary/themes/edc/elm/win.edc
@@ -1,6 +1,28 @@
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";
@@ -8,6 +30,24 @@ 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";
}
}
}
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 309ff7f52c..d552c04d14 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -212,14 +212,12 @@ 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;
@@ -4138,8 +4136,7 @@ _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, menu, unresizable,
- alpha;
+ Eina_Bool borderless, maximized, shadow, focus, bg_solid, unresizable, alpha;
Eina_Bool changed = EINA_FALSE;
if (!sd->frame_obj)
@@ -4155,7 +4152,6 @@ _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
{
@@ -4170,7 +4166,6 @@ _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
@@ -4196,7 +4191,6 @@ _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
@@ -5331,38 +5325,25 @@ _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(swallow, sd->main_menu);
- sd->csd.need_menu = EINA_FALSE;
+ edje_object_part_unswallow(sd->legacy.edje, sd->main_menu);
+ edje_object_signal_emit(sd->legacy.edje, "elm,action,hide", "elm");
_elm_menu_menu_bar_hide(sd->main_menu);
}
else
{
DBG("Setting menu to local mode");
- edje_object_part_swallow(swallow, "elm.swallow.menu", sd->main_menu);
- sd->csd.need_menu = EINA_TRUE;
+ 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");
evas_object_show(sd->main_menu);
}
- _elm_win_frame_style_update(sd, 0, 1);
}
EOLIAN static void