summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_focus.c
blob: cac96b63030cc4051a4a541c1321684a6046f454 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "evas_common_private.h"
#include "evas_private.h"

/* private calls */

/* local calls */

/* public calls */

EAPI void
evas_object_focus_set(Evas_Object *eo_obj, Eina_Bool focus)
{
   eo_do(eo_obj, evas_obj_focus_set(focus));
}

void
_focus_set(Eo *eo_obj, void *_pd, va_list *list)
{
   Eina_Bool focus = va_arg(*list, int);

   int event_id = 0;
   MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
   return;
   MAGIC_CHECK_END();
   Evas_Object_Protected_Data *obj = _pd;

   _evas_object_event_new();

   event_id = _evas_event_counter;
   if (obj->focused == focus) goto end;
   if (evas_object_intercept_call_focus_set(eo_obj, obj, focus)) goto end;
   if (focus)
     {
        if (obj->layer->evas->focused)
	  eo_do(obj->layer->evas->focused, evas_obj_focus_set(0));
	
        if (obj->layer->evas->focused) goto end;
        obj->focused = 1;
        obj->layer->evas->focused = eo_obj;
        evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_IN, NULL, event_id);
        evas_event_callback_call(obj->layer->evas->evas,
                                 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, eo_obj);
     }
   else
     {
        obj->focused = 0;
        obj->layer->evas->focused = NULL;
        evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_OUT, NULL, event_id);
        evas_event_callback_call(obj->layer->evas->evas,
                                 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, eo_obj);
     }

 end:
   _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
}

EAPI Eina_Bool
evas_object_focus_get(const Evas_Object *eo_obj)
{
   MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
   return 0;
   MAGIC_CHECK_END();
   Eina_Bool focus = 0;
   eo_do((Eo *)eo_obj, evas_obj_focus_get(&focus));
   return focus;
}

void
_focus_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
{
   Eina_Bool *focus = va_arg(*list, Eina_Bool *);

   const Evas_Object_Protected_Data *obj = _pd;
   *focus = obj->focused;
}

EAPI Evas_Object *
evas_focus_get(const Evas *e)
{
   MAGIC_CHECK(e, Evas, MAGIC_EVAS);
   return NULL;
   MAGIC_CHECK_END();
   Evas_Object *ret = NULL;
   eo_do((Eo *)e, evas_canvas_focus_get(&ret));
   return ret;
}

void
_canvas_focus_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
{
   Evas_Object **ret = va_arg(*list, Evas_Object **);
   const Evas_Public_Data *e = _pd;
   *ret = e->focused;
}