aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary/efl_ui_focus_util.c
blob: aa0fbbdb4280be01188d16004c72368fe56ddd45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#include <Elementary.h>
#include "elm_priv.h"

typedef struct {

} Efl_Ui_Focus_Util_Data;

static void
_manager_changed(void *data, const Efl_Event *event EINA_UNUSED)
{
   efl_ui_focus_util_focus(EFL_UI_FOCUS_UTIL_CLASS, data);
}

EOLIAN static void
_efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus_User *user)
{
   Efl_Ui_Widget *top, *o;
   Efl_Ui_Focus_Manager *m;
   m = efl_ui_focus_user_focus_manager_get(user);

   top = elm_widget_top_get(user);

   o = efl_key_data_get(top, "__delayed_focus_set");
   if (o) efl_event_callback_del(o, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, o);
   efl_key_data_set(top, "__delayed_focus_set", NULL);

   if (!m)
     {
        //delayed focusung
        efl_key_data_set(top, "__delayed_focus_set", user);
        efl_event_callback_add(user, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, user);
        return;
     }

   efl_ui_focus_manager_focus_set(m, user);
}

#include "efl_ui_focus_util.eo.c"