diff --git a/ChangeLog b/ChangeLog index 31645b59d8..99658c5d26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2013-08-29 Cedric Bail + * Evas: add interceptor for focus_set. + +2013-08-28 Cedric Bail + * Evas: use mmap/munmap to allocate surface. 2013-08-27 Jaehyun Cho diff --git a/NEWS b/NEWS index d7f0bf2120..088067c802 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,7 @@ Additions: - Change mapping policy for image loader. - textblock: Use max ascent/descent at the edges of the textblock. - textblock: Make the ellipsis format the same as the surrounding. + - Add interceptor for focus_set. * Ecore_X: - Add window profile support. ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index 35a673521b..77f65bd4d6 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -2511,6 +2511,7 @@ typedef void (*Evas_Object_Intercept_Lower_Cb)(void *data, Evas_Object *obj); typedef void (*Evas_Object_Intercept_Stack_Above_Cb)(void *data, Evas_Object *obj, Evas_Object *above); typedef void (*Evas_Object_Intercept_Stack_Below_Cb)(void *data, Evas_Object *obj, Evas_Object *above); typedef void (*Evas_Object_Intercept_Layer_Set_Cb)(void *data, Evas_Object *obj, int l); +typedef void (*Evas_Object_Intercept_Focus_Set_Cb)(void *data, Evas_Object *obj, Eina_Bool focus); typedef void (*Evas_Object_Intercept_Color_Set_Cb)(void *data, Evas_Object *obj, int r, int g, int b, int a); typedef void (*Evas_Object_Intercept_Clip_Set_Cb)(void *data, Evas_Object *obj, Evas_Object *clip); typedef void (*Evas_Object_Intercept_Clip_Unset_Cb)(void *data, Evas_Object *obj); diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 2ea4cb2e50..25fec60284 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -3816,6 +3816,9 @@ EAPI void evas_object_intercept_clip_set_callback_add(Evas_Object *obj, Evas_Ob EAPI void *evas_object_intercept_clip_set_callback_del(Evas_Object *obj, Evas_Object_Intercept_Clip_Set_Cb func) EINA_ARG_NONNULL(1, 2); EAPI void evas_object_intercept_clip_unset_callback_add(Evas_Object *obj, Evas_Object_Intercept_Clip_Unset_Cb func, const void *data) EINA_ARG_NONNULL(1, 2); EAPI void *evas_object_intercept_clip_unset_callback_del(Evas_Object *obj, Evas_Object_Intercept_Clip_Unset_Cb func) EINA_ARG_NONNULL(1, 2); +EAPI void evas_object_intercept_focus_set_callback_add(Evas_Object *obj, Evas_Object_Intercept_Focus_Set_Cb func, const void *data) EINA_ARG_NONNULL(1, 2); +EAPI void *evas_object_intercept_focus_set_callback_del(Evas_Object *obj, Evas_Object_Intercept_Focus_Set_Cb func) EINA_ARG_NONNULL(1, 2); + /** * @} */ diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c index ab75ae1a5a..757f585dc7 100644 --- a/src/lib/evas/canvas/evas_focus.c +++ b/src/lib/evas/canvas/evas_focus.c @@ -28,6 +28,7 @@ _focus_set(Eo *eo_obj, void *_pd, va_list *list) event_id = _evas_event_counter; if (obj->focused == focus) goto end; + if (evas_object_intercept_call_focus_set(eo_obj, obj, focus)) goto end; if (focus) { if (obj->layer->evas->focused) diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c index ff3d5c1e92..9b0048a572 100644 --- a/src/lib/evas/canvas/evas_object_intercept.c +++ b/src/lib/evas/canvas/evas_object_intercept.c @@ -128,6 +128,24 @@ evas_object_intercept_call_layer_set(Evas_Object *eo_obj, return ret; } +int +evas_object_intercept_call_focus_set(Evas_Object *eo_obj, + Evas_Object_Protected_Data *obj, + Eina_Bool focus) +{ + int ret; + + if (!obj->interceptors) return 0; + if (obj->intercepted) return 0; + obj->intercepted = EINA_TRUE; + ret = !!(obj->interceptors->focus_set.func); + if (ret) + obj->interceptors->focus_set.func(obj->interceptors->focus_set.data, eo_obj, focus); + obj->intercepted = EINA_FALSE; + return ret; +} + + int evas_object_intercept_call_color_set(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, @@ -465,6 +483,38 @@ evas_object_intercept_layer_set_callback_del(Evas_Object *eo_obj, Evas_Object_In return data; } +EAPI void +evas_object_intercept_focus_set_callback_add(Evas_Object *eo_obj, Evas_Object_Intercept_Focus_Set_Cb func, const void *data) +{ + MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); + return; + MAGIC_CHECK_END(); + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); + if (!func) return; + evas_object_intercept_init(eo_obj); + if (!obj->interceptors) return; + obj->interceptors->focus_set.func = func; + obj->interceptors->focus_set.data = (void *)data; +} + +EAPI void * +evas_object_intercept_focus_set_callback_del(Evas_Object *eo_obj, Evas_Object_Intercept_Focus_Set_Cb func) +{ + Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); + void *data; + + MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); + return NULL; + MAGIC_CHECK_END(); + if (!func) return NULL; + if (!obj->interceptors) return NULL; + obj->interceptors->focus_set.func = NULL; + data = obj->interceptors->focus_set.data; + obj->interceptors->focus_set.data = NULL; + evas_object_intercept_deinit(eo_obj); + return data; +} + EAPI void evas_object_intercept_color_set_callback_add(Evas_Object *eo_obj, Evas_Object_Intercept_Color_Set_Cb func, const void *data) { diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index f2344c5fd9..870e1474aa 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -238,6 +238,10 @@ struct _Evas_Intercept_Func Evas_Object_Intercept_Clip_Unset_Cb func; void *data; } clip_unset; + struct { + Evas_Object_Intercept_Focus_Set_Cb func; + void *data; + } focus_set; }; struct _Evas_Smart_Cb_Description_Array @@ -1015,18 +1019,19 @@ void evas_object_inform_call_image_preloaded(Evas_Object *obj); void evas_object_inform_call_image_unloaded(Evas_Object *obj); void evas_object_inform_call_image_resize(Evas_Object *obj); void evas_object_intercept_cleanup(Evas_Object *obj); -int evas_object_intercept_call_show(Evas_Object *obj); -int evas_object_intercept_call_hide(Evas_Object *obj); +int evas_object_intercept_call_show(Evas_Object *obj, Evas_Object_Protected_Data *pd); +int evas_object_intercept_call_hide(Evas_Object *obj, Evas_Object_Protected_Data *pd); int evas_object_intercept_call_move(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Coord x, Evas_Coord y); -int evas_object_intercept_call_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); -int evas_object_intercept_call_raise(Evas_Object *obj); -int evas_object_intercept_call_lower(Evas_Object *obj); -int evas_object_intercept_call_stack_above(Evas_Object *obj, Evas_Object *above); -int evas_object_intercept_call_stack_below(Evas_Object *obj, Evas_Object *below); -int evas_object_intercept_call_layer_set(Evas_Object *obj, int l); -int evas_object_intercept_call_color_set(Evas_Object *obj, int r, int g, int b, int a); +int evas_object_intercept_call_resize(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Coord w, Evas_Coord h); +int evas_object_intercept_call_raise(Evas_Object *obj, Evas_Object_Protected_Data *pd); +int evas_object_intercept_call_lower(Evas_Object *obj, Evas_Object_Protected_Data *pd); +int evas_object_intercept_call_stack_above(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Object *above); +int evas_object_intercept_call_stack_below(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Object *below); +int evas_object_intercept_call_layer_set(Evas_Object *obj, Evas_Object_Protected_Data *pd, int l); +int evas_object_intercept_call_color_set(Evas_Object *obj, Evas_Object_Protected_Data *pd, int r, int g, int b, int a); int evas_object_intercept_call_clip_set(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Object *clip); -int evas_object_intercept_call_clip_unset(Evas_Object *obj); +int evas_object_intercept_call_clip_unset(Evas_Object *obj, Evas_Object_Protected_Data *pd); +int evas_object_intercept_call_focus_set(Evas_Object *obj, Evas_Object_Protected_Data *pd, Eina_Bool focus); void evas_object_grabs_cleanup(Evas_Object *obj, Evas_Object_Protected_Data *pd); void evas_key_grab_free(Evas_Object *obj, Evas_Object_Protected_Data *pd, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers); void evas_font_dir_cache_free(void);