cedric pushed a commit to branch master.
commit 1ac1db596fab74bd889cede127bcb1ff94ddecab
Author: Cedric Bail <[email protected]>
Date: Thu Aug 29 11:21:20 2013 +0900
evas: add interceptor for focus_set.
---
ChangeLog | 4 +++
NEWS | 1 +
src/lib/evas/Evas_Common.h | 1 +
src/lib/evas/Evas_Legacy.h | 3 ++
src/lib/evas/canvas/evas_focus.c | 1 +
src/lib/evas/canvas/evas_object_intercept.c | 50 +++++++++++++++++++++++++++++
src/lib/evas/include/evas_private.h | 25 +++++++++------
7 files changed, 75 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 31645b5..99658c5 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 d7f0bf2..088067c 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 35a6735..77f65bd 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 2ea4cb2..25fec60 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 ab75ae1..757f585 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 ff3d5c1..9b0048a 100644
--- a/src/lib/evas/canvas/evas_object_intercept.c
+++ b/src/lib/evas/canvas/evas_object_intercept.c
@@ -129,6 +129,24 @@ evas_object_intercept_call_layer_set(Evas_Object *eo_obj,
}
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,
int r, int g, int b, int a)
@@ -466,6 +484,38 @@ evas_object_intercept_layer_set_callback_del(Evas_Object
*eo_obj, Evas_Object_In
}
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)
{
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
diff --git a/src/lib/evas/include/evas_private.h
b/src/lib/evas/include/evas_private.h
index f2344c5..870e147 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);
--
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk