forked from enlightenment/efl
elementary - only support sending signals when orientation mode is changed.
it's enough right now. need to consider more about theme change.
This commit is contained in:
parent
9e0ee980bf
commit
fb472f97b1
|
@ -291,23 +291,19 @@ void _elm_win_translate(void);
|
|||
|
||||
Ecore_X_Window _elm_ee_xwin_get(const Ecore_Evas *ee);
|
||||
|
||||
int _elm_theme_object_set(Evas_Object *parent,
|
||||
Eina_Bool _elm_theme_object_set(Evas_Object *parent,
|
||||
Evas_Object *o,
|
||||
const char *clas,
|
||||
const char *group,
|
||||
const char *style,
|
||||
Eina_Bool orient_on,
|
||||
int orient_mode);
|
||||
const char *style);
|
||||
Eina_Bool _elm_theme_object_icon_set(Evas_Object *o,
|
||||
const char *group,
|
||||
const char *style);
|
||||
int _elm_theme_set(Elm_Theme *th,
|
||||
Eina_Bool _elm_theme_set(Elm_Theme *th,
|
||||
Evas_Object *o,
|
||||
const char *clas,
|
||||
const char *group,
|
||||
const char *style,
|
||||
Eina_Bool orient_on,
|
||||
int orient_mode);
|
||||
const char *style);
|
||||
Eina_Bool _elm_theme_icon_set(Elm_Theme *th,
|
||||
Evas_Object *o,
|
||||
const char *group,
|
||||
|
|
|
@ -438,7 +438,7 @@ _elm_slider_smart_theme(Eo *obj, void *_pd, va_list *list)
|
|||
if (sd->popup)
|
||||
_elm_theme_set(NULL, sd->popup,
|
||||
"slider", "horizontal/popup",
|
||||
elm_widget_style_get(obj), EINA_FALSE, 0);
|
||||
elm_widget_style_get(obj));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -446,7 +446,7 @@ _elm_slider_smart_theme(Eo *obj, void *_pd, va_list *list)
|
|||
if (sd->popup)
|
||||
_elm_theme_set(NULL, sd->popup,
|
||||
"slider", "vertical/popup",
|
||||
elm_widget_style_get(obj), EINA_FALSE, 0);
|
||||
elm_widget_style_get(obj));
|
||||
}
|
||||
|
||||
eo_do_super(obj, elm_wdg_theme(&int_ret));
|
||||
|
@ -782,9 +782,8 @@ _elm_slider_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
{
|
||||
// XXX popup needs to adapt to theme etc.
|
||||
priv->popup = edje_object_add(evas_object_evas_get(obj));
|
||||
_elm_theme_set(NULL, priv->popup,
|
||||
"slider", "horizontal/popup",
|
||||
elm_widget_style_get(obj), EINA_FALSE, 0);
|
||||
_elm_theme_set(NULL, priv->popup, "slider", "horizontal/popup",
|
||||
elm_widget_style_get(obj));
|
||||
edje_object_scale_set(priv->popup, elm_widget_scale_get(obj) *
|
||||
elm_config_scale_get());
|
||||
edje_object_signal_callback_add(priv->popup, "popup,hide,done", "elm",
|
||||
|
|
|
@ -225,16 +225,15 @@ _elm_theme_reload(void *data __UNUSED__, Evas_Object *obj,
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
_elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style, Eina_Bool orient_on, int orient_mode)
|
||||
Eina_Bool
|
||||
_elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style)
|
||||
{
|
||||
Elm_Theme *th = NULL;
|
||||
void *test;
|
||||
int ret;
|
||||
|
||||
if (parent) th = elm_widget_theme_get(parent);
|
||||
ret = _elm_theme_set(th, o, clas, group, style, orient_on, orient_mode);
|
||||
if (ret == -1) return -1;
|
||||
ret = _elm_theme_set(th, o, clas, group, style);
|
||||
|
||||
test = evas_object_data_get(o, "edje,theme,watcher");
|
||||
if (!test)
|
||||
|
@ -257,41 +256,20 @@ _elm_theme_object_icon_set(Evas_Object *o,
|
|||
return _elm_theme_icon_set(th, o, group, style);
|
||||
}
|
||||
|
||||
int
|
||||
_elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style, Eina_Bool orient_on, int orient_mode)
|
||||
Eina_Bool
|
||||
_elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style)
|
||||
{
|
||||
const char *file;
|
||||
char buf2[1024];
|
||||
|
||||
if ((!clas) || (!group) || (!style)) return -1;
|
||||
if ((!clas) || (!group) || (!style)) return EINA_FALSE;
|
||||
if (!th) th = &(theme_default);
|
||||
|
||||
//First Try. Apply orient mode.
|
||||
if (orient_mode > 0)
|
||||
{
|
||||
snprintf(buf2, sizeof(buf2), "elm/%s/%s/%d/%s", clas, group,
|
||||
orient_mode, style);
|
||||
file = _elm_theme_group_file_find(th, buf2);
|
||||
if (file)
|
||||
{
|
||||
if (edje_object_file_set(o, file, buf2)) return orient_mode;
|
||||
else
|
||||
{
|
||||
DBG("could not set theme group '%s' from file '%s': %s",
|
||||
buf2, file,
|
||||
edje_load_error_str(edje_object_load_error_get(o)));
|
||||
}
|
||||
}
|
||||
if (orient_on && evas_object_data_get(o, "edje,theme,watcher"))
|
||||
return orient_mode;
|
||||
}
|
||||
|
||||
//Second Try. Use the default group.
|
||||
snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, group, style);
|
||||
file = _elm_theme_group_file_find(th, buf2);
|
||||
if (file)
|
||||
{
|
||||
if (edje_object_file_set(o, file, buf2)) return 0;
|
||||
if (edje_object_file_set(o, file, buf2)) return EINA_TRUE;
|
||||
else
|
||||
{
|
||||
DBG("could not set theme group '%s' from file '%s': %s",
|
||||
|
@ -299,15 +277,15 @@ _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *grou
|
|||
}
|
||||
}
|
||||
|
||||
//Third Try. Use the elementary default theme.
|
||||
//Use the elementary default theme.
|
||||
snprintf(buf2, sizeof(buf2), "elm/%s/%s/default", clas, group);
|
||||
file = _elm_theme_group_file_find(th, buf2);
|
||||
if (!file) return -1;
|
||||
if (edje_object_file_set(o, file, buf2)) return 0;
|
||||
if (!file) return EINA_FALSE;
|
||||
if (edje_object_file_set(o, file, buf2)) return EINA_TRUE;
|
||||
DBG("could not set theme group '%s' from file '%s': %s",
|
||||
buf2, file, edje_load_error_str(edje_object_load_error_get(o)));
|
||||
|
||||
return -1;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
|
|
|
@ -4075,12 +4075,11 @@ _elm_widget_theme_object_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
|
|||
Elm_Widget_Smart_Data *sd = _pd;
|
||||
int ret2;
|
||||
|
||||
ret2 = _elm_theme_object_set(obj, edj, wname, welement, wstyle,
|
||||
sd->orient_on, sd->orient_mode);
|
||||
if (ret2 != -1)
|
||||
ret2 = _elm_theme_object_set(obj, edj, wname, welement, wstyle);
|
||||
if (ret2 && (sd->orient_mode != -1))
|
||||
{
|
||||
char buf[128];
|
||||
snprintf(buf, sizeof(buf), "elm,state,orient,%d", ret2);
|
||||
snprintf(buf, sizeof(buf), "elm,state,orient,%d", sd->orient_mode);
|
||||
elm_object_signal_emit(obj, buf, "elm");
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
|
@ -4522,9 +4521,12 @@ _elm_widget_orientation_set(Eo *obj __UNUSED__, void *_pd, va_list *list)
|
|||
EINA_LIST_FOREACH (sd->subobjs, l, child)
|
||||
elm_widget_orientation_set(child, orient_mode);
|
||||
|
||||
sd->orient_on = EINA_TRUE;
|
||||
eo_do(obj, elm_wdg_theme(NULL));
|
||||
sd->orient_on = EINA_FALSE;
|
||||
if (sd->orient_mode != -1)
|
||||
{
|
||||
char buf[128];
|
||||
snprintf(buf, sizeof(buf), "elm,state,orient,%d", orient_mode);
|
||||
elm_object_signal_emit(obj, buf, "elm");
|
||||
}
|
||||
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -412,7 +412,6 @@ typedef struct _Elm_Widget_Smart_Data
|
|||
|
||||
int frozen;
|
||||
int orient_mode; /* -1 is disabled */
|
||||
Eina_Bool orient_on : 1;
|
||||
|
||||
Eina_Bool drag_x_locked : 1;
|
||||
Eina_Bool drag_y_locked : 1;
|
||||
|
|
|
@ -2948,8 +2948,7 @@ _win_constructor(Eo *obj, void *_pd, va_list *list)
|
|||
Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0;
|
||||
|
||||
sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee));
|
||||
_elm_theme_object_set(obj, o, "pointer", "base", "default", EINA_FALSE,
|
||||
0);
|
||||
_elm_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",
|
||||
|
@ -2965,8 +2964,7 @@ _win_constructor(Eo *obj, void *_pd, va_list *list)
|
|||
}
|
||||
|
||||
sd->layout = edje_object_add(sd->evas);
|
||||
_elm_theme_object_set(obj, sd->layout, "win", "base", "default",
|
||||
EINA_FALSE, 0);
|
||||
_elm_theme_object_set(obj, sd->layout, "win", "base", "default");
|
||||
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);
|
||||
|
|
|
@ -174,9 +174,8 @@ _elm_cursor_obj_add(Evas_Object *obj, Elm_Cursor *cur)
|
|||
if (!cur->obj)
|
||||
return EINA_FALSE;
|
||||
|
||||
if (_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
|
||||
cur->style ? cur->style : "default", EINA_FALSE,
|
||||
0) == -1)
|
||||
if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
|
||||
cur->style ? cur->style : "default"))
|
||||
{
|
||||
evas_object_del(cur->obj);
|
||||
cur->obj = NULL;
|
||||
|
@ -479,8 +478,8 @@ elm_object_cursor_style_set(Evas_Object *obj, const char *style)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
|
||||
style, EINA_FALSE, 0) == -1)
|
||||
if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name,
|
||||
style))
|
||||
ERR("Could not apply the theme to the cursor style=%s", style);
|
||||
else
|
||||
_elm_cursor_set_hot_spots(cur);
|
||||
|
@ -502,9 +501,8 @@ void
|
|||
elm_cursor_theme(Elm_Cursor *cur)
|
||||
{
|
||||
if ((!cur) || (!cur->obj)) return;
|
||||
if (_elm_theme_object_set(cur->eventarea, cur->obj, "cursor",
|
||||
cur->cursor_name, cur->style, EINA_FALSE, 0)
|
||||
== -1)
|
||||
if (!_elm_theme_object_set(cur->eventarea, cur->obj, "cursor",
|
||||
cur->cursor_name, cur->style))
|
||||
ERR("Could not apply the theme to the cursor style=%s", cur->style);
|
||||
else
|
||||
_elm_cursor_set_hot_spots(cur);
|
||||
|
|
|
@ -275,9 +275,8 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt)
|
|||
{
|
||||
const char *style = tt->style ? tt->style : "default";
|
||||
const char *str;
|
||||
if (_elm_theme_object_set(tt->tt_win ? NULL : tt->owner, tt->tooltip,
|
||||
"tooltip", "base", style, EINA_FALSE, 0)
|
||||
== -1)
|
||||
if (!_elm_theme_object_set(tt->tt_win ? NULL : tt->owner, tt->tooltip,
|
||||
"tooltip", "base", style))
|
||||
{
|
||||
ERR("Could not apply the theme to the tooltip! style=%s", style);
|
||||
if (tt->tt_win) evas_object_del(tt->tt_win);
|
||||
|
|
|
@ -169,8 +169,7 @@ _elm_ews_border_config_apply(Ecore_Evas *ee, Evas_Object *o, Elm_Theme *th)
|
|||
if (ecore_evas_borderless_get(ee))
|
||||
style = "borderless";
|
||||
|
||||
_elm_theme_set(th, o, "ews", "decoration", style ? style : "default",
|
||||
EINA_FALSE, 0);
|
||||
_elm_theme_set(th, o, "ews", "decoration", style ? style : "default");
|
||||
|
||||
if (ecore_evas_shaped_get(ee) || ecore_evas_alpha_get(ee) ||
|
||||
ecore_evas_transparent_get(ee))
|
||||
|
@ -447,8 +446,7 @@ _elm_ews_wm_rescale(Elm_Theme *th, Eina_Bool use_theme)
|
|||
_elm_ews_wm_border_theme_set(*(void**)tp->key, tp->data, NULL);
|
||||
|
||||
if (_ews_bg)
|
||||
_elm_theme_set(NULL, _ews_bg, "ews", "background", "default",
|
||||
EINA_FALSE, 0);
|
||||
_elm_theme_set(NULL, _ews_bg, "ews", "background", "default");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -456,8 +454,7 @@ _elm_ews_wm_rescale(Elm_Theme *th, Eina_Bool use_theme)
|
|||
_elm_ews_wm_border_theme_set(*(void**)tp->key, tp->data, th);
|
||||
|
||||
if (_ews_bg)
|
||||
_elm_theme_set(th, _ews_bg, "ews", "background", "default",
|
||||
EINA_FALSE, 0);
|
||||
_elm_theme_set(th, _ews_bg, "ews", "background", "default");
|
||||
}
|
||||
|
||||
eina_iterator_free(it);
|
||||
|
@ -480,8 +477,7 @@ _elm_ews_wm_init(void)
|
|||
o = edje_object_add(e);
|
||||
if (!o) return EINA_FALSE;
|
||||
|
||||
if (_elm_theme_set(NULL, o, "ews", "background", "default", EINA_FALSE, 0)
|
||||
== -1)
|
||||
if (!_elm_theme_set(NULL, o, "ews", "background", "default"))
|
||||
{
|
||||
ERR("Could not set background theme, fallback to rectangle");
|
||||
evas_object_del(o);
|
||||
|
|
Loading…
Reference in New Issue