aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_focus.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-06-16 15:03:09 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-06-16 12:23:07 -0400
commit4921d26fc8efa2acdf424ce47075ecb4ccacaaa4 (patch)
treeaa31050308c91bd9bf1bc250cc588e723f828333 /src/lib/evas/canvas/evas_focus.c
parentevas: unify more complex conditional clauses in evas_events.c (diff)
downloadefl-4921d26fc8efa2acdf424ce47075ecb4ccacaaa4.tar.gz
evas: add seat-based focus interceptor
@feature
Diffstat (limited to 'src/lib/evas/canvas/evas_focus.c')
-rw-r--r--src/lib/evas/canvas/evas_focus.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c
index 6ea934a8cd..2dd137d19e 100644
--- a/src/lib/evas/canvas/evas_focus.c
+++ b/src/lib/evas/canvas/evas_focus.c
@@ -128,12 +128,14 @@ _efl_canvas_object_seat_focus_del(Eo *eo_obj,
{
Eina_List *l;
Efl_Input_Device *dev;
+ Eo *default_seat;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return EINA_FALSE;
MAGIC_CHECK_END();
- if (!seat) seat = _default_seat_get(eo_obj);
+ if (seat) default_seat = _default_seat_get(eo_obj);
+ else default_seat = seat = _default_seat_get(eo_obj);
if ((!seat) && obj->layer)
{
@@ -145,8 +147,21 @@ _efl_canvas_object_seat_focus_del(Eo *eo_obj,
{
if (dev != seat)
continue;
- if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
- 1, EINA_FALSE))
+ if (obj->interceptors && obj->interceptors->focus_set.func && obj->interceptors->device_focus_set.func)
+ {
+ CRI("Your object is trying to use both focus_set and device_focus_set intercept! Sad!");
+ return EINA_FALSE;
+ }
+ if (obj->interceptors && obj->interceptors->focus_set.func && (seat == default_seat))
+ {
+ if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
+ 1, EINA_FALSE))
+ {
+ return EINA_FALSE;
+ }
+ }
+ else if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_DEVICE_FOCUS_SET,
+ 1, EINA_FALSE, seat))
{
return EINA_FALSE;
}
@@ -167,13 +182,15 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
{
Eo *current_focus;
int event_id;
+ Eo *default_seat;
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
return EINA_FALSE;
MAGIC_CHECK_END();
event_id = _evas_event_counter;
- if (!seat) seat = _default_seat_get(eo_obj);
+ if (seat) default_seat = _default_seat_get(eo_obj);
+ else default_seat = seat = _default_seat_get(eo_obj);
if (seat && (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_TYPE_SEAT))
return EINA_FALSE;
@@ -190,12 +207,24 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
if (_already_focused(obj->events->focused_by_seats, seat))
goto end;
- if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
- 1, EINA_TRUE))
+ if (obj->interceptors && obj->interceptors->focus_set.func && obj->interceptors->device_focus_set.func)
+ {
+ CRI("Your object is trying to use both focus_set and device_focus_set intercept! Sad!");
+ return EINA_FALSE;
+ }
+ if (obj->interceptors && obj->interceptors->focus_set.func && (seat == default_seat))
+ {
+ if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
+ 1, EINA_TRUE))
+ {
+ return EINA_FALSE;
+ }
+ }
+ else if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_DEVICE_FOCUS_SET,
+ 1, EINA_TRUE, seat))
{
return EINA_FALSE;
}
-
current_focus = _current_focus_get(eo_obj, seat);
if (current_focus)
efl_canvas_object_seat_focus_del(current_focus, seat);