diff options
author | Guilherme Iscaro <iscaro@profusion.mobi> | 2016-11-01 16:30:26 -0200 |
---|---|---|
committer | Guilherme Iscaro <iscaro@profusion.mobi> | 2016-11-25 12:05:38 -0200 |
commit | 3294ee665cc1181764f7187e449f00e677bda02e (patch) | |
tree | ea28784ee2e1864f45358c787a6341c09d5f44d3 | |
parent | 7171dd09c659ffe5597c29b50c10580237f37d67 (diff) | |
download | efl-3294ee665cc1181764f7187e449f00e677bda02e.tar.gz |
Evas: Add per seat Evas focus state.
-rw-r--r-- | src/lib/evas/canvas/evas_canvas.eo | 16 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_events.c | 9 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_main.c | 13 | ||||
-rw-r--r-- | 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 2a5ea1fa11..8f0c9ae3be 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 5bccd61272..0a55fa88c2 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 4174602bb5..99c7d02d87 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -371,6 +371,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)); @@ -562,9 +563,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 f955e1d3b3..c99661ea3b 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -890,6 +890,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; @@ -913,7 +914,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; |