aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-11-22 17:34:17 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-11-23 13:04:13 +0900
commit0de72b44c1cc2798329c59bfe3399667c53c4859 (patch)
tree119c7f1e940108e80998434171351f482c139b2c /src
parentwin: Remove menu from EDC group (fixes compatibility) (diff)
downloadefl-0de72b44c1cc2798329c59bfe3399667c53c4859.tar.gz
win: Fix support for legacy themes (elm_bg)
For standard windows, we want to create an elm_bg object if the theme is a legacy one. Otherwise the default theme doesn't require an extra object, just a rectangle.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_win.c45
-rw-r--r--src/lib/elementary/elm_theme.c8
2 files changed, 51 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 56e392a646..537e1aee39 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -260,6 +260,8 @@ struct _Efl_Ui_Win_Data
struct {
Evas_Object *box, *edje;
Eina_Bool forbidden : 1; /**< Marks some legacy APIs as not allowed. */
+ Eina_Bool bg_must_swallow : 1; /**< Legacy theme compatibility (elm_bg for standard window) */
+ Eina_Bool bg_must_swallow_init : 1;
} legacy;
Eina_Bool urgent : 1;
@@ -6223,6 +6225,35 @@ _elm_win_bg_set(Efl_Ui_Win_Data *sd, Eo *bg)
return EINA_TRUE;
}
+/* Legacy theme compatibility */
+static Eina_Bool
+_elm_win_bg_must_swallow(Efl_Ui_Win_Data *sd)
+{
+ if (EINA_UNLIKELY(!sd->legacy.bg_must_swallow_init))
+ {
+ /* Overkill: check which theme version the standard elm_bg uses */
+ Elm_Widget_Smart_Data *wd;
+ const char *version;
+ Eo *bg;
+ int v;
+
+ sd->legacy.bg_must_swallow = 1;
+ sd->legacy.bg_must_swallow_init = 1;
+
+ bg = elm_bg_add(sd->obj);
+ wd = efl_data_scope_get(bg, ELM_WIDGET_CLASS);
+ if (wd)
+ {
+ version = edje_object_data_get(wd->resize_obj, "elm_bg_version");
+ v = version ? atoi(version) : 0;
+ if (v >= 119) sd->legacy.bg_must_swallow = 0;
+ }
+ evas_object_del(bg);
+ }
+
+ return sd->legacy.bg_must_swallow;
+}
+
void
_elm_win_standard_init(Eo *obj)
{
@@ -6230,9 +6261,19 @@ _elm_win_standard_init(Eo *obj)
Efl_Ui_Win_Data *sd = efl_data_scope_get(obj, MY_CLASS);
ELM_SAFE_DEL(sd->bg);
- sd->csd.need_bg_solid = EINA_TRUE;
- /* FIXME: We should swallow a legacy elm_bg if not using the default theme */
+ if (!_elm_win_bg_must_swallow(sd))
+ {
+ sd->csd.need_bg_solid = EINA_TRUE;
+ }
+ else
+ {
+ /* Legacy theme compatibility */
+ DBG("Detected legacy theme used for elm_bg. Swallowing object.");
+ sd->csd.need_bg_solid = EINA_FALSE;
+ _elm_win_bg_set(sd, efl_add(ELM_BG_CLASS, obj));
+ }
+
_elm_win_frame_style_update(sd, 0, 1);
}
diff --git a/src/lib/elementary/elm_theme.c b/src/lib/elementary/elm_theme.c
index b57e20d008..50f98684b4 100644
--- a/src/lib/elementary/elm_theme.c
+++ b/src/lib/elementary/elm_theme.c
@@ -33,6 +33,14 @@ _elm_theme_item_finalize(Elm_Theme_Files *files,
Eina_Bool prepend,
Eina_Bool istheme)
{
+ /* Theme version history:
+ * <110: legacy, had no version tag
+ * 110: first supported version
+ * 119: switched windows to always use border
+ * win group has no menu, no blocker
+ * border group has all required swallows (conformant, bg, win)
+ * data: "elm_bg_version" matches "version" ("119")
+ */
if (!f) return;
if (istheme)
{