aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/canvas/evas_focus.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/canvas/evas_focus.c')
-rw-r--r--libraries/evas/src/lib/canvas/evas_focus.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/canvas/evas_focus.c b/libraries/evas/src/lib/canvas/evas_focus.c
new file mode 100644
index 0000000..a1a3bca
--- /dev/null
+++ b/libraries/evas/src/lib/canvas/evas_focus.c
@@ -0,0 +1,59 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4/* private calls */
5
6/* local calls */
7
8/* public calls */
9
10EAPI void
11evas_object_focus_set(Evas_Object *obj, Eina_Bool focus)
12{
13 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
14 return;
15 MAGIC_CHECK_END();
16
17 _evas_object_event_new();
18
19 if (focus)
20 {
21 if (obj->focused) goto end;
22 if (obj->layer->evas->focused)
23 evas_object_focus_set(obj->layer->evas->focused, 0);
24 obj->focused = 1;
25 obj->layer->evas->focused = obj;
26 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_IN, NULL);
27 evas_event_callback_call(obj->layer->evas,
28 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, obj);
29 }
30 else
31 {
32 if (!obj->focused) goto end;
33 obj->focused = 0;
34 obj->layer->evas->focused = NULL;
35 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
36 evas_event_callback_call(obj->layer->evas,
37 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, obj);
38 }
39 end:
40 _evas_post_event_callback_call(obj->layer->evas);
41}
42
43EAPI Eina_Bool
44evas_object_focus_get(const Evas_Object *obj)
45{
46 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
47 return 0;
48 MAGIC_CHECK_END();
49 return obj->focused;
50}
51
52EAPI Evas_Object *
53evas_focus_get(const Evas *e)
54{
55 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
56 return NULL;
57 MAGIC_CHECK_END();
58 return e->focused;
59}