forked from enlightenment/efl
efl_ui_focus_manager: the FOCUSED event now carries the last focused
object This is usefull to react on focused events
This commit is contained in:
parent
3139b0f7f5
commit
acb469439f
|
@ -154,6 +154,6 @@ interface Efl.Ui.Focus.Manager {
|
|||
coords,dirty; [[Emitted once the graph is dirty, this means there are
|
||||
potential changes in border_elements you want to know about]]
|
||||
focused : Efl.Ui.Focus.Object; [[Emitted if the manager has focused an
|
||||
object]]
|
||||
object, the passed focus object is the last focused object]]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1311,6 +1311,7 @@ EOLIAN static void
|
|||
_efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Efl_Ui_Focus_Object *focus)
|
||||
{
|
||||
Node *node;
|
||||
Efl_Ui_Focus_Object *last_focusable;
|
||||
Efl_Ui_Focus_Manager *redirect_manager;
|
||||
Eo *focusable;
|
||||
Node_Type type;
|
||||
|
@ -1366,6 +1367,9 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
|
|||
type = node->type;
|
||||
focusable = node->focusable;
|
||||
|
||||
if (pd->focus_stack)
|
||||
last_focusable = ((Node*)eina_list_last_data_get(pd->focus_stack))->focusable;
|
||||
|
||||
_focus_stack_unfocus_last(pd);
|
||||
|
||||
if (node->type == NODE_TYPE_NORMAL)
|
||||
|
@ -1377,13 +1381,17 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_focus_set(Eo *obj, Efl_Ui_Focus_
|
|||
|
||||
//populate the new change
|
||||
efl_ui_focus_object_focus_set(node->focusable, EINA_TRUE);
|
||||
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, node_focusable);
|
||||
}
|
||||
|
||||
//remove the object from the list and add it again
|
||||
pd->focus_stack = eina_list_remove(pd->focus_stack, node);
|
||||
pd->focus_stack = eina_list_append(pd->focus_stack, node);
|
||||
|
||||
if (node->type == NODE_TYPE_NORMAL)
|
||||
{
|
||||
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, last_focusable);
|
||||
}
|
||||
|
||||
//set to NULL here, from the event earlier this pointer could be dead.
|
||||
node = NULL;
|
||||
|
||||
|
@ -1620,24 +1628,34 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_logical_end(Eo *obj EINA_UNUSED,
|
|||
EOLIAN static void
|
||||
_efl_ui_focus_manager_calc_efl_ui_focus_manager_reset_history(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd)
|
||||
{
|
||||
Efl_Ui_Focus_Object *last_focusable;
|
||||
|
||||
if (!pd->focus_stack) return;
|
||||
|
||||
last_focusable = ((Node*)eina_list_last_data_get(pd->focus_stack))->focusable;
|
||||
|
||||
_focus_stack_unfocus_last(pd);
|
||||
|
||||
pd->focus_stack = eina_list_free(pd->focus_stack);
|
||||
|
||||
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, last_focusable);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_focus_manager_calc_efl_ui_focus_manager_pop_history_stack(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd)
|
||||
{
|
||||
Efl_Ui_Focus_Object *last_focusable;
|
||||
Node *last;
|
||||
|
||||
if (!pd->focus_stack) return;
|
||||
_focus_stack_unfocus_last(pd);
|
||||
|
||||
last_focusable = ((Node*)eina_list_last_data_get(pd->focus_stack))->focusable;
|
||||
|
||||
//get now the highest, and unfocus that!
|
||||
last = eina_list_last_data_get(pd->focus_stack);
|
||||
if (last) efl_ui_focus_object_focus_set(last->focusable, EINA_TRUE);
|
||||
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, last_focusable);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Ui_Focus_Object*
|
||||
|
|
|
@ -4235,12 +4235,13 @@ static void
|
|||
_gengrid_element_focused(void *data, const Efl_Event *ev)
|
||||
{
|
||||
ELM_GENGRID_DATA_GET(data, pd);
|
||||
Elm_Widget *focused = efl_ui_focus_manager_focus_get(ev->object);
|
||||
Elm_Widget_Item *item;
|
||||
|
||||
if (efl_isa(ev->info, EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS))
|
||||
item = efl_parent_get(ev->info);
|
||||
if (efl_isa(focused, EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS))
|
||||
item = efl_parent_get(focused);
|
||||
else
|
||||
item = efl_ui_focus_parent_provider_find_logical_parent(pd->provider, ev->info);
|
||||
item = efl_ui_focus_parent_provider_find_logical_parent(pd->provider, focused);
|
||||
|
||||
if (efl_isa(item, ELM_GENGRID_ITEM_CLASS))
|
||||
{
|
||||
|
|
|
@ -856,7 +856,7 @@ _focused_element(void *data, const Efl_Event *event)
|
|||
{
|
||||
Eina_Rect geom;
|
||||
Efl_Ui_Focus_Object *obj = data;
|
||||
Efl_Ui_Focus_Object *focus = event->info;
|
||||
Efl_Ui_Focus_Object *focus = efl_ui_focus_manager_focus_get(event->object);
|
||||
Elm_Scrollable_Smart_Interface_Data *pd;
|
||||
Eina_Position2D pos;
|
||||
int pan_x, pan_y;
|
||||
|
|
Loading…
Reference in New Issue