diff options
author | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2013-01-15 19:11:01 +0000 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2013-01-15 19:11:01 +0000 |
commit | 720a81d58c51ae171259bc9f4f2237400dfcb7cc (patch) | |
tree | ca6614d6c9df8648b999b642ef5b9a1cb8d17a7e /src/lib/ecore_imf | |
parent | c4e163fe4aa004adc56bea7709b49f807ff9b6c9 (diff) |
move ecore_imf_evas out of ecore_imf.
SVN revision: 82837
Diffstat (limited to 'src/lib/ecore_imf')
-rw-r--r-- | src/lib/ecore_imf/Ecore_IMF_Evas.h | 168 | ||||
-rw-r--r-- | src/lib/ecore_imf/ecore_imf_evas.c | 214 |
2 files changed, 0 insertions, 382 deletions
diff --git a/src/lib/ecore_imf/Ecore_IMF_Evas.h b/src/lib/ecore_imf/Ecore_IMF_Evas.h deleted file mode 100644 index b6c4fc206b..0000000000 --- a/src/lib/ecore_imf/Ecore_IMF_Evas.h +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | #ifndef _ECORE_IMF_EVAS_H | ||
2 | #define _ECORE_IMF_EVAS_H | ||
3 | |||
4 | #include <Ecore_IMF.h> | ||
5 | #include <Evas.h> | ||
6 | |||
7 | #ifdef EAPI | ||
8 | # undef EAPI | ||
9 | #endif | ||
10 | |||
11 | #ifdef _WIN32 | ||
12 | # ifdef EFL_ECORE_IMF_EVAS_BUILD | ||
13 | # ifdef DLL_EXPORT | ||
14 | # define EAPI __declspec(dllexport) | ||
15 | # else | ||
16 | # define EAPI | ||
17 | # endif /* ! DLL_EXPORT */ | ||
18 | # else | ||
19 | # define EAPI __declspec(dllimport) | ||
20 | # endif /* ! EFL_ECORE_IMF_BUILD */ | ||
21 | #else | ||
22 | # ifdef __GNUC__ | ||
23 | # if __GNUC__ >= 4 | ||
24 | # define EAPI __attribute__ ((visibility("default"))) | ||
25 | # else | ||
26 | # define EAPI | ||
27 | # endif | ||
28 | # else | ||
29 | # define EAPI | ||
30 | # endif | ||
31 | #endif /* ! _WIN32 */ | ||
32 | |||
33 | /** | ||
34 | * @defgroup Ecore_IMF_Evas_Group Ecore Input Method Context Evas Helper Functions | ||
35 | * @ingroup Ecore_IMF_Lib_Group | ||
36 | * | ||
37 | * Helper functions to make it easy to use Evas with Ecore_IMF. | ||
38 | * Converts each event from Evas to the corresponding event of Ecore_IMF. | ||
39 | * | ||
40 | * An example of usage of these functions can be found at: | ||
41 | * @li @ref ecore_imf_example_c | ||
42 | */ | ||
43 | |||
44 | #ifdef __cplusplus | ||
45 | extern "C" { | ||
46 | #endif | ||
47 | |||
48 | /** | ||
49 | * Converts a "mouse_in" event from Evas to the corresponding event of Ecore_IMF. | ||
50 | * | ||
51 | * @param evas_event The received Evas event. | ||
52 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
53 | * @ingroup Ecore_IMF_Evas_Group | ||
54 | */ | ||
55 | EAPI void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ecore_IMF_Event_Mouse_In *imf_event); | ||
56 | |||
57 | /** | ||
58 | * Converts a "mouse_out" event from Evas to the corresponding event of Ecore_IMF. | ||
59 | * | ||
60 | * @param evas_event The received Evas event. | ||
61 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
62 | * @ingroup Ecore_IMF_Evas_Group | ||
63 | */ | ||
64 | EAPI void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, Ecore_IMF_Event_Mouse_Out *imf_event); | ||
65 | |||
66 | /** | ||
67 | * Converts a "mouse_move" event from Evas to the corresponding event of Ecore_IMF. | ||
68 | * | ||
69 | * @param evas_event The received Evas event. | ||
70 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
71 | * @ingroup Ecore_IMF_Evas_Group | ||
72 | */ | ||
73 | EAPI void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, Ecore_IMF_Event_Mouse_Move *imf_event); | ||
74 | |||
75 | /** | ||
76 | * Converts a "mouse_down" event from Evas to the corresponding event of Ecore_IMF. | ||
77 | * | ||
78 | * @param evas_event The received Evas event. | ||
79 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
80 | * @ingroup Ecore_IMF_Evas_Group | ||
81 | */ | ||
82 | EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event); | ||
83 | |||
84 | /** | ||
85 | * Converts a "mouse_up" event from Evas to the corresponding event of Ecore_IMF. | ||
86 | * | ||
87 | * @param evas_event The received Evas event. | ||
88 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
89 | * @ingroup Ecore_IMF_Evas_Group | ||
90 | */ | ||
91 | EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event); | ||
92 | |||
93 | /** | ||
94 | * Converts a "mouse_wheel" event from Evas to the corresponding event of Ecore_IMF. | ||
95 | * | ||
96 | * @param evas_event The received Evas event. | ||
97 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
98 | * @ingroup Ecore_IMF_Evas_Group | ||
99 | */ | ||
100 | EAPI void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, Ecore_IMF_Event_Mouse_Wheel *imf_event); | ||
101 | |||
102 | /** | ||
103 | * Converts a "key_down" event from Evas to the corresponding event of Ecore_IMF. | ||
104 | * | ||
105 | * @param evas_event The received Evas event. | ||
106 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
107 | * @ingroup Ecore_IMF_Evas_Group | ||
108 | * | ||
109 | * Example | ||
110 | * @code | ||
111 | * static void | ||
112 | * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) | ||
113 | * { | ||
114 | * Evas_Event_Key_Down *ev = event_info; | ||
115 | * if (!ev->keyname) return; | ||
116 | * | ||
117 | * if (imf_context) | ||
118 | * { | ||
119 | * Ecore_IMF_Event_Key_Down ecore_ev; | ||
120 | * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); | ||
121 | * if (ecore_imf_context_filter_event(imf_context, | ||
122 | * ECORE_IMF_EVENT_KEY_DOWN, | ||
123 | * (Ecore_IMF_Event *)&ecore_ev)) | ||
124 | * return; | ||
125 | * } | ||
126 | * } | ||
127 | * | ||
128 | * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data); | ||
129 | * @endcode | ||
130 | */ | ||
131 | EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event); | ||
132 | |||
133 | /** | ||
134 | * Converts a "key_up" event from Evas to the corresponding event of Ecore_IMF. | ||
135 | * | ||
136 | * @param evas_event The received Evas event. | ||
137 | * @param imf_event The location to store the converted Ecore_IMF event. | ||
138 | * @ingroup Ecore_IMF_Evas_Group | ||
139 | * | ||
140 | * Example | ||
141 | * @code | ||
142 | * static void | ||
143 | * _key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) | ||
144 | * { | ||
145 | * Evas_Event_Key_Up *ev = event_info; | ||
146 | * if (!ev->keyname) return; | ||
147 | * | ||
148 | * if (imf_context) | ||
149 | * { | ||
150 | * Ecore_IMF_Event_Key_Up ecore_ev; | ||
151 | * ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev); | ||
152 | * if (ecore_imf_context_filter_event(imf_context, | ||
153 | * ECORE_IMF_EVENT_KEY_UP, | ||
154 | * (Ecore_IMF_Event *)&ecore_ev)) | ||
155 | * return; | ||
156 | * } | ||
157 | * } | ||
158 | * | ||
159 | * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_UP, _key_up_cb, data); | ||
160 | * @endcode | ||
161 | */ | ||
162 | EAPI void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event); | ||
163 | |||
164 | #ifdef __cplusplus | ||
165 | } | ||
166 | #endif | ||
167 | |||
168 | #endif | ||
diff --git a/src/lib/ecore_imf/ecore_imf_evas.c b/src/lib/ecore_imf/ecore_imf_evas.c deleted file mode 100644 index 50339624e2..0000000000 --- a/src/lib/ecore_imf/ecore_imf_evas.c +++ /dev/null | |||
@@ -1,214 +0,0 @@ | |||
1 | |||
2 | #ifdef HAVE_CONFIG_H | ||
3 | # include <config.h> | ||
4 | #endif | ||
5 | |||
6 | #include <Ecore.h> | ||
7 | #include "ecore_private.h" | ||
8 | #include "Ecore_IMF_Evas.h" | ||
9 | |||
10 | static const char *_ecore_imf_evas_event_empty = ""; | ||
11 | |||
12 | /* Converts the Evas modifiers to Ecore_IMF keyboard modifiers */ | ||
13 | static void | ||
14 | _ecore_imf_evas_event_modifiers_wrap(Evas_Modifier *evas_modifiers, | ||
15 | Ecore_IMF_Keyboard_Modifiers *imf_keyboard_modifiers) | ||
16 | { | ||
17 | if (!evas_modifiers || !imf_keyboard_modifiers) | ||
18 | return; | ||
19 | |||
20 | *imf_keyboard_modifiers = ECORE_IMF_KEYBOARD_MODIFIER_NONE; | ||
21 | if (evas_key_modifier_is_set(evas_modifiers, "Control")) | ||
22 | *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL; | ||
23 | if (evas_key_modifier_is_set(evas_modifiers, "Alt")) | ||
24 | *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALT; | ||
25 | if (evas_key_modifier_is_set(evas_modifiers, "Shift")) | ||
26 | *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; | ||
27 | if (evas_key_modifier_is_set(evas_modifiers, "Super") || evas_key_modifier_is_set(evas_modifiers, "Hyper")) | ||
28 | *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_WIN; | ||
29 | if (evas_key_modifier_is_set(evas_modifiers, "AltGr")) | ||
30 | *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALTGR; | ||
31 | } | ||
32 | |||
33 | /* Converts the Evas locks to Ecore_IMF keyboard locks */ | ||
34 | static void | ||
35 | _ecore_imf_evas_event_locks_wrap(Evas_Lock *evas_locks, | ||
36 | Ecore_IMF_Keyboard_Locks *imf_keyboard_locks) | ||
37 | { | ||
38 | if (!evas_locks || !imf_keyboard_locks) | ||
39 | return; | ||
40 | |||
41 | *imf_keyboard_locks = ECORE_IMF_KEYBOARD_LOCK_NONE; | ||
42 | if (evas_key_lock_is_set(evas_locks, "Num_Lock")) | ||
43 | *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_NUM; | ||
44 | if (evas_key_lock_is_set(evas_locks, "Caps_Lock")) | ||
45 | *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_CAPS; | ||
46 | if (evas_key_lock_is_set(evas_locks, "Scroll_Lock")) | ||
47 | *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; | ||
48 | } | ||
49 | |||
50 | /* Converts the Evas mouse flags to Ecore_IMF mouse flags */ | ||
51 | static void | ||
52 | _ecore_imf_evas_event_mouse_flags_wrap(Evas_Button_Flags evas_flags, | ||
53 | Ecore_IMF_Mouse_Flags *imf_flags) | ||
54 | { | ||
55 | if (!imf_flags) | ||
56 | return; | ||
57 | |||
58 | *imf_flags = ECORE_IMF_MOUSE_NONE; | ||
59 | if (evas_flags & EVAS_BUTTON_DOUBLE_CLICK) | ||
60 | *imf_flags |= ECORE_IMF_MOUSE_DOUBLE_CLICK; | ||
61 | if (evas_flags & EVAS_BUTTON_TRIPLE_CLICK) | ||
62 | *imf_flags |= ECORE_IMF_MOUSE_TRIPLE_CLICK; | ||
63 | } | ||
64 | |||
65 | EAPI void | ||
66 | ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, | ||
67 | Ecore_IMF_Event_Mouse_In *imf_event) | ||
68 | { | ||
69 | if (!evas_event || !imf_event) | ||
70 | return; | ||
71 | |||
72 | imf_event->buttons = evas_event->buttons; | ||
73 | imf_event->output.x = evas_event->output.x; | ||
74 | imf_event->output.y = evas_event->output.y; | ||
75 | imf_event->canvas.x = evas_event->canvas.x; | ||
76 | imf_event->canvas.y = evas_event->canvas.y; | ||
77 | imf_event->timestamp = evas_event->timestamp; | ||
78 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
79 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
80 | } | ||
81 | |||
82 | EAPI void | ||
83 | ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, | ||
84 | Ecore_IMF_Event_Mouse_Out *imf_event) | ||
85 | { | ||
86 | if (!evas_event || !imf_event) | ||
87 | return; | ||
88 | |||
89 | imf_event->buttons = evas_event->buttons; | ||
90 | imf_event->output.x = evas_event->output.x; | ||
91 | imf_event->output.y = evas_event->output.y; | ||
92 | imf_event->canvas.x = evas_event->canvas.x; | ||
93 | imf_event->canvas.y = evas_event->canvas.y; | ||
94 | imf_event->timestamp = evas_event->timestamp; | ||
95 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
96 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
97 | } | ||
98 | |||
99 | EAPI void | ||
100 | ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, | ||
101 | Ecore_IMF_Event_Mouse_Move *imf_event) | ||
102 | { | ||
103 | if (!evas_event || !imf_event) | ||
104 | return; | ||
105 | |||
106 | imf_event->buttons = evas_event->buttons; | ||
107 | imf_event->cur.output.x = evas_event->cur.output.x; | ||
108 | imf_event->cur.output.y = evas_event->cur.output.y; | ||
109 | imf_event->prev.output.x = evas_event->prev.output.x; | ||
110 | imf_event->prev.output.y = evas_event->prev.output.y; | ||
111 | imf_event->cur.canvas.x = evas_event->cur.canvas.x; | ||
112 | imf_event->cur.canvas.y = evas_event->cur.canvas.y; | ||
113 | imf_event->prev.canvas.x = evas_event->prev.canvas.x; | ||
114 | imf_event->prev.canvas.y = evas_event->prev.canvas.y; | ||
115 | imf_event->timestamp = evas_event->timestamp; | ||
116 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
117 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
118 | } | ||
119 | |||
120 | EAPI void | ||
121 | ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, | ||
122 | Ecore_IMF_Event_Mouse_Down *imf_event) | ||
123 | { | ||
124 | if (!evas_event || !imf_event) | ||
125 | return; | ||
126 | |||
127 | imf_event->button = evas_event->button; | ||
128 | imf_event->output.x = evas_event->output.x; | ||
129 | imf_event->output.y = evas_event->output.y; | ||
130 | imf_event->canvas.x = evas_event->canvas.x; | ||
131 | imf_event->canvas.y = evas_event->canvas.y; | ||
132 | imf_event->timestamp = evas_event->timestamp; | ||
133 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
134 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
135 | _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags); | ||
136 | } | ||
137 | |||
138 | EAPI void | ||
139 | ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, | ||
140 | Ecore_IMF_Event_Mouse_Up *imf_event) | ||
141 | { | ||
142 | if (!evas_event || !imf_event) | ||
143 | return; | ||
144 | |||
145 | imf_event->button = evas_event->button; | ||
146 | imf_event->output.x = evas_event->output.x; | ||
147 | imf_event->output.y = evas_event->output.y; | ||
148 | imf_event->canvas.x = evas_event->canvas.x; | ||
149 | imf_event->canvas.y = evas_event->canvas.y; | ||
150 | imf_event->timestamp = evas_event->timestamp; | ||
151 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
152 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
153 | _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags); | ||
154 | } | ||
155 | |||
156 | EAPI void | ||
157 | ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, | ||
158 | Ecore_IMF_Event_Mouse_Wheel *imf_event) | ||
159 | { | ||
160 | if (!evas_event || !imf_event) | ||
161 | return; | ||
162 | |||
163 | imf_event->direction = evas_event->direction; | ||
164 | imf_event->z = evas_event->z; | ||
165 | imf_event->output.x = evas_event->output.x; | ||
166 | imf_event->output.y = evas_event->output.y; | ||
167 | imf_event->canvas.x = evas_event->canvas.x; | ||
168 | imf_event->canvas.y = evas_event->canvas.y; | ||
169 | imf_event->timestamp = evas_event->timestamp; | ||
170 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
171 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
172 | imf_event->timestamp = evas_event->timestamp; | ||
173 | } | ||
174 | |||
175 | EAPI void | ||
176 | ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, | ||
177 | Ecore_IMF_Event_Key_Down *imf_event) | ||
178 | { | ||
179 | if (!evas_event || !imf_event) | ||
180 | return; | ||
181 | |||
182 | imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty; | ||
183 | imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty; | ||
184 | imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty; | ||
185 | imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty; | ||
186 | imf_event->timestamp = evas_event->timestamp; | ||
187 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
188 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
189 | } | ||
190 | |||
191 | EAPI void | ||
192 | ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, | ||
193 | Ecore_IMF_Event_Key_Up *imf_event) | ||
194 | { | ||
195 | if (!evas_event) | ||
196 | { | ||
197 | EINA_LOG_ERR("Evas event is missing"); | ||
198 | return; | ||
199 | } | ||
200 | |||
201 | if (!imf_event) | ||
202 | { | ||
203 | EINA_LOG_ERR("Imf event is missing"); | ||
204 | return; | ||
205 | } | ||
206 | |||
207 | imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty; | ||
208 | imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty; | ||
209 | imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty; | ||
210 | imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty; | ||
211 | imf_event->timestamp = evas_event->timestamp; | ||
212 | _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); | ||
213 | _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); | ||
214 | } | ||