elementary: Support using no frame object

Summary:
Creation of the frame object can lead to significant delays in window
creation time on limited-power devices (watches, mobile, tv, etc).
This patch allows setting an environment variable and config value in
order to completely skip frame object creation.

This shaves about 50ms from startup on an i7 8600k, so should be more
substantial a saves on limited-power devices.

Reviewers: kimcinoo, ManMower

Reviewed By: ManMower

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7305
This commit is contained in:
Christopher Michael 2018-11-29 14:09:09 -05:00
parent be7d76ece6
commit eec7bc458e
3 changed files with 42 additions and 8 deletions

View File

@ -4623,7 +4623,8 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
if (!efl_finalized_get(sd->obj)) return;
if (EINA_LIKELY(sd->type == ELM_WIN_FAKE))
return;
CRI("Window has no frame object!");
if (!_elm_config->win_no_border)
CRI("Window has no frame object!");
return;
}
@ -4640,6 +4641,8 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
sd->csd.need_menu = EINA_FALSE;
sd->csd.need_indicator = EINA_FALSE;
}
else if (_elm_config->win_no_border)
sd->csd.need_borderless = EINA_TRUE;
else
{
sd->csd.need_shadow = sd->csd.need && (!sd->maximized);
@ -5606,7 +5609,9 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U
case EFL_UI_WIN_NAVIFRAME_BASIC: element = "naviframe"; break;
default: break;
}
_elm_win_frame_add(sd, element, style);
if (!_elm_config->win_no_border)
_elm_win_frame_add(sd, element, style);
if (sd->indimode != EFL_UI_WIN_INDICATOR_OFF)
_indicator_add(sd);
@ -7330,13 +7335,29 @@ _elm_win_bg_set(Efl_Ui_Win_Data *sd, Eo *bg)
return EINA_FALSE;
if (elm_widget_is_legacy(sd->obj))
{
if (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.background", bg))
return EINA_FALSE;
if (!_elm_config->win_no_border)
{
if (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.background", bg))
return EINA_FALSE;
}
else
{
if (!edje_object_part_swallow(sd->legacy.edje, "elm.swallow.background", bg))
return EINA_FALSE;
}
}
else
{
if (!edje_object_part_swallow(sd->frame_obj, "efl.background", bg))
return EINA_FALSE;
if (!_elm_config->win_no_border)
{
if (!edje_object_part_swallow(sd->frame_obj, "efl.background", bg))
return EINA_FALSE;
}
else
{
if (!edje_object_part_swallow(sd->legacy.edje, "efl.background", bg))
return EINA_FALSE;
}
}
efl_gfx_entity_visible_set(bg, 1);
efl_gfx_size_hint_align_set(bg, -1, -1);

View File

@ -535,6 +535,7 @@ _desc_init(void)
ELM_CONFIG_VAL(D, T, offline, T_UCHAR);
ELM_CONFIG_VAL(D, T, powersave, T_INT);
ELM_CONFIG_VAL(D, T, drag_anim_duration, T_DOUBLE);
ELM_CONFIG_VAL(D, T, win_no_border, T_UCHAR);
#undef T
#undef D
#undef T_INT
@ -1868,6 +1869,7 @@ _config_load(Eina_Bool on_flush)
_elm_config->popup_scrollable = EINA_FALSE;
_elm_config->entry_select_allow = EINA_TRUE;
_elm_config->drag_anim_duration = 0.0;
_elm_config->win_no_border = EINA_FALSE;
_env_get();
}
@ -2077,6 +2079,8 @@ _elm_config_reload_do(Eina_Bool on_flush)
KEEP_VAL(entry_select_allow);
KEEP_VAL(drag_anim_duration);
KEEP_VAL(win_no_border);
_elm_config->priv = prev_config->priv;
_config_free(prev_config);
}
@ -2516,6 +2520,10 @@ _config_update(void)
_elm_key_bindings_update(_elm_config, tcfg);
IFCFGEND
IFCFG(0x0010)
_elm_config->win_no_border = EINA_FALSE;
IFCFGEND
/**
* Fix user config for current ELM_CONFIG_EPOCH here.
**/
@ -2892,6 +2900,9 @@ _env_get(void)
s = getenv("EFL_UI_DND_DRAG_ANIM_DURATION");
if (s) _elm_config->drag_anim_duration = _elm_atof(s);
s = getenv("ELM_WIN_NO_BORDER");
if (s) _elm_config->win_no_border = EINA_TRUE;
}
static void

View File

@ -166,8 +166,8 @@ struct _Efl_Ui_Theme_Data
* the users config doesn't need to be wiped - simply new values need
* to be put in
*/
# define ELM_CONFIG_FILE_GENERATION 0x0012
# define ELM_CONFIG_VERSION_EPOCH_OFFSET 16
# define ELM_CONFIG_FILE_GENERATION 0x0013
# define ELM_CONFIG_VERSION_EPOCH_OFFSET 17
# define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << ELM_CONFIG_VERSION_EPOCH_OFFSET) | \
ELM_CONFIG_FILE_GENERATION)
/* NB: profile configuration files (.src) must have their
@ -353,6 +353,7 @@ struct _Elm_Config_Flags
Eina_Bool icon_theme : 1;
Eina_Bool entry_select_allow : 1; // unused
Eina_Bool drag_anim_duration : 1;
Eina_Bool win_no_border : 1;
};
struct _Elm_Config
@ -498,6 +499,7 @@ struct _Elm_Config
Eina_Bool offline;
int powersave;
double drag_anim_duration;
unsigned char win_no_border;
/* Not part of the EET file */
Eina_Bool is_mirrored : 1;