bdilly pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c5f14a61e38d176cdd2dc6c7004d9fe7226302d3
commit c5f14a61e38d176cdd2dc6c7004d9fe7226302d3 Author: Guilherme Iscaro <[email protected]> Date: Tue Nov 1 16:30:26 2016 -0200 Evas: Add per seat Evas focus state. --- src/lib/evas/canvas/evas_canvas.eo | 16 +++++++++++++--- src/lib/evas/canvas/evas_events.c | 9 +++++---- src/lib/evas/canvas/evas_main.c | 13 +++++++++++-- src/lib/evas/include/evas_private.h | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo index 2a5ea1f..8f0c9ae 100644 --- a/src/lib/evas/canvas/evas_canvas.eo +++ b/src/lib/evas/canvas/evas_canvas.eo @@ -265,10 +265,20 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface) } @property focus_state { get { - [[Get the focus state known by the given evas.]] + [[Get the focus state for the default seat.]] return: bool; [[$true if focused, $false otherwise]] } } + @property seat_focus_state { + [[Get the focus state by a given seat.]] + get {} + keys { + seat: Efl.Input.Device; [[The seat to check the focus state. Use $null for the default seat.]] + } + values { + return: bool; [[$true if the seat has the canvas focus, $false otherwise.]] + } + } @property changed { get { [[Get the changed marker for the canvas. @@ -599,7 +609,7 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface) ]] } focus_out { - [[Inform to the evas that it lost the focus.]] + [[Inform to the evas that it lost the focus from the default seat.]] } norender { [[Update the canvas internal objects but not triggering immediate @@ -942,7 +952,7 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface) } } focus_in { - [[Inform to the evas that it got the focus.]] + [[Inform to the evas that it got the focus from the default seat.]] } obscured_rectangle_add { [[Add an "obscured region" to an Evas canvas. diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c index 5bccd61..0a55fa8 100644 --- a/src/lib/evas/canvas/evas_events.c +++ b/src/lib/evas/canvas/evas_events.c @@ -3531,19 +3531,20 @@ _evas_canvas_event_key_cb(void *data, const Efl_Event *event) static void _evas_canvas_event_focus_cb(void *data, const Efl_Event *event) { + Efl_Input_Device *seat = efl_input_device_get(event->info); Evas_Public_Data *e = data; if (event->desc == EFL_EVENT_FOCUS_IN) { - if (e->focus) return; - e->focus = 1; + if (eina_list_data_find(e->focused_by, seat)) return; + e->focused_by = eina_list_append(e->focused_by, seat); evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, event->info); } else { - if (!e->focus) return; - e->focus = 0; + if (!eina_list_data_find(e->focused_by, seat)) return; + e->focused_by = eina_list_remove(e->focused_by, seat); evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, event->info); } diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index 3dc7b61..0c58d83 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -376,6 +376,7 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e) free(touch_point); _evas_device_cleanup(eo_e); + e->focused_by = eina_list_free(e->focused_by); eina_lock_free(&(e->lock_objects)); eina_spinlock_free(&(e->render.lock)); @@ -567,9 +568,17 @@ _evas_canvas_focus_out(Eo *eo_e, Evas_Public_Data *e) } EOLIAN static Eina_Bool -_evas_canvas_focus_state_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e) +_evas_canvas_seat_focus_state_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, + Efl_Input_Device *seat) { - return e->focus; + if (!seat) seat = e->default_seat; + return eina_list_data_find(e->focused_by, seat) ? EINA_TRUE : EINA_FALSE; +} + +EOLIAN static Eina_Bool +_evas_canvas_focus_state_get(Eo *eo_e, Evas_Public_Data *e) +{ + return _evas_canvas_seat_focus_state_get(eo_e, e, NULL); } EOLIAN static Eina_Bool diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 9d5b2e0..f6a011b 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -903,6 +903,7 @@ struct _Evas_Public_Data int smart_calc_count; Eina_Hash *focused_objects; //Key - seat; value - the focused object + Eina_List *focused_by; //Which seat has the canvas focus void *attach_data; Evas_Modifier modifiers; Evas_Lock locks; @@ -926,7 +927,6 @@ struct _Evas_Public_Data unsigned char delete_me : 1; unsigned char invalidate : 1; unsigned char cleanup : 1; - unsigned char focus : 1; Eina_Bool is_frozen : 1; Eina_Bool rendering : 1; Eina_Bool render2 : 1; --
