aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary/efl_ui_win.c
diff options
context:
space:
mode:
authorTaehyub Kim <taehyub.kim@samsung.com>2018-04-26 19:27:43 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2018-04-26 19:41:03 +0900
commit6e49db0739c38a378c48c6c880f5b41c986ee1e9 (patch)
tree6775b150d15eb99bd9e568565ed67cddcc52a549 /src/lib/elementary/efl_ui_win.c
parentefl_ui_win: remove references to removed functions (diff)
downloadefl-6e49db0739c38a378c48c6c880f5b41c986ee1e9.tar.gz
efl theme: remove the elm legacy name of efl ui theme
Summary: remove the elm legacy name of efl ui theme Test Plan: run elementary_test and test efl ui widget cases Reviewers: Jaehyun_Cho, woohyun, cedric, raster, jpeg Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5934
Diffstat (limited to 'src/lib/elementary/efl_ui_win.c')
-rw-r--r--src/lib/elementary/efl_ui_win.c229
1 files changed, 158 insertions, 71 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 9876b17a67..5a4cf3acb7 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -1458,8 +1458,12 @@ _elm_win_frame_geometry_adjust(Efl_Ui_Win_Data *sd)
{
int fw, fh, ox, oy, ow, oh;
evas_object_geometry_get(sd->frame_obj, NULL, NULL, &fw, &fh);
- edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
- &ox, &oy, &ow, &oh);
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
+ &ox, &oy, &ow, &oh);
+ else
+ edje_object_part_geometry_get(sd->frame_obj, "efl.spacer.opaque",
+ &ox, &oy, &ow, &oh);
l = ox;
t = oy;
r = fw - ow - l;
@@ -1490,7 +1494,11 @@ _elm_win_frame_obj_update(Efl_Ui_Win_Data *sd, Eina_Bool force)
if (!sd->frame_obj) return;
_elm_win_frame_geometry_adjust(sd);
evas_object_geometry_get(sd->frame_obj, &ox, &oy, &ow, &oh);
- edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.content", &cx, &cy, &cw, &ch);
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.content", &cx, &cy, &cw, &ch);
+ else
+ edje_object_part_geometry_get(sd->frame_obj, "efl.spacer.content", &cx, &cy, &cw, &ch);
+
if (!_elm_win_framespace_set(sd, cx, cy, ow - cw, oh - ch) && (!force)) return;
_elm_win_frame_geometry_adjust(sd);
if (sd->first_draw)
@@ -3135,9 +3143,15 @@ _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor)
}
evas_object_move(sd->pointer.obj, 0, 0);
evas_object_resize(sd->pointer.obj, mw, mh);
- edje_object_part_geometry_get(sd->pointer.obj,
- "elm.swallow.hotspot",
- &hx, &hy, NULL, NULL);
+ if (elm_widget_is_legacy(obj)
+ edje_object_part_geometry_get(sd->pointer.obj,
+ "elm.swallow.hotspot",
+ &hx, &hy, NULL, NULL);
+ else
+ edje_object_part_geometry_get(sd->pointer.obj,
+ "efl.hotspot",
+ &hx, &hy, NULL, NULL);
+
sd->pointer.hot_x = hx;
sd->pointer.hot_y = hy;
@@ -3836,7 +3850,7 @@ typedef struct _resize_info {
#endif
} resize_info;
-static const resize_info _resize_infos[8] = {
+static const resize_info _resize_infos_legacy[8] = {
{ "elm.event.resize.t", ELM_CURSOR_TOP_SIDE, EFL_UI_WIN_MOVE_RESIZE_TOP, 1 XDIR(SIZE_T) },
{ "elm.event.resize.b", ELM_CURSOR_BOTTOM_SIDE, EFL_UI_WIN_MOVE_RESIZE_BOTTOM, 2 XDIR(SIZE_B) },
{ "elm.event.resize.l", ELM_CURSOR_LEFT_SIDE, EFL_UI_WIN_MOVE_RESIZE_LEFT, 4 XDIR(SIZE_L) },
@@ -3847,6 +3861,17 @@ static const resize_info _resize_infos[8] = {
{ "elm.event.resize.tr", ELM_CURSOR_TOP_RIGHT_CORNER, EFL_UI_WIN_MOVE_RESIZE_TOP | EFL_UI_WIN_MOVE_RESIZE_RIGHT, 9 XDIR(SIZE_TR) },
};
+static const resize_info _resize_infos[8] = {
+ { "efl.event.resize.t", ELM_CURSOR_TOP_SIDE, EFL_UI_WIN_MOVE_RESIZE_TOP, 1 XDIR(SIZE_T) },
+ { "efl.event.resize.b", ELM_CURSOR_BOTTOM_SIDE, EFL_UI_WIN_MOVE_RESIZE_BOTTOM, 2 XDIR(SIZE_B) },
+ { "efl.event.resize.l", ELM_CURSOR_LEFT_SIDE, EFL_UI_WIN_MOVE_RESIZE_LEFT, 4 XDIR(SIZE_L) },
+ { "efl.event.resize.r", ELM_CURSOR_RIGHT_SIDE, EFL_UI_WIN_MOVE_RESIZE_RIGHT, 8 XDIR(SIZE_R) },
+ { "efl.event.resize.tl", ELM_CURSOR_TOP_LEFT_CORNER, EFL_UI_WIN_MOVE_RESIZE_TOP | EFL_UI_WIN_MOVE_RESIZE_LEFT, 5 XDIR(SIZE_TL) },
+ { "efl.event.resize.bl", ELM_CURSOR_BOTTOM_LEFT_CORNER, EFL_UI_WIN_MOVE_RESIZE_BOTTOM | EFL_UI_WIN_MOVE_RESIZE_LEFT, 6 XDIR(SIZE_BL) },
+ { "efl.event.resize.br", ELM_CURSOR_BOTTOM_RIGHT_CORNER, EFL_UI_WIN_MOVE_RESIZE_BOTTOM | EFL_UI_WIN_MOVE_RESIZE_RIGHT, 10 XDIR(SIZE_BR) },
+ { "efl.event.resize.tr", ELM_CURSOR_TOP_RIGHT_CORNER, EFL_UI_WIN_MOVE_RESIZE_TOP | EFL_UI_WIN_MOVE_RESIZE_RIGHT, 9 XDIR(SIZE_TR) },
+};
+
static inline Efl_Ui_Win_Move_Resize_Mode
_move_resize_mode_rotate(int rotation, Efl_Ui_Win_Move_Resize_Mode mode)
{
@@ -3877,26 +3902,46 @@ _move_resize_mode_rotate(int rotation, Efl_Ui_Win_Move_Resize_Mode mode)
}
static const resize_info *
-_resize_info_get(int rotation, Efl_Ui_Win_Move_Resize_Mode mode)
+_resize_info_get(Evas_Object *obj, int rotation, Efl_Ui_Win_Move_Resize_Mode mode)
{
if (rotation)
- return _resize_info_get(0, _move_resize_mode_rotate(rotation, mode));
+ return _resize_info_get(obj, 0, _move_resize_mode_rotate(rotation, mode));
- for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos); k++)
+ if (elm_widget_is_legacy(obj))
{
- if (_resize_infos[k].mode == mode)
- return &_resize_infos[k];
+ for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos_legacy); k++)
+ {
+ if (_resize_infos_legacy[k].mode == mode)
+ return &_resize_infos_legacy[k];
+ }
+ }
+ else
+ {
+ for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos); k++)
+ {
+ if (_resize_infos[k].mode == mode)
+ return &_resize_infos[k];
+ }
}
return NULL;
}
static Efl_Ui_Win_Move_Resize_Mode
-_move_resize_mode_get(const char *source)
+_move_resize_mode_get(Evas_Object *obj, const char *source)
{
- for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos); k++)
- if (!strcmp(source, _resize_infos[k].source))
- return _resize_infos[k].mode;
+ if (elm_widget_is_legacy(obj))
+ {
+ for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos_legacy); k++)
+ if (!strcmp(source, _resize_infos_legacy[k].source))
+ return _resize_infos_legacy[k].mode;
+ }
+ else
+ {
+ for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos); k++)
+ if (!strcmp(source, _resize_infos[k].source))
+ return _resize_infos[k].mode;
+ }
return EFL_UI_WIN_MOVE_RESIZE_MOVE;
}
@@ -3943,8 +3988,8 @@ _elm_win_frame_cb_resize_show(void *data,
#ifdef HAVE_ELEMENTARY_WL2
if (sd->pointer.obj)
{
- Efl_Ui_Win_Move_Resize_Mode mode = _move_resize_mode_get(source);
- const resize_info *ri = _resize_info_get(sd->rot, mode);
+ Efl_Ui_Win_Move_Resize_Mode mode = _move_resize_mode_get(sd->obj, source);
+ const resize_info *ri = _resize_info_get(sd->obj, sd->rot, mode);
if (ri) elm_widget_theme_object_set(sd->obj, sd->pointer.obj, "pointer", "base", ri->cursor);
}
#else
@@ -4017,7 +4062,7 @@ _win_move_resize_start(Efl_Ui_Win_Data *sd, Efl_Ui_Win_Move_Resize_Mode mode)
if (mode == EFL_UI_WIN_MOVE_RESIZE_MOVE)
return _win_move_start(sd);
- ri = _resize_info_get(sd->rot, mode);
+ ri = _resize_info_get(sd->obj, sd->rot, mode);
if (!ri)
{
ERR("Unsupported move_resize mode %#x", (int) mode);
@@ -4080,7 +4125,7 @@ _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj EINA_UNUSED,
ELM_WIN_DATA_GET_OR_RETURN(data, sd);
Efl_Ui_Win_Move_Resize_Mode mode;
- mode = _move_resize_mode_get(source);
+ mode = _move_resize_mode_get(sd->obj, source);
if (mode == EFL_UI_WIN_MOVE_RESIZE_MOVE) return;
_win_move_resize_start(sd, mode);
@@ -4207,29 +4252,14 @@ _elm_win_wl_configure(void *data, int t EINA_UNUSED, void *event)
#endif
-static char *
-_efl_system_theme_path_get(void)
+static inline void
+_elm_object_part_cursor_set(Evas_Object *obj, Evas_Object *edj,
+ const char *part, const char *cursor)
{
- // Find the default theme from EFL install. Quite ugly.
- const char *sysdir;
- char *version;
- char path[PATH_MAX];
- int v;
-
- sysdir = elm_theme_system_dir_get();
- if (!sysdir) return NULL;
-
- eina_file_path_join(path, PATH_MAX, sysdir, "default.edj");
- version = edje_file_data_get(path, "version");
- v = version ? atoi(version) : 0;
- free(version);
- if (v < FRAME_OBJ_THEME_MIN_VERSION)
- {
- ERR("Default system theme is too old, something is wrong with your installation of EFL.");
- return NULL;
- }
+ Evas_Object *sub = (Evas_Object *) edje_object_part_object_get(edj, part);
+ if (!sub) return;
- return strdup(path);
+ elm_object_sub_cursor_set(sub, obj, cursor);
}
static void
@@ -4263,23 +4293,16 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style)
if (v < FRAME_OBJ_THEME_MIN_VERSION)
{
- // Theme compatibility
- const char *key = "elm/border/base/default"; // FIXME?
- char *sys_theme;
-
WRN("Selected theme does not support the required border theme API "
"(version = %d, requires >= %d).",
v, FRAME_OBJ_THEME_MIN_VERSION);
- sys_theme = _efl_system_theme_path_get();
- if (!sys_theme ||
- !edje_object_file_set(sd->frame_obj, sys_theme, key))
+
+ if (!elm_widget_theme_object_set(sd->obj, sd->frame_obj, "border", element, style))
{
ERR("Failed to set main border theme for the window.");
ELM_SAFE_FREE(sd->frame_obj, evas_object_del);
- free(sys_theme);
return;
}
- free(sys_theme);
}
edje_object_freeze(sd->frame_obj);
@@ -4290,7 +4313,10 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style)
* the fly. */
efl_canvas_object_is_frame_object_set(sd->frame_obj, 2);
- edje_object_part_swallow(sd->frame_obj, "elm.swallow.client", sd->legacy.edje);
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_swallow(sd->frame_obj, "elm.swallow.client", sd->legacy.edje);
+ else
+ edje_object_part_swallow(sd->frame_obj, "efl.client", sd->legacy.edje);
if (sd->icon)
evas_object_show(sd->icon);
@@ -4315,7 +4341,11 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style)
efl_access_object_access_type_set(sd->icon, EFL_ACCESS_TYPE_DISABLED);
}
- edje_object_part_swallow(sd->frame_obj, "elm.swallow.icon", sd->icon);
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_swallow(sd->frame_obj, "elm.swallow.icon", sd->icon);
+ else
+ edje_object_part_swallow(sd->frame_obj, "efl.icon", sd->icon);
+
efl_canvas_object_is_frame_object_set(sd->icon, EINA_TRUE);
evas_object_event_callback_add
@@ -4351,24 +4381,40 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style)
if (!sd->pointer.obj)
{
- for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos); k++)
+ if (elm_widget_is_legacy(obj))
+ {
+ for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos_legacy); k++)
+ {
+ const resize_info *ri = &_resize_infos_legacy[k];
+ _elm_object_part_cursor_set(obj, sd->frame_obj, ri->source, ri->cursor);
+ }
+ }
+ else
{
- const resize_info *ri = &_resize_infos[k];
- Evas_Object *sub = (Evas_Object *)edje_object_part_object_get(sd->frame_obj, ri->source);
- if (sub)
- elm_object_sub_cursor_set(sub, obj, ri->cursor);
+ for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(_resize_infos); k++)
+ {
+ const resize_info *ri = &_resize_infos[k];
+ _elm_object_part_cursor_set(obj, sd->frame_obj, ri->source, ri->cursor);
+ }
}
}
if (sd->title)
{
- edje_object_part_text_escaped_set
- (sd->frame_obj, "elm.text.title", sd->title);
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_text_escaped_set(sd->frame_obj, "elm.text.title", sd->title);
+ else
+ edje_object_part_text_escaped_set(sd->frame_obj, "efl.text.title", sd->title);
}
{
// HACK: Force render mode of bg rect to COPY. This avoids render garbage.
- Eo *bgrect = (Eo *) edje_object_part_object_get(sd->frame_obj, "elm.rect.background");
+ Eo *bgrect;
+ if (elm_widget_is_legacy(sd->obj))
+ bgrect = (Eo *) edje_object_part_object_get(sd->frame_obj, "elm.rect.background");
+ else
+ bgrect = (Eo *) edje_object_part_object_get(sd->frame_obj, "efl.rect.background");
+
efl_canvas_object_render_op_set(bgrect, EFL_GFX_RENDER_OP_COPY);
}
@@ -4653,10 +4699,20 @@ _indicator_add(Efl_Ui_Win_Data *sd)
sd->indicator = _create_indicator(obj);
- if ((!sd->indicator) ||
- (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.indicator", sd->indicator)))
+ if (!sd->indicator)
return;
+ if (elm_widget_is_legacy(obj))
+ {
+ if (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.indicator", sd->indicator))
+ return;
+ }
+ else
+ {
+ if (!edje_object_part_swallow(sd->frame_obj, "efl.indicator", sd->indicator))
+ return;
+ }
+
efl_event_callback_add
(sd->indicator, ELM_PLUG_EVENT_IMAGE_RESIZED, _indicator_resized, obj);
@@ -5280,8 +5336,13 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U
elm_widget_theme_object_set(obj, o, "pointer", "base", "default");
edje_object_size_min_calc(o, &mw, &mh);
evas_object_resize(o, mw, mh);
- edje_object_part_geometry_get(o, "elm.swallow.hotspot",
- &hx, &hy, NULL, NULL);
+ if (elm_widget_is_legacy(obj))
+ edje_object_part_geometry_get(o, "elm.swallow.hotspot",
+ &hx, &hy, NULL, NULL);
+ else
+ edje_object_part_geometry_get(o, "efl.hotspot",
+ &hx, &hy, NULL, NULL);
+
sd->pointer.hot_x = hx;
sd->pointer.hot_y = hy;
evas_object_show(o);
@@ -5474,8 +5535,12 @@ _efl_ui_win_efl_text_text_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, const ch
if (sd->ee)
TRAP(sd, title_set, sd->title);
if (sd->frame_obj)
- edje_object_part_text_escaped_set
- (sd->frame_obj, "elm.text.title", sd->title);
+ {
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_text_escaped_set(sd->frame_obj, "elm.text.title", sd->title);
+ else
+ edje_object_part_text_escaped_set(sd->frame_obj, "efl.text.title", sd->title);
+ }
}
EOLIAN static const char*
@@ -5588,7 +5653,11 @@ _efl_ui_win_icon_object_set(Eo *obj, Efl_Ui_Win_Data *sd, Evas_Object *icon)
efl_event_callback_add(sd->icon, EFL_EVENT_DEL, _elm_win_on_icon_del, obj);
if (sd->frame_obj)
{
- edje_object_part_swallow(sd->frame_obj, "elm.swallow.icon", sd->icon);
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_swallow(sd->frame_obj, "elm.swallow.icon", sd->icon);
+ else
+ edje_object_part_swallow(sd->frame_obj, "efl.icon", sd->icon);
+
evas_object_is_frame_object_set(sd->icon, EINA_TRUE);
}
}
@@ -5898,7 +5967,12 @@ _dbus_menu_set(Eina_Bool dbus_connect, void *data)
{
DBG("Setting menu to local mode");
efl_event_callback_add(sd->obj, EFL_GFX_ENTITY_EVENT_RESIZE, _main_menu_resize_cb, NULL);
- edje_object_part_swallow(swallow, "elm.swallow.menu", sd->main_menu);
+
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_swallow(swallow, "elm.swallow.menu", sd->main_menu);
+ else
+ edje_object_part_swallow(swallow, "efl.menu", sd->main_menu);
+
evas_object_show(sd->main_menu);
if (swallow == sd->frame_obj)
{
@@ -7039,8 +7113,16 @@ _elm_win_bg_set(Efl_Ui_Win_Data *sd, Eo *bg)
if (!elm_widget_sub_object_add(sd->obj, bg))
return EINA_FALSE;
- if (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.background", 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;
+ }
+ else
+ {
+ if (!edje_object_part_swallow(sd->frame_obj, "efl.background", bg))
+ return EINA_FALSE;
+ }
efl_gfx_entity_visible_set(bg, 1);
efl_gfx_size_hint_align_set(bg, -1, -1);
efl_gfx_size_hint_weight_set(bg, 1, 1);
@@ -8330,7 +8412,12 @@ _elm_win_legacy_init(Efl_Ui_Win_Data *sd)
sd->legacy.box = evas_object_box_add(sd->evas);
evas_object_box_layout_set(sd->legacy.box, _window_layout_stack, sd->obj, NULL);
- edje_object_part_swallow(sd->legacy.edje, "elm.swallow.contents", sd->legacy.box);
+
+ if (elm_widget_is_legacy(sd->obj))
+ edje_object_part_swallow(sd->legacy.edje, "elm.swallow.contents", sd->legacy.box);
+ else
+ edje_object_part_swallow(sd->legacy.edje, "efl.contents", sd->legacy.box);
+
evas_object_move(sd->legacy.edje, 0, 0);
evas_object_resize(sd->legacy.edje, 1, 1);
if (sd->type != ELM_WIN_FAKE)