From b35bcc6621d9a788f315262c5cf83b73edabee97 Mon Sep 17 00:00:00 2001 From: Daniel Juyung Seo Date: Tue, 16 Dec 2014 01:45:59 +0900 Subject: [PATCH] win: Support elm_win style change and runtime theme change. @feature --- src/lib/elm_win.c | 26 +++++++++++++++++++++++++- src/lib/elm_win.eo | 1 + src/lib/elm_win.h | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 90767b648..8e290603b 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -231,6 +231,7 @@ static const char SIG_INDICATOR_PROP_CHANGED[] = "indicator,prop,changed"; static const char SIG_ROTATION_CHANGED[] = "rotation,changed"; static const char SIG_PROFILE_CHANGED[] = "profile,changed"; static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed"; +static const char SIG_THEME_CHANGED[] = "theme,changed"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_DELETE_REQUEST, ""}, @@ -281,6 +282,7 @@ _elm_win_on_resize_obj_changed_size_hints(void *data, void *event_info); static void _elm_win_img_callbacks_del(Evas_Object *obj, Evas_Object *imgobj); +static Eina_Bool _elm_win_theme_internal(Eo *obj, Elm_Win_Data *sd); #ifdef HAVE_ELEMENTARY_X static void _elm_win_xwin_update(Elm_Win_Data *sd); @@ -3536,7 +3538,8 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t sd->wm_rot.preferred_rot = -1; // it means that elm_win doesn't use preferred rotation. sd->layout = edje_object_add(sd->evas); - _elm_theme_object_set(obj, sd->layout, "win", "base", "default"); + _elm_win_theme_internal(obj, sd); + sd->box = evas_object_box_add(sd->evas); evas_object_box_layout_set(sd->box, _window_layout_stack, obj, NULL); edje_object_part_swallow(sd->layout, "elm.swallow.contents", sd->box); @@ -4818,6 +4821,25 @@ _elm_win_focus_highlight_enabled_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) return sd->focus_highlight.enabled; } +static Eina_Bool +_elm_win_theme_internal(Eo *obj, Elm_Win_Data *sd) +{ + Eina_Bool ret = EINA_FALSE; + + if (!_elm_theme_object_set(obj, sd->layout, "win", "base", + elm_widget_style_get(obj))) + return EINA_FALSE; + + edje_object_mirrored_set(sd->layout, elm_widget_mirrored_get(obj)); + edje_object_scale_set(sd->layout, + elm_widget_scale_get(obj) * elm_config_scale_get()); + + evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL); + eo_do(obj, ret = elm_obj_widget_disable()); + + return ret; +} + EOLIAN static Eina_Bool _elm_win_elm_widget_theme_apply(Eo *obj, Elm_Win_Data *sd) { @@ -4826,6 +4848,8 @@ _elm_win_elm_widget_theme_apply(Eo *obj, Elm_Win_Data *sd) if (!int_ret) return EINA_FALSE; sd->focus_highlight.theme_changed = EINA_TRUE; + if (!_elm_win_theme_internal(obj, sd)) + return EINA_FALSE; _elm_win_focus_highlight_reconfigure_job_start(sd); return EINA_TRUE; diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo index f61343461..a78309ed3 100644 --- a/src/lib/elm_win.eo +++ b/src/lib/elm_win.eo @@ -1383,6 +1383,7 @@ class Elm_Win (Elm_Widget, Elm_Interface_Atspi_Window, unfocused; wm,rotation,changed; animator,tick; + theme,changed; } } diff --git a/src/lib/elm_win.h b/src/lib/elm_win.h index cd3d45ebc..3b43b1811 100644 --- a/src/lib/elm_win.h +++ b/src/lib/elm_win.h @@ -88,6 +88,7 @@ * @li "profile,changed": profile of the window has been changed * @li "focused" : When the win has received focus. (since 1.8) * @li "unfocused" : When the win has lost focus. (since 1.8) + * @li "theme,changed" - The theme was changed. (since 1.13) * * Note that calling evas_object_show() after window contents creation is * recommended. It will trigger evas_smart_objects_calculate() and some backend -- 2.34.1