From: Carsten Haitzler (Rasterman) Date: Sun, 27 May 2018 10:48:48 +0000 (+0900) Subject: efl ui win - fix legacy theme support correctly X-Git-Tag: upstream/1.21.0~496 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bddad21849bc397ba20328c9f065a4f57e05bfea;p=platform%2Fupstream%2Fefl.git efl ui win - fix legacy theme support correctly this fixes T6918. during development legacy theme support was b roken. 473e657120ffd9626b6ee8832c75f2f66c9a5351 broke it. --- diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index d553b42..0825e7e 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5071,6 +5071,30 @@ _elm_object_part_cursor_set(Evas_Object *obj, Evas_Object *edj, elm_object_sub_cursor_set(sub, obj, cursor); } +static char * +_efl_system_theme_path_get(void) +{ + // 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; + } + return strdup(path); +} + static void _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *element, const char *style) { @@ -5102,16 +5126,23 @@ _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); - - if (!elm_widget_theme_object_set(sd->obj, sd->frame_obj, "border", element, style)) + sys_theme = _efl_system_theme_path_get(); + if (!sys_theme || + !edje_object_file_set(sd->frame_obj, sys_theme, key)) { 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);