cedric pushed a commit to branch master.
commit a007a3af1398e66ba90eae005ccbf31dfb81788a
Author: Cedric Bail <[email protected]>
Date: Mon Sep 2 20:28:23 2013 +0900
evas: focus_set can fail... internally handle that case properly now.
---
src/lib/evas/Evas_Eo.h | 2 +-
src/lib/evas/canvas/evas_focus.c | 21 ++++++++++++++++-----
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h
index e4b83e8..fc61c0a 100644
--- a/src/lib/evas/Evas_Eo.h
+++ b/src/lib/evas/Evas_Eo.h
@@ -5232,7 +5232,7 @@ enum
*
* @see evas_object_focus_set
*/
-#define evas_obj_focus_set(focus) EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_FOCUS_SET),
EO_TYPECHECK(Eina_Bool, focus)
+#define evas_obj_focus_set(focus, succeed)
EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_FOCUS_SET), EO_TYPECHECK(Eina_Bool, focus),
EO_TYPECHECK(Eina_Bool *, succeed)
/**
* @def evas_obj_focus_get
diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c
index 757f585..5294ee6 100644
--- a/src/lib/evas/canvas/evas_focus.c
+++ b/src/lib/evas/canvas/evas_focus.c
@@ -10,29 +10,36 @@
EAPI void
evas_object_focus_set(Evas_Object *eo_obj, Eina_Bool focus)
{
- eo_do(eo_obj, evas_obj_focus_set(focus));
+ eo_do(eo_obj, evas_obj_focus_set(focus, NULL));
}
void
_focus_set(Eo *eo_obj, void *_pd, va_list *list)
{
Eina_Bool focus = va_arg(*list, int);
+ Eina_Bool *r = va_arg(*list, Eina_Bool *);
int event_id = 0;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
- Evas_Object_Protected_Data *obj = _pd;
+ Evas_Object_Protected_Data *obj = _pd;
+
+ if (r) *r = EINA_FALSE;
_evas_object_event_new();
event_id = _evas_event_counter;
- if (obj->focused == focus) goto end;
+ if (obj->focused == focus) goto success_end;
if (evas_object_intercept_call_focus_set(eo_obj, obj, focus)) goto end;
if (focus)
{
+ Eina_Bool success = EINA_TRUE;
+
if (obj->layer->evas->focused)
- evas_object_focus_set(obj->layer->evas->focused, 0);
+ eo_do(obj->layer->evas->focused,
+ evas_obj_focus_set(0, &success));
+ if (!success) goto end;
obj->focused = 1;
obj->layer->evas->focused = eo_obj;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_IN,
NULL, event_id);
@@ -47,7 +54,11 @@ _focus_set(Eo *eo_obj, void *_pd, va_list *list)
evas_event_callback_call(obj->layer->evas->evas,
EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
eo_obj);
}
- end:
+
+ success_end:
+ if (r) *r = EINA_TRUE;
+
+ end:
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
}
--
------------------------------------------------------------------------------
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