From a777fcb679833727fedbbbdc96826f947bb10ed9 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 9 Jun 2017 20:16:07 -0400 Subject: [PATCH] ecore-evas: make focus-setting work with async device init @fix --- src/lib/ecore_evas/ecore_evas.c | 13 +++++++++---- src/lib/ecore_evas/ecore_evas_private.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index ccc54b9..e5eae6d 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -382,6 +382,11 @@ _ecore_evas_dev_added_or_removed(void *data, const Efl_Event *event) { if (_is_pointer(event->info)) _ecore_evas_cursor_add(ee, event->info); + else if (event->info == evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_SEAT)) + { + if (ee->prop.focused) + _ecore_evas_focus_device_set(ee, event->info, 1); + } } else { @@ -1987,15 +1992,15 @@ _ecore_evas_focus_device_set(Ecore_Evas *ee, Efl_Input_Device *seat, if (!seat) seat = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_SEAT); - if (on) - EINA_SAFETY_ON_NULL_RETURN(seat); - else if (!seat) return; + if ((!on) && (!seat)) return; - if (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT) + if (seat && (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT)) { ERR("The Input device must be an seat"); return; } + ee->prop.focused = ee->prop.focused_by || on; + if (!seat) return; present = ecore_evas_focus_device_get(ee, seat); if (on) diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index e905209..08fed6f 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -289,6 +289,7 @@ struct _Ecore_Evas Eina_Bool modal : 1; Eina_Bool demand_attention : 1; Eina_Bool focus_skip : 1; + Eina_Bool focused : 1; } prop; struct { -- 2.7.4