forked from enlightenment/efl
edje: Hide edje_global from the rest of the world
Call provider_find on the loop (or basically any object) with the color/text/size class interface instead, to find it. The main loop is the main holder of those objects. Note: This makes use of provider_find instead of direct access to the variable, in order to self-test the code. In theory release builds will not do this and user directly the variable.
This commit is contained in:
parent
2f838acd4e
commit
cc1ed7183c
|
@ -5,7 +5,6 @@ edje_eolian_files = \
|
|||
lib/edje/efl_canvas_layout_calc.eo \
|
||||
lib/edje/efl_canvas_layout_signal.eo \
|
||||
lib/edje/efl_canvas_layout_group.eo \
|
||||
lib/edje/edje_global.eo \
|
||||
lib/edje/edje_object.eo \
|
||||
lib/edje/efl_canvas_layout_part.eo \
|
||||
lib/edje/efl_canvas_layout_part_box.eo \
|
||||
|
@ -19,6 +18,7 @@ edje_eolian_type_files = \
|
|||
lib/edje/edje_types.eot
|
||||
|
||||
edje_eolian_priv_files = \
|
||||
lib/edje/edje_global.eo \
|
||||
$(NULL)
|
||||
|
||||
edje_eolian_c = $(edje_eolian_files:%.eo=%.eo.c)
|
||||
|
|
|
@ -3056,7 +3056,7 @@ _efl_loop_efl_object_constructor(Eo *obj, Efl_Loop_Data *pd)
|
|||
|
||||
efl_event_callback_array_add(obj, event_catcher_watch(), pd);
|
||||
|
||||
pd->providers = eina_hash_pointer_new((void*) efl_unref);
|
||||
pd->providers = eina_hash_pointer_new(EINA_FREE_CB(efl_unref));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
class Edje.Global (Efl.Object, Efl.Gfx.Color_Class, Efl.Gfx.Text_Class, Efl.Gfx.Size_Class)
|
||||
{
|
||||
[[An internal object that manages global color, text and size classes for
|
||||
the whole application. Individual edje objects also support the same
|
||||
features.
|
||||
]]
|
||||
data: null;
|
||||
implements {
|
||||
Efl.Gfx.Color_Class.color_class { get; set; }
|
||||
|
|
|
@ -13,6 +13,8 @@ Eina_Mempool *_edje_real_part_state_mp = NULL;
|
|||
Eina_Cow *_edje_calc_params_map_cow = NULL;
|
||||
Eina_Cow *_edje_calc_params_physics_cow = NULL;
|
||||
|
||||
Edje_Global *_edje_global_obj = NULL;
|
||||
|
||||
static const Edje_Calc_Params_Map default_calc_map = {
|
||||
{ 0, 0, 0 }, { 0.0, 0.0, 0.0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0.0, 0.0 }, NULL, 0
|
||||
};
|
||||
|
@ -82,6 +84,11 @@ edje_init(void)
|
|||
|
||||
_edje_scale = FROM_DOUBLE(1.0);
|
||||
_edje_global_obj = efl_add(EDJE_GLOBAL_CLASS, NULL);
|
||||
if (!_edje_global_obj ||
|
||||
!efl_loop_register(ecore_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj) ||
|
||||
!efl_loop_register(ecore_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj) ||
|
||||
!efl_loop_register(ecore_main_loop_get(), EFL_GFX_SIZE_CLASS_INTERFACE, _edje_global_obj))
|
||||
goto shutdown_efreet;
|
||||
|
||||
_edje_edd_init();
|
||||
_edje_text_init();
|
||||
|
@ -141,8 +148,15 @@ shutdown_all:
|
|||
_edje_text_class_hash_free();
|
||||
_edje_size_class_hash_free();
|
||||
_edje_edd_shutdown();
|
||||
if (_edje_global_obj)
|
||||
{
|
||||
efl_loop_unregister(ecore_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj);
|
||||
efl_loop_unregister(ecore_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj);
|
||||
efl_loop_unregister(ecore_main_loop_get(), EFL_GFX_SIZE_CLASS_INTERFACE, _edje_global_obj);
|
||||
efl_del(_edje_global_obj);
|
||||
_edje_global_obj = NULL;
|
||||
}
|
||||
shutdown_efreet:
|
||||
efreet_shutdown();
|
||||
shutdown_evas:
|
||||
evas_shutdown();
|
||||
|
@ -195,6 +209,9 @@ _edje_shutdown_core(void)
|
|||
_edje_text_class_hash_free();
|
||||
_edje_size_class_hash_free();
|
||||
_edje_edd_shutdown();
|
||||
efl_loop_unregister(ecore_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE, _edje_global_obj);
|
||||
efl_loop_unregister(ecore_main_loop_get(), EFL_GFX_TEXT_CLASS_INTERFACE, _edje_global_obj);
|
||||
efl_loop_unregister(ecore_main_loop_get(), EFL_GFX_SIZE_CLASS_INTERFACE, _edje_global_obj);
|
||||
efl_del(_edje_global_obj);
|
||||
_edje_global_obj = NULL;
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
// This object is internal, only the interface needs to be exposed.
|
||||
#include "edje_global.eo.h"
|
||||
|
||||
EAPI extern int _edje_default_log_dom ;
|
||||
|
||||
#ifdef EDJE_DEFAULT_LOG_COLOR
|
||||
|
@ -2348,8 +2351,6 @@ const Eina_Inarray *edje_match_signal_source_hash_get(const char *signal,
|
|||
void edje_match_signal_source_free(Edje_Signal_Source_Char *key, void *data);
|
||||
void _edje_signal_callback_matches_unref(Edje_Signal_Callback_Matches *m);
|
||||
|
||||
extern Edje_Global *_edje_global_obj;
|
||||
|
||||
// FIXME remove below 3 eapi decls when edje_convert goes
|
||||
EAPI void _edje_edd_init(void);
|
||||
EAPI void _edje_data_font_list_desc_make(Eet_Data_Descriptor **_font_list_edd, Eet_Data_Descriptor **_font_edd);
|
||||
|
@ -2399,6 +2400,17 @@ EAPI extern Eina_Mempool *_emp_SNAPSHOT;
|
|||
EAPI extern Eina_Mempool *_emp_part;
|
||||
EAPI extern Eina_Mempool *_emp_VECTOR;
|
||||
|
||||
static inline Edje_Global *
|
||||
_edje_global(void)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
return efl_provider_find(ecore_main_loop_get(), EFL_GFX_COLOR_CLASS_INTERFACE);
|
||||
#else
|
||||
extern Edje_Global *_edje_global_obj;
|
||||
return _edje_global_obj;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
_edje_calc_params_need_type_common(Edje_Calc_Params *p)
|
||||
{
|
||||
|
|
|
@ -536,15 +536,6 @@ _edje_object_efl_player_play_speed_get(Eo *obj EINA_UNUSED, Edje *pd)
|
|||
return 1.0/pd->duration_scale;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_edje_object_efl_object_provider_find(Eo *obj, Edje *ed EINA_UNUSED, const Efl_Class *klass)
|
||||
{
|
||||
if (klass == EDJE_GLOBAL_CLASS)
|
||||
return _edje_global_obj;
|
||||
|
||||
return efl_provider_find(efl_super(obj, EDJE_OBJECT_CLASS), klass);
|
||||
}
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
#define EDJE_OBJECT_EXTRA_OPS \
|
||||
|
|
|
@ -16,8 +16,6 @@ struct _Edje_Box_Layout
|
|||
char name[];
|
||||
};
|
||||
|
||||
Edje_Global *_edje_global_obj = NULL;
|
||||
|
||||
static Eina_Hash *_edje_color_class_hash = NULL;
|
||||
static Eina_Hash *_edje_text_class_hash = NULL;
|
||||
static Eina_Hash *_edje_size_class_hash = NULL;
|
||||
|
@ -648,9 +646,9 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
|
|||
{
|
||||
Eina_Bool int_ret = EINA_TRUE;
|
||||
|
||||
int_ret &= efl_gfx_color_class_set(_edje_global_obj, color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a);
|
||||
int_ret &= efl_gfx_color_class_set(_edje_global_obj, color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2);
|
||||
int_ret &= efl_gfx_color_class_set(_edje_global_obj, color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3);
|
||||
int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a);
|
||||
int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2);
|
||||
int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3);
|
||||
|
||||
return int_ret;
|
||||
}
|
||||
|
@ -678,9 +676,9 @@ edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, in
|
|||
{
|
||||
Eina_Bool int_ret = EINA_TRUE;
|
||||
|
||||
int_ret &= efl_gfx_color_class_get(_edje_global_obj, color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a);
|
||||
int_ret &= efl_gfx_color_class_get(_edje_global_obj, color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2);
|
||||
int_ret &= efl_gfx_color_class_get(_edje_global_obj, color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3);
|
||||
int_ret &= efl_gfx_color_class_get(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a);
|
||||
int_ret &= efl_gfx_color_class_get(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2);
|
||||
int_ret &= efl_gfx_color_class_get(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3);
|
||||
|
||||
return int_ret;
|
||||
}
|
||||
|
@ -702,7 +700,7 @@ _edje_global_efl_gfx_color_class_color_class_get(Eo *obj EINA_UNUSED, void *pd E
|
|||
EAPI void
|
||||
edje_color_class_del(const char *color_class)
|
||||
{
|
||||
efl_gfx_color_class_del(_edje_global_obj, color_class);
|
||||
efl_gfx_color_class_del(_edje_global(), color_class);
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
|
@ -1080,7 +1078,7 @@ on_error:
|
|||
EAPI Eina_Bool
|
||||
edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size size)
|
||||
{
|
||||
return efl_gfx_text_class_set(_edje_global_obj, text_class, font, (Efl_Font_Size)size);
|
||||
return efl_gfx_text_class_set(_edje_global(), text_class, font, (Efl_Font_Size)size);
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
|
@ -1131,7 +1129,7 @@ _edje_global_efl_gfx_text_class_text_class_set(Eo *obj EINA_UNUSED, void *pd EIN
|
|||
EAPI Eina_Bool
|
||||
edje_text_class_get(const char *text_class, const char **font, Evas_Font_Size *size)
|
||||
{
|
||||
return efl_gfx_text_class_get(_edje_global_obj, text_class, font, (Efl_Font_Size *)size);
|
||||
return efl_gfx_text_class_get(_edje_global(), text_class, font, (Efl_Font_Size *)size);
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
|
@ -1162,7 +1160,7 @@ _edje_global_efl_gfx_text_class_text_class_get(Eo *obj EINA_UNUSED, void *pd EIN
|
|||
EAPI void
|
||||
edje_text_class_del(const char *text_class)
|
||||
{
|
||||
efl_gfx_text_class_del(_edje_global_obj, text_class);
|
||||
efl_gfx_text_class_del(_edje_global(), text_class);
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
|
@ -1484,7 +1482,7 @@ on_error:
|
|||
EAPI Eina_Bool
|
||||
edje_size_class_set(const char *size_class, Evas_Coord minw, Evas_Coord minh, Evas_Coord maxw, Evas_Coord maxh)
|
||||
{
|
||||
return efl_gfx_size_class_set(_edje_global_obj, size_class, minw, minh, maxw, maxh);
|
||||
return efl_gfx_size_class_set(_edje_global(), size_class, minw, minh, maxw, maxh);
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
|
@ -1538,7 +1536,7 @@ _edje_global_efl_gfx_size_class_size_class_set(Eo *obj EINA_UNUSED, void *pd EIN
|
|||
EAPI Eina_Bool
|
||||
edje_size_class_get(const char *size_class, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord *maxw, Evas_Coord *maxh)
|
||||
{
|
||||
return efl_gfx_size_class_get(_edje_global_obj, size_class, minw, minh, maxw, maxh);
|
||||
return efl_gfx_size_class_get(_edje_global(), size_class, minw, minh, maxw, maxh);
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
|
@ -1573,7 +1571,7 @@ _edje_global_efl_gfx_size_class_size_class_get(Eo *obj EINA_UNUSED, void *pd EIN
|
|||
EAPI void
|
||||
edje_size_class_del(const char *size_class)
|
||||
{
|
||||
efl_gfx_size_class_del(_edje_global_obj, size_class);
|
||||
efl_gfx_size_class_del(_edje_global(), size_class);
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
|
|
Loading…
Reference in New Issue