elementary: Support using no frame object
authorChristopher Michael <cp.michael@samsung.com>
Thu, 29 Nov 2018 19:09:09 +0000 (14:09 -0500)
committerHermet Park <hermetpark@gmail.com>
Wed, 5 Dec 2018 05:51:17 +0000 (14:51 +0900)
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

src/lib/elementary/efl_ui_win.c
src/lib/elementary/elm_config.c
src/lib/elementary/elm_priv.h

index 929f383..f1c3e83 100644 (file)
@@ -5493,7 +5493,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;
      }
 
@@ -5510,6 +5511,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);
@@ -6589,7 +6592,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);
@@ -8386,13 +8391,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);
index eddd163..c30424e 100644 (file)
@@ -566,6 +566,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, scroll_item_align_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, scroll_item_valign, T_STRING);
    //
+   ELM_CONFIG_VAL(D, T, win_no_border, T_UCHAR);
 #undef T
 #undef D
 #undef T_INT
@@ -1980,6 +1981,7 @@ _config_load(Eina_Bool on_flush)
    _elm_config->scroll_item_align_enable = EINA_FALSE;
    _elm_config->scroll_item_valign = eina_stringshare_add("center");
    //
+   _elm_config->win_no_border = EINA_FALSE;
    _env_get();
 }
 
@@ -2189,6 +2191,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);
      }
@@ -2674,6 +2678,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.
     **/
@@ -3050,6 +3058,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
index 2fe4c1e..8c2ed8e 100644 (file)
@@ -169,8 +169,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
@@ -356,6 +356,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
@@ -512,6 +513,7 @@ struct _Elm_Config
    Eina_Bool     scroll_item_align_enable;
    const char   *scroll_item_valign;
 //
+   unsigned char win_no_border;
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;