diff options
Diffstat (limited to 'libraries/evas/src/lib/canvas/evas_events.c')
-rw-r--r-- | libraries/evas/src/lib/canvas/evas_events.c | 1867 |
1 files changed, 0 insertions, 1867 deletions
diff --git a/libraries/evas/src/lib/canvas/evas_events.c b/libraries/evas/src/lib/canvas/evas_events.c deleted file mode 100644 index 1ee8388..0000000 --- a/libraries/evas/src/lib/canvas/evas_events.c +++ /dev/null | |||
@@ -1,1867 +0,0 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | static Eina_List * | ||
5 | _evas_event_object_list_in_get(Evas *e, Eina_List *in, | ||
6 | const Eina_Inlist *list, Evas_Object *stop, | ||
7 | int x, int y, int *no_rep); | ||
8 | |||
9 | static void | ||
10 | _evas_event_havemap_adjust(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Eina_Bool mouse_grabbed) | ||
11 | { | ||
12 | if (obj->smart.parent) | ||
13 | _evas_event_havemap_adjust(obj->smart.parent, x, y, mouse_grabbed); | ||
14 | |||
15 | if ((!obj->cur.usemap) || (!obj->cur.map) || (!obj->cur.map->count == 4)) | ||
16 | return; | ||
17 | |||
18 | evas_map_coords_get(obj->cur.map, *x, *y, x, y, mouse_grabbed); | ||
19 | *x += obj->cur.geometry.x; | ||
20 | *y += obj->cur.geometry.y; | ||
21 | } | ||
22 | |||
23 | static Eina_List * | ||
24 | _evas_event_object_list_raw_in_get(Evas *e, Eina_List *in, | ||
25 | const Eina_Inlist *list, Evas_Object *stop, | ||
26 | int x, int y, int *no_rep) | ||
27 | { | ||
28 | Evas_Object *obj; | ||
29 | int inside; | ||
30 | |||
31 | if (!list) return in; | ||
32 | for (obj = _EINA_INLIST_CONTAINER(obj, list); | ||
33 | obj; | ||
34 | obj = _EINA_INLIST_CONTAINER(obj, EINA_INLIST_GET(obj)->prev)) | ||
35 | { | ||
36 | if (obj == stop) | ||
37 | { | ||
38 | *no_rep = 1; | ||
39 | return in; | ||
40 | } | ||
41 | if (evas_event_passes_through(obj)) continue; | ||
42 | if ((obj->cur.visible) && (obj->delete_me == 0) && | ||
43 | (!obj->clip.clipees) && | ||
44 | (evas_object_clippers_is_visible(obj))) | ||
45 | { | ||
46 | if (obj->smart.smart) | ||
47 | { | ||
48 | int norep = 0; | ||
49 | |||
50 | if ((obj->cur.usemap) && (obj->cur.map) && | ||
51 | (obj->cur.map->count == 4)) | ||
52 | { | ||
53 | inside = evas_object_is_in_output_rect(obj, x, y, 1, 1); | ||
54 | if (inside) | ||
55 | { | ||
56 | if (!evas_map_coords_get(obj->cur.map, x, y, | ||
57 | &(obj->cur.map->mx), | ||
58 | &(obj->cur.map->my), 0)) | ||
59 | { | ||
60 | inside = 0; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | in = _evas_event_object_list_in_get | ||
65 | (e, in, | ||
66 | evas_object_smart_members_get_direct(obj), | ||
67 | stop, | ||
68 | obj->cur.geometry.x + obj->cur.map->mx, | ||
69 | obj->cur.geometry.y + obj->cur.map->my, | ||
70 | &norep); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | in = _evas_event_object_list_in_get | ||
77 | (e, in, evas_object_smart_members_get_direct(obj), | ||
78 | stop, x, y, &norep); | ||
79 | } | ||
80 | if (norep) | ||
81 | { | ||
82 | if (!obj->repeat_events) | ||
83 | { | ||
84 | *no_rep = 1; | ||
85 | return in; | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | inside = evas_object_is_in_output_rect(obj, x, y, 1, 1); | ||
92 | |||
93 | if ((obj->cur.usemap) && (obj->cur.map) && | ||
94 | (obj->cur.map->count == 4)) | ||
95 | { | ||
96 | if ((inside) && | ||
97 | (!evas_map_coords_get(obj->cur.map, x, y, | ||
98 | &(obj->cur.map->mx), | ||
99 | &(obj->cur.map->my), 0))) | ||
100 | { | ||
101 | inside = 0; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | if (inside && ((!obj->precise_is_inside) || | ||
106 | (evas_object_is_inside(obj, x, y)))) | ||
107 | { | ||
108 | if (!evas_event_freezes_through(obj)) | ||
109 | in = eina_list_append(in, obj); | ||
110 | if (!obj->repeat_events) | ||
111 | { | ||
112 | *no_rep = 1; | ||
113 | return in; | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | *no_rep = 0; | ||
120 | return in; | ||
121 | } | ||
122 | |||
123 | static Eina_List * | ||
124 | _evas_event_object_list_in_get(Evas *e, Eina_List *in, | ||
125 | const Eina_Inlist *list, Evas_Object *stop, | ||
126 | int x, int y, int *no_rep) | ||
127 | { | ||
128 | if (!list) return NULL; | ||
129 | return _evas_event_object_list_raw_in_get(e, in, list->last, stop, | ||
130 | x, y, no_rep); | ||
131 | } | ||
132 | |||
133 | Eina_List * | ||
134 | evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y) | ||
135 | { | ||
136 | Evas_Layer *lay; | ||
137 | Eina_List *in = NULL; | ||
138 | |||
139 | if ((!e->layers) || (e->events_frozen > 0)) return NULL; | ||
140 | EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) | ||
141 | { | ||
142 | int norep = 0; | ||
143 | in = _evas_event_object_list_in_get(e, in, | ||
144 | EINA_INLIST_GET(lay->objects), | ||
145 | stop, x, y, &norep); | ||
146 | if (norep) return in; | ||
147 | } | ||
148 | return in; | ||
149 | } | ||
150 | |||
151 | static Eina_List * | ||
152 | evas_event_list_copy(Eina_List *list) | ||
153 | { | ||
154 | Eina_List *l, *new_l = NULL; | ||
155 | const void *data; | ||
156 | |||
157 | EINA_LIST_FOREACH(list, l, data) | ||
158 | new_l = eina_list_append(new_l, data); | ||
159 | return new_l; | ||
160 | } | ||
161 | /* public functions */ | ||
162 | |||
163 | EAPI void | ||
164 | evas_event_default_flags_set(Evas *e, Evas_Event_Flags flags) | ||
165 | { | ||
166 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
167 | return; | ||
168 | MAGIC_CHECK_END(); | ||
169 | e->default_event_flags = flags; | ||
170 | } | ||
171 | |||
172 | EAPI Evas_Event_Flags | ||
173 | evas_event_default_flags_get(const Evas *e) | ||
174 | { | ||
175 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
176 | return EVAS_EVENT_FLAG_ON_HOLD; | ||
177 | MAGIC_CHECK_END(); | ||
178 | return e->default_event_flags; | ||
179 | } | ||
180 | |||
181 | EAPI void | ||
182 | evas_event_freeze(Evas *e) | ||
183 | { | ||
184 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
185 | return; | ||
186 | MAGIC_CHECK_END(); | ||
187 | e->events_frozen++; | ||
188 | } | ||
189 | |||
190 | EAPI void | ||
191 | evas_event_thaw(Evas *e) | ||
192 | { | ||
193 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
194 | return; | ||
195 | MAGIC_CHECK_END(); | ||
196 | e->events_frozen--; | ||
197 | if (e->events_frozen == 0) | ||
198 | { | ||
199 | Evas_Layer *lay; | ||
200 | |||
201 | EINA_INLIST_FOREACH((EINA_INLIST_GET(e->layers)), lay) | ||
202 | { | ||
203 | Evas_Object *obj; | ||
204 | |||
205 | EINA_INLIST_FOREACH(lay->objects, obj) | ||
206 | { | ||
207 | evas_object_clip_recalc(obj); | ||
208 | evas_object_recalc_clippees(obj); | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | if (e->events_frozen < 0) | ||
213 | evas_debug_generic(" Thaw of events when already thawed!!!\n"); | ||
214 | } | ||
215 | |||
216 | EAPI int | ||
217 | evas_event_freeze_get(const Evas *e) | ||
218 | { | ||
219 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
220 | return 0; | ||
221 | MAGIC_CHECK_END(); | ||
222 | return e->events_frozen; | ||
223 | } | ||
224 | |||
225 | EAPI void | ||
226 | evas_event_thaw_eval(Evas *e) | ||
227 | { | ||
228 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
229 | return; | ||
230 | MAGIC_CHECK_END(); | ||
231 | if (e->events_frozen != 0) return; | ||
232 | |||
233 | evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, | ||
234 | e->last_timestamp, NULL); | ||
235 | } | ||
236 | |||
237 | EAPI void | ||
238 | evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data) | ||
239 | { | ||
240 | Eina_List *l, *copy; | ||
241 | Evas_Event_Mouse_Down ev; | ||
242 | Evas_Object *obj; | ||
243 | int addgrab = 0; | ||
244 | int event_id = 0; | ||
245 | |||
246 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
247 | return; | ||
248 | MAGIC_CHECK_END(); | ||
249 | |||
250 | if ((b < 1) || (b > 32)) return; | ||
251 | |||
252 | e->pointer.button |= (1 << (b - 1)); | ||
253 | e->pointer.downs++; | ||
254 | |||
255 | if (e->events_frozen > 0) return; | ||
256 | e->last_timestamp = timestamp; | ||
257 | |||
258 | _evas_object_event_new(); | ||
259 | |||
260 | event_id = _evas_event_counter; | ||
261 | ev.button = b; | ||
262 | ev.output.x = e->pointer.x; | ||
263 | ev.output.y = e->pointer.y; | ||
264 | ev.canvas.x = e->pointer.x; | ||
265 | ev.canvas.y = e->pointer.y; | ||
266 | ev.data = (void *)data; | ||
267 | ev.modifiers = &(e->modifiers); | ||
268 | ev.locks = &(e->locks); | ||
269 | ev.flags = flags; | ||
270 | ev.timestamp = timestamp; | ||
271 | ev.event_flags = e->default_event_flags; | ||
272 | |||
273 | _evas_walk(e); | ||
274 | /* append new touch point to the touch point list */ | ||
275 | _evas_touch_point_append(e, 0, e->pointer.x, e->pointer.y); | ||
276 | /* If this is the first finger down, i.e no other fingers pressed, | ||
277 | * get a new event list, otherwise, keep the current grabbed list. */ | ||
278 | if (e->pointer.mouse_grabbed == 0) | ||
279 | { | ||
280 | Eina_List *ins = evas_event_objects_event_list(e, | ||
281 | NULL, | ||
282 | e->pointer.x, | ||
283 | e->pointer.y); | ||
284 | /* free our old list of ins */ | ||
285 | e->pointer.object.in = eina_list_free(e->pointer.object.in); | ||
286 | /* and set up the new one */ | ||
287 | e->pointer.object.in = ins; | ||
288 | /* adjust grabbed count by the nuymber of currently held down | ||
289 | * fingers/buttons */ | ||
290 | if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1; | ||
291 | } | ||
292 | copy = evas_event_list_copy(e->pointer.object.in); | ||
293 | EINA_LIST_FOREACH(copy, l, obj) | ||
294 | { | ||
295 | if ((obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) || | ||
296 | (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN)) | ||
297 | { | ||
298 | obj->mouse_grabbed += addgrab + 1; | ||
299 | e->pointer.mouse_grabbed += addgrab + 1; | ||
300 | if (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN) | ||
301 | { | ||
302 | e->pointer.nogrep++; | ||
303 | break; | ||
304 | } | ||
305 | } | ||
306 | } | ||
307 | EINA_LIST_FOREACH(copy, l, obj) | ||
308 | { | ||
309 | if (obj->delete_me) continue; | ||
310 | ev.canvas.x = e->pointer.x; | ||
311 | ev.canvas.y = e->pointer.y; | ||
312 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
313 | |||
314 | if (e->events_frozen <= 0) | ||
315 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_DOWN, &ev, event_id); | ||
316 | if (e->delete_me) break; | ||
317 | if (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN) | ||
318 | break; | ||
319 | } | ||
320 | if (copy) eina_list_free(copy); | ||
321 | e->last_mouse_down_counter++; | ||
322 | _evas_post_event_callback_call(e); | ||
323 | /* update touch point's state to EVAS_TOUCH_POINT_STILL */ | ||
324 | _evas_touch_point_update(e, 0, e->pointer.x, e->pointer.y, EVAS_TOUCH_POINT_STILL); | ||
325 | _evas_unwalk(e); | ||
326 | } | ||
327 | |||
328 | static int | ||
329 | _post_up_handle(Evas *e, unsigned int timestamp, const void *data) | ||
330 | { | ||
331 | Eina_List *l, *copy, *ins, *ll; | ||
332 | Evas_Event_Mouse_Out ev; | ||
333 | Evas_Object *obj; | ||
334 | int post_called = 0; | ||
335 | int event_id = 0; | ||
336 | |||
337 | _evas_object_event_new(); | ||
338 | |||
339 | event_id = _evas_event_counter; | ||
340 | ev.buttons = e->pointer.button; | ||
341 | ev.output.x = e->pointer.x; | ||
342 | ev.output.y = e->pointer.y; | ||
343 | ev.canvas.x = e->pointer.x; | ||
344 | ev.canvas.y = e->pointer.y; | ||
345 | ev.data = (void *)data; | ||
346 | ev.modifiers = &(e->modifiers); | ||
347 | ev.locks = &(e->locks); | ||
348 | ev.timestamp = timestamp; | ||
349 | ev.event_flags = e->default_event_flags; | ||
350 | |||
351 | /* get new list of ins */ | ||
352 | ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y); | ||
353 | /* go thru old list of in objects */ | ||
354 | copy = evas_event_list_copy(e->pointer.object.in); | ||
355 | EINA_LIST_FOREACH(copy, ll, obj) | ||
356 | { | ||
357 | ev.canvas.x = e->pointer.x; | ||
358 | ev.canvas.y = e->pointer.y; | ||
359 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
360 | if ((!eina_list_data_find(ins, obj)) || | ||
361 | (!e->pointer.inside)) | ||
362 | { | ||
363 | if (obj->mouse_in) | ||
364 | { | ||
365 | obj->mouse_in = 0; | ||
366 | if (e->events_frozen <= 0) | ||
367 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev, event_id); | ||
368 | } | ||
369 | } | ||
370 | if (e->delete_me) break; | ||
371 | } | ||
372 | _evas_post_event_callback_call(e); | ||
373 | |||
374 | if (copy) copy = eina_list_free(copy); | ||
375 | if (e->pointer.inside) | ||
376 | { | ||
377 | Evas_Event_Mouse_In ev_in; | ||
378 | Evas_Object *obj_itr; | ||
379 | |||
380 | _evas_object_event_new(); | ||
381 | |||
382 | event_id = _evas_event_counter; | ||
383 | ev_in.buttons = e->pointer.button; | ||
384 | ev_in.output.x = e->pointer.x; | ||
385 | ev_in.output.y = e->pointer.y; | ||
386 | ev_in.canvas.x = e->pointer.x; | ||
387 | ev_in.canvas.y = e->pointer.y; | ||
388 | ev_in.data = (void *)data; | ||
389 | ev_in.modifiers = &(e->modifiers); | ||
390 | ev_in.locks = &(e->locks); | ||
391 | ev_in.timestamp = timestamp; | ||
392 | ev_in.event_flags = e->default_event_flags; | ||
393 | |||
394 | EINA_LIST_FOREACH(ins, l, obj_itr) | ||
395 | { | ||
396 | ev_in.canvas.x = e->pointer.x; | ||
397 | ev_in.canvas.y = e->pointer.y; | ||
398 | _evas_event_havemap_adjust(obj_itr, &ev_in.canvas.x, &ev_in.canvas.y, obj_itr->mouse_grabbed); | ||
399 | if (!eina_list_data_find(e->pointer.object.in, obj_itr)) | ||
400 | { | ||
401 | if (!obj_itr->mouse_in) | ||
402 | { | ||
403 | obj_itr->mouse_in = 1; | ||
404 | if (e->events_frozen <= 0) | ||
405 | evas_object_event_callback_call(obj_itr, EVAS_CALLBACK_MOUSE_IN, &ev_in, event_id); | ||
406 | } | ||
407 | } | ||
408 | if (e->delete_me) break; | ||
409 | } | ||
410 | post_called = 1; | ||
411 | _evas_post_event_callback_call(e); | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | ins = eina_list_free(ins); | ||
416 | } | ||
417 | |||
418 | if (e->pointer.mouse_grabbed == 0) | ||
419 | { | ||
420 | /* free our old list of ins */ | ||
421 | eina_list_free(e->pointer.object.in); | ||
422 | /* and set up the new one */ | ||
423 | e->pointer.object.in = ins; | ||
424 | } | ||
425 | else | ||
426 | { | ||
427 | /* free our cur ins */ | ||
428 | eina_list_free(ins); | ||
429 | } | ||
430 | if (e->pointer.inside) | ||
431 | evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data); | ||
432 | return post_called; | ||
433 | } | ||
434 | |||
435 | EAPI void | ||
436 | evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data) | ||
437 | { | ||
438 | Eina_List *l, *copy; | ||
439 | |||
440 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
441 | return; | ||
442 | MAGIC_CHECK_END(); | ||
443 | |||
444 | if ((b < 1) || (b > 32)) return; | ||
445 | |||
446 | e->pointer.button &= ~(1 << (b - 1)); | ||
447 | e->pointer.downs--; | ||
448 | |||
449 | if (e->events_frozen > 0) return; | ||
450 | e->last_timestamp = timestamp; | ||
451 | |||
452 | { | ||
453 | Evas_Event_Mouse_Up ev; | ||
454 | Evas_Object *obj; | ||
455 | int event_id = 0; | ||
456 | |||
457 | _evas_object_event_new(); | ||
458 | |||
459 | event_id = _evas_event_counter; | ||
460 | ev.button = b; | ||
461 | ev.output.x = e->pointer.x; | ||
462 | ev.output.y = e->pointer.y; | ||
463 | ev.canvas.x = e->pointer.x; | ||
464 | ev.canvas.y = e->pointer.y; | ||
465 | ev.data = (void *)data; | ||
466 | ev.modifiers = &(e->modifiers); | ||
467 | ev.locks = &(e->locks); | ||
468 | ev.flags = flags; | ||
469 | ev.timestamp = timestamp; | ||
470 | ev.event_flags = e->default_event_flags; | ||
471 | |||
472 | _evas_walk(e); | ||
473 | /* update released touch point */ | ||
474 | _evas_touch_point_update(e, 0, e->pointer.x, e->pointer.y, EVAS_TOUCH_POINT_UP); | ||
475 | copy = evas_event_list_copy(e->pointer.object.in); | ||
476 | EINA_LIST_FOREACH(copy, l, obj) | ||
477 | { | ||
478 | ev.canvas.x = e->pointer.x; | ||
479 | ev.canvas.y = e->pointer.y; | ||
480 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
481 | if ((obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_AUTOGRAB) && | ||
482 | (obj->mouse_grabbed > 0)) | ||
483 | { | ||
484 | obj->mouse_grabbed--; | ||
485 | e->pointer.mouse_grabbed--; | ||
486 | } | ||
487 | if (!obj->delete_me) | ||
488 | { | ||
489 | if ((e->events_frozen <= 0) && | ||
490 | (!evas_event_freezes_through(obj))) | ||
491 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_UP, &ev, event_id); | ||
492 | } | ||
493 | if (e->delete_me) break; | ||
494 | if (obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN) | ||
495 | { | ||
496 | if (e->pointer.nogrep > 0) e->pointer.nogrep--; | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | if (copy) copy = eina_list_free(copy); | ||
501 | e->last_mouse_up_counter++; | ||
502 | _evas_post_event_callback_call(e); | ||
503 | } | ||
504 | |||
505 | if (e->pointer.mouse_grabbed == 0) | ||
506 | { | ||
507 | _post_up_handle(e, timestamp, data); | ||
508 | } | ||
509 | |||
510 | if (e->pointer.mouse_grabbed < 0) | ||
511 | { | ||
512 | ERR("BUG? e->pointer.mouse_grabbed (=%d) < 0!", | ||
513 | e->pointer.mouse_grabbed); | ||
514 | } | ||
515 | /* remove released touch point from the touch point list */ | ||
516 | _evas_touch_point_remove(e, 0); | ||
517 | |||
518 | _evas_unwalk(e); | ||
519 | } | ||
520 | |||
521 | EAPI void | ||
522 | evas_event_feed_mouse_cancel(Evas *e, unsigned int timestamp, const void *data) | ||
523 | { | ||
524 | int i; | ||
525 | |||
526 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
527 | return; | ||
528 | MAGIC_CHECK_END(); | ||
529 | |||
530 | if (e->events_frozen > 0) return; | ||
531 | |||
532 | _evas_walk(e); | ||
533 | for (i = 0; i < 32; i++) | ||
534 | { | ||
535 | if ((e->pointer.button & (1 << i))) | ||
536 | evas_event_feed_mouse_up(e, i + 1, 0, timestamp, data); | ||
537 | } | ||
538 | // FIXME: multi cancel too? | ||
539 | _evas_unwalk(e); | ||
540 | } | ||
541 | |||
542 | EAPI void | ||
543 | evas_event_feed_mouse_wheel(Evas *e, int direction, int z, unsigned int timestamp, const void *data) | ||
544 | { | ||
545 | Eina_List *l, *copy; | ||
546 | Evas_Event_Mouse_Wheel ev; | ||
547 | Evas_Object *obj; | ||
548 | int event_id = 0; | ||
549 | |||
550 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
551 | return; | ||
552 | MAGIC_CHECK_END(); | ||
553 | |||
554 | if (e->events_frozen > 0) return; | ||
555 | e->last_timestamp = timestamp; | ||
556 | |||
557 | _evas_object_event_new(); | ||
558 | |||
559 | event_id = _evas_event_counter; | ||
560 | ev.direction = direction; | ||
561 | ev.z = z; | ||
562 | ev.output.x = e->pointer.x; | ||
563 | ev.output.y = e->pointer.y; | ||
564 | ev.canvas.x = e->pointer.x; | ||
565 | ev.canvas.y = e->pointer.y; | ||
566 | ev.data = (void *) data; | ||
567 | ev.modifiers = &(e->modifiers); | ||
568 | ev.locks = &(e->locks); | ||
569 | ev.timestamp = timestamp; | ||
570 | ev.event_flags = e->default_event_flags; | ||
571 | |||
572 | _evas_walk(e); | ||
573 | copy = evas_event_list_copy(e->pointer.object.in); | ||
574 | |||
575 | EINA_LIST_FOREACH(copy, l, obj) | ||
576 | { | ||
577 | ev.canvas.x = e->pointer.x; | ||
578 | ev.canvas.y = e->pointer.y; | ||
579 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
580 | if ((e->events_frozen <= 0) && !evas_event_freezes_through(obj)) | ||
581 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_WHEEL, &ev, event_id); | ||
582 | if (e->delete_me) break; | ||
583 | } | ||
584 | if (copy) copy = eina_list_free(copy); | ||
585 | _evas_post_event_callback_call(e); | ||
586 | |||
587 | _evas_unwalk(e); | ||
588 | } | ||
589 | |||
590 | EAPI void | ||
591 | evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const void *data) | ||
592 | { | ||
593 | Evas_Object *nogrep_obj = NULL; | ||
594 | int px, py; | ||
595 | //// Evas_Coord pcx, pcy; | ||
596 | |||
597 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
598 | return; | ||
599 | MAGIC_CHECK_END(); | ||
600 | |||
601 | px = e->pointer.x; | ||
602 | py = e->pointer.y; | ||
603 | //// pcx = e->pointer.canvas_x; | ||
604 | //// pcy = e->pointer.canvas_y; | ||
605 | |||
606 | if (e->events_frozen > 0) return; | ||
607 | e->last_timestamp = timestamp; | ||
608 | |||
609 | e->pointer.x = x; | ||
610 | e->pointer.y = y; | ||
611 | //// e->pointer.canvas_x = x; | ||
612 | //// e->pointer.canvas_y = y; | ||
613 | //// e->pointer.canvas_x = evas_coord_screen_x_to_world(e, x); | ||
614 | //// e->pointer.canvas_y = evas_coord_screen_y_to_world(e, y); | ||
615 | if ((!e->pointer.inside) && (e->pointer.mouse_grabbed == 0)) return; | ||
616 | _evas_walk(e); | ||
617 | /* update moved touch point */ | ||
618 | if ((px != x) || (py != y)) | ||
619 | _evas_touch_point_update(e, 0, e->pointer.x, e->pointer.y, EVAS_TOUCH_POINT_MOVE); | ||
620 | /* if our mouse button is grabbed to any objects */ | ||
621 | if (e->pointer.mouse_grabbed > 0) | ||
622 | { | ||
623 | /* go thru old list of in objects */ | ||
624 | Eina_List *outs = NULL; | ||
625 | Eina_List *l, *copy; | ||
626 | |||
627 | { | ||
628 | Evas_Event_Mouse_Move ev; | ||
629 | Evas_Object *obj; | ||
630 | int event_id = 0; | ||
631 | |||
632 | _evas_object_event_new(); | ||
633 | |||
634 | event_id = _evas_event_counter; | ||
635 | ev.buttons = e->pointer.button; | ||
636 | ev.cur.output.x = e->pointer.x; | ||
637 | ev.cur.output.y = e->pointer.y; | ||
638 | ev.cur.canvas.x = e->pointer.x; | ||
639 | ev.cur.canvas.y = e->pointer.y; | ||
640 | ev.prev.output.x = px; | ||
641 | ev.prev.output.y = py; | ||
642 | ev.prev.canvas.x = px; | ||
643 | ev.prev.canvas.y = py; | ||
644 | ev.data = (void *)data; | ||
645 | ev.modifiers = &(e->modifiers); | ||
646 | ev.locks = &(e->locks); | ||
647 | ev.timestamp = timestamp; | ||
648 | ev.event_flags = e->default_event_flags; | ||
649 | copy = evas_event_list_copy(e->pointer.object.in); | ||
650 | EINA_LIST_FOREACH(copy, l, obj) | ||
651 | { | ||
652 | ev.cur.canvas.x = e->pointer.x; | ||
653 | ev.cur.canvas.y = e->pointer.y; | ||
654 | _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, | ||
655 | &ev.cur.canvas.y, | ||
656 | obj->mouse_grabbed); | ||
657 | if ((e->events_frozen <= 0) && | ||
658 | (evas_object_clippers_is_visible(obj) || | ||
659 | obj->mouse_grabbed) && | ||
660 | (!evas_event_passes_through(obj)) && | ||
661 | (!evas_event_freezes_through(obj)) && | ||
662 | (!obj->clip.clipees)) | ||
663 | { | ||
664 | if ((px != x) || (py != y)) | ||
665 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id); | ||
666 | } | ||
667 | else | ||
668 | outs = eina_list_append(outs, obj); | ||
669 | if ((obj->pointer_mode == EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN) && | ||
670 | (e->pointer.nogrep > 0)) | ||
671 | { | ||
672 | eina_list_free(copy); | ||
673 | nogrep_obj = obj; | ||
674 | goto nogrep; | ||
675 | } | ||
676 | if (e->delete_me) break; | ||
677 | } | ||
678 | _evas_post_event_callback_call(e); | ||
679 | } | ||
680 | { | ||
681 | Evas_Event_Mouse_Out ev; | ||
682 | int event_id = 0; | ||
683 | |||
684 | _evas_object_event_new(); | ||
685 | |||
686 | event_id = _evas_event_counter; | ||
687 | ev.buttons = e->pointer.button; | ||
688 | ev.output.x = e->pointer.x; | ||
689 | ev.output.y = e->pointer.y; | ||
690 | ev.canvas.x = e->pointer.x; | ||
691 | ev.canvas.y = e->pointer.y; | ||
692 | ev.data = (void *)data; | ||
693 | ev.modifiers = &(e->modifiers); | ||
694 | ev.locks = &(e->locks); | ||
695 | ev.timestamp = timestamp; | ||
696 | ev.event_flags = e->default_event_flags; | ||
697 | |||
698 | if (copy) eina_list_free(copy); | ||
699 | while (outs) | ||
700 | { | ||
701 | Evas_Object *obj; | ||
702 | |||
703 | obj = outs->data; | ||
704 | outs = eina_list_remove(outs, obj); | ||
705 | if ((obj->mouse_grabbed == 0) && (!e->delete_me)) | ||
706 | { | ||
707 | ev.canvas.x = e->pointer.x; | ||
708 | ev.canvas.y = e->pointer.y; | ||
709 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
710 | e->pointer.object.in = eina_list_remove(e->pointer.object.in, obj); | ||
711 | if (obj->mouse_in) | ||
712 | { | ||
713 | obj->mouse_in = 0; | ||
714 | if (!obj->delete_me) | ||
715 | { | ||
716 | if (e->events_frozen <= 0) | ||
717 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev, event_id); | ||
718 | } | ||
719 | } | ||
720 | } | ||
721 | } | ||
722 | _evas_post_event_callback_call(e); | ||
723 | } | ||
724 | } | ||
725 | else | ||
726 | { | ||
727 | Eina_List *ins; | ||
728 | Eina_List *l, *copy; | ||
729 | Evas_Event_Mouse_Move ev; | ||
730 | Evas_Event_Mouse_Out ev2; | ||
731 | Evas_Event_Mouse_In ev3; | ||
732 | Evas_Object *obj; | ||
733 | int event_id = 0, event_id2 = 0; | ||
734 | |||
735 | _evas_object_event_new(); | ||
736 | |||
737 | event_id = _evas_event_counter; | ||
738 | ev.buttons = e->pointer.button; | ||
739 | ev.cur.output.x = e->pointer.x; | ||
740 | ev.cur.output.y = e->pointer.y; | ||
741 | ev.cur.canvas.x = e->pointer.x; | ||
742 | ev.cur.canvas.y = e->pointer.y; | ||
743 | ev.prev.output.x = px; | ||
744 | ev.prev.output.y = py; | ||
745 | ev.prev.canvas.x = px; | ||
746 | ev.prev.canvas.y = py; | ||
747 | ev.data = (void *)data; | ||
748 | ev.modifiers = &(e->modifiers); | ||
749 | ev.locks = &(e->locks); | ||
750 | ev.timestamp = timestamp; | ||
751 | ev.event_flags = e->default_event_flags; | ||
752 | |||
753 | ev2.buttons = e->pointer.button; | ||
754 | ev2.output.x = e->pointer.x; | ||
755 | ev2.output.y = e->pointer.y; | ||
756 | ev2.canvas.x = e->pointer.x; | ||
757 | ev2.canvas.y = e->pointer.y; | ||
758 | ev2.data = (void *)data; | ||
759 | ev2.modifiers = &(e->modifiers); | ||
760 | ev2.locks = &(e->locks); | ||
761 | ev2.timestamp = timestamp; | ||
762 | ev2.event_flags = e->default_event_flags; | ||
763 | |||
764 | ev3.buttons = e->pointer.button; | ||
765 | ev3.output.x = e->pointer.x; | ||
766 | ev3.output.y = e->pointer.y; | ||
767 | ev3.canvas.x = e->pointer.x; | ||
768 | ev3.canvas.y = e->pointer.y; | ||
769 | ev3.data = (void *)data; | ||
770 | ev3.modifiers = &(e->modifiers); | ||
771 | ev3.locks = &(e->locks); | ||
772 | ev3.timestamp = timestamp; | ||
773 | ev3.event_flags = e->default_event_flags; | ||
774 | |||
775 | /* get all new in objects */ | ||
776 | ins = evas_event_objects_event_list(e, NULL, x, y); | ||
777 | /* go thru old list of in objects */ | ||
778 | copy = evas_event_list_copy(e->pointer.object.in); | ||
779 | EINA_LIST_FOREACH(copy, l, obj) | ||
780 | { | ||
781 | /* if its under the pointer and its visible and its in the new */ | ||
782 | /* in list */ | ||
783 | // FIXME: i don't think we need this | ||
784 | // evas_object_clip_recalc(obj); | ||
785 | if ((e->events_frozen <= 0) && | ||
786 | evas_object_is_in_output_rect(obj, x, y, 1, 1) && | ||
787 | (evas_object_clippers_is_visible(obj) || | ||
788 | obj->mouse_grabbed) && | ||
789 | eina_list_data_find(ins, obj) && | ||
790 | (!evas_event_passes_through(obj)) && | ||
791 | (!evas_event_freezes_through(obj)) && | ||
792 | (!obj->clip.clipees) && | ||
793 | ((!obj->precise_is_inside) || evas_object_is_inside(obj, x, y)) | ||
794 | ) | ||
795 | { | ||
796 | if ((px != x) || (py != y)) | ||
797 | { | ||
798 | ev.cur.canvas.x = e->pointer.x; | ||
799 | ev.cur.canvas.y = e->pointer.y; | ||
800 | _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); | ||
801 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id); | ||
802 | } | ||
803 | } | ||
804 | /* otherwise it has left the object */ | ||
805 | else | ||
806 | { | ||
807 | if (obj->mouse_in) | ||
808 | { | ||
809 | obj->mouse_in = 0; | ||
810 | ev2.canvas.x = e->pointer.x; | ||
811 | ev2.canvas.y = e->pointer.y; | ||
812 | _evas_event_havemap_adjust(obj, &ev2.canvas.x, &ev2.canvas.y, obj->mouse_grabbed); | ||
813 | if (e->events_frozen <= 0) | ||
814 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev2, event_id); | ||
815 | } | ||
816 | } | ||
817 | if (e->delete_me) break; | ||
818 | } | ||
819 | _evas_post_event_callback_call(e); | ||
820 | |||
821 | _evas_object_event_new(); | ||
822 | |||
823 | event_id2 = _evas_event_counter; | ||
824 | if (copy) copy = eina_list_free(copy); | ||
825 | /* go thru our current list of ins */ | ||
826 | EINA_LIST_FOREACH(ins, l, obj) | ||
827 | { | ||
828 | ev3.canvas.x = e->pointer.x; | ||
829 | ev3.canvas.y = e->pointer.y; | ||
830 | _evas_event_havemap_adjust(obj, &ev3.canvas.x, &ev3.canvas.y, obj->mouse_grabbed); | ||
831 | /* if its not in the old list of ins send an enter event */ | ||
832 | if (!eina_list_data_find(e->pointer.object.in, obj)) | ||
833 | { | ||
834 | if (!obj->mouse_in) | ||
835 | { | ||
836 | obj->mouse_in = 1; | ||
837 | if (e->events_frozen <= 0) | ||
838 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev3, event_id2); | ||
839 | } | ||
840 | } | ||
841 | if (e->delete_me) break; | ||
842 | } | ||
843 | if (e->pointer.mouse_grabbed == 0) | ||
844 | { | ||
845 | /* free our old list of ins */ | ||
846 | eina_list_free(e->pointer.object.in); | ||
847 | /* and set up the new one */ | ||
848 | e->pointer.object.in = ins; | ||
849 | } | ||
850 | else | ||
851 | { | ||
852 | /* free our cur ins */ | ||
853 | eina_list_free(ins); | ||
854 | } | ||
855 | _evas_post_event_callback_call(e); | ||
856 | } | ||
857 | _evas_unwalk(e); | ||
858 | return; | ||
859 | nogrep: | ||
860 | { | ||
861 | Eina_List *ins = NULL; | ||
862 | Eina_List *newin = NULL; | ||
863 | Eina_List *l, *copy, *lst = NULL; | ||
864 | Evas_Event_Mouse_Move ev; | ||
865 | Evas_Event_Mouse_Out ev2; | ||
866 | Evas_Event_Mouse_In ev3; | ||
867 | Evas_Object *obj, *below_obj; | ||
868 | int event_id = 0, event_id2 = 0; | ||
869 | int norep = 0, breaknext = 0; | ||
870 | |||
871 | _evas_object_event_new(); | ||
872 | |||
873 | event_id = _evas_event_counter; | ||
874 | ev.buttons = e->pointer.button; | ||
875 | ev.cur.output.x = e->pointer.x; | ||
876 | ev.cur.output.y = e->pointer.y; | ||
877 | ev.cur.canvas.x = e->pointer.x; | ||
878 | ev.cur.canvas.y = e->pointer.y; | ||
879 | ev.prev.output.x = px; | ||
880 | ev.prev.output.y = py; | ||
881 | ev.prev.canvas.x = px; | ||
882 | ev.prev.canvas.y = py; | ||
883 | ev.data = (void *)data; | ||
884 | ev.modifiers = &(e->modifiers); | ||
885 | ev.locks = &(e->locks); | ||
886 | ev.timestamp = timestamp; | ||
887 | ev.event_flags = e->default_event_flags; | ||
888 | |||
889 | ev2.buttons = e->pointer.button; | ||
890 | ev2.output.x = e->pointer.x; | ||
891 | ev2.output.y = e->pointer.y; | ||
892 | ev2.canvas.x = e->pointer.x; | ||
893 | ev2.canvas.y = e->pointer.y; | ||
894 | ev2.data = (void *)data; | ||
895 | ev2.modifiers = &(e->modifiers); | ||
896 | ev2.locks = &(e->locks); | ||
897 | ev2.timestamp = timestamp; | ||
898 | ev2.event_flags = e->default_event_flags; | ||
899 | |||
900 | ev3.buttons = e->pointer.button; | ||
901 | ev3.output.x = e->pointer.x; | ||
902 | ev3.output.y = e->pointer.y; | ||
903 | ev3.canvas.x = e->pointer.x; | ||
904 | ev3.canvas.y = e->pointer.y; | ||
905 | ev3.data = (void *)data; | ||
906 | ev3.modifiers = &(e->modifiers); | ||
907 | ev3.locks = &(e->locks); | ||
908 | ev3.timestamp = timestamp; | ||
909 | ev3.event_flags = e->default_event_flags; | ||
910 | |||
911 | /* go thru old list of in objects */ | ||
912 | copy = evas_event_list_copy(e->pointer.object.in); | ||
913 | EINA_LIST_FOREACH(copy, l, obj) | ||
914 | { | ||
915 | if (breaknext) | ||
916 | { | ||
917 | lst = l; | ||
918 | break; | ||
919 | } | ||
920 | if (obj == nogrep_obj) breaknext = 1; | ||
921 | } | ||
922 | |||
923 | /* get all new in objects */ | ||
924 | below_obj = evas_object_below_get(nogrep_obj); | ||
925 | if (below_obj) | ||
926 | ins = _evas_event_object_list_raw_in_get(e, NULL, | ||
927 | EINA_INLIST_GET(below_obj), NULL, | ||
928 | e->pointer.x, e->pointer.y, | ||
929 | &norep); | ||
930 | EINA_LIST_FOREACH(copy, l, obj) | ||
931 | { | ||
932 | newin = eina_list_append(newin, obj); | ||
933 | if (obj == nogrep_obj) break; | ||
934 | } | ||
935 | EINA_LIST_FOREACH(ins, l, obj) | ||
936 | { | ||
937 | newin = eina_list_append(newin, obj); | ||
938 | } | ||
939 | |||
940 | EINA_LIST_FOREACH(lst, l, obj) | ||
941 | { | ||
942 | /* if its under the pointer and its visible and its in the new */ | ||
943 | /* in list */ | ||
944 | // FIXME: i don't think we need this | ||
945 | // evas_object_clip_recalc(obj); | ||
946 | if ((e->events_frozen <= 0) && | ||
947 | evas_object_is_in_output_rect(obj, x, y, 1, 1) && | ||
948 | (evas_object_clippers_is_visible(obj) || | ||
949 | obj->mouse_grabbed) && | ||
950 | eina_list_data_find(newin, obj) && | ||
951 | (!evas_event_passes_through(obj)) && | ||
952 | (!evas_event_freezes_through(obj)) && | ||
953 | (!obj->clip.clipees) && | ||
954 | ((!obj->precise_is_inside) || evas_object_is_inside(obj, x, y)) | ||
955 | ) | ||
956 | { | ||
957 | if ((px != x) || (py != y)) | ||
958 | { | ||
959 | ev.cur.canvas.x = e->pointer.x; | ||
960 | ev.cur.canvas.y = e->pointer.y; | ||
961 | _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); | ||
962 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev, event_id); | ||
963 | } | ||
964 | } | ||
965 | /* otherwise it has left the object */ | ||
966 | else | ||
967 | { | ||
968 | if (obj->mouse_in) | ||
969 | { | ||
970 | obj->mouse_in = 0; | ||
971 | ev2.canvas.x = e->pointer.x; | ||
972 | ev2.canvas.y = e->pointer.y; | ||
973 | _evas_event_havemap_adjust(obj, &ev2.canvas.x, &ev2.canvas.y, obj->mouse_grabbed); | ||
974 | if (e->events_frozen <= 0) | ||
975 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev2, event_id); | ||
976 | } | ||
977 | } | ||
978 | if (e->delete_me) break; | ||
979 | } | ||
980 | _evas_post_event_callback_call(e); | ||
981 | |||
982 | _evas_object_event_new(); | ||
983 | |||
984 | event_id2 = _evas_event_counter; | ||
985 | if (copy) copy = eina_list_free(copy); | ||
986 | /* go thru our current list of ins */ | ||
987 | EINA_LIST_FOREACH(newin, l, obj) | ||
988 | { | ||
989 | ev3.canvas.x = e->pointer.x; | ||
990 | ev3.canvas.y = e->pointer.y; | ||
991 | _evas_event_havemap_adjust(obj, &ev3.canvas.x, &ev3.canvas.y, obj->mouse_grabbed); | ||
992 | /* if its not in the old list of ins send an enter event */ | ||
993 | if (!eina_list_data_find(e->pointer.object.in, obj)) | ||
994 | { | ||
995 | if (!obj->mouse_in) | ||
996 | { | ||
997 | obj->mouse_in = 1; | ||
998 | if (e->events_frozen <= 0) | ||
999 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev3, event_id2); | ||
1000 | } | ||
1001 | } | ||
1002 | if (e->delete_me) break; | ||
1003 | } | ||
1004 | /* free our old list of ins */ | ||
1005 | eina_list_free(e->pointer.object.in); | ||
1006 | /* and set up the new one */ | ||
1007 | e->pointer.object.in = newin; | ||
1008 | |||
1009 | _evas_post_event_callback_call(e); | ||
1010 | } | ||
1011 | _evas_unwalk(e); | ||
1012 | } | ||
1013 | |||
1014 | EAPI void | ||
1015 | evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data) | ||
1016 | { | ||
1017 | Eina_List *ins; | ||
1018 | Eina_List *l; | ||
1019 | Evas_Event_Mouse_In ev; | ||
1020 | Evas_Object *obj; | ||
1021 | int event_id = 0; | ||
1022 | |||
1023 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1024 | return; | ||
1025 | MAGIC_CHECK_END(); | ||
1026 | e->pointer.inside = 1; | ||
1027 | |||
1028 | if (e->events_frozen > 0) return; | ||
1029 | e->last_timestamp = timestamp; | ||
1030 | |||
1031 | if (e->pointer.mouse_grabbed != 0) return; | ||
1032 | |||
1033 | _evas_object_event_new(); | ||
1034 | |||
1035 | event_id = _evas_event_counter; | ||
1036 | ev.buttons = e->pointer.button; | ||
1037 | ev.output.x = e->pointer.x; | ||
1038 | ev.output.y = e->pointer.y; | ||
1039 | ev.canvas.x = e->pointer.x; | ||
1040 | ev.canvas.y = e->pointer.y; | ||
1041 | ev.data = (void *)data; | ||
1042 | ev.modifiers = &(e->modifiers); | ||
1043 | ev.locks = &(e->locks); | ||
1044 | ev.timestamp = timestamp; | ||
1045 | ev.event_flags = e->default_event_flags; | ||
1046 | |||
1047 | _evas_walk(e); | ||
1048 | /* get new list of ins */ | ||
1049 | ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y); | ||
1050 | EINA_LIST_FOREACH(ins, l, obj) | ||
1051 | { | ||
1052 | ev.canvas.x = e->pointer.x; | ||
1053 | ev.canvas.y = e->pointer.y; | ||
1054 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
1055 | if (!eina_list_data_find(e->pointer.object.in, obj)) | ||
1056 | { | ||
1057 | if (!obj->mouse_in) | ||
1058 | { | ||
1059 | obj->mouse_in = 1; | ||
1060 | if (e->events_frozen <= 0) | ||
1061 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev, event_id); | ||
1062 | } | ||
1063 | } | ||
1064 | if (e->delete_me) break; | ||
1065 | } | ||
1066 | /* free our old list of ins */ | ||
1067 | e->pointer.object.in = eina_list_free(e->pointer.object.in); | ||
1068 | /* and set up the new one */ | ||
1069 | e->pointer.object.in = ins; | ||
1070 | _evas_post_event_callback_call(e); | ||
1071 | evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data); | ||
1072 | _evas_unwalk(e); | ||
1073 | } | ||
1074 | |||
1075 | EAPI void | ||
1076 | evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data) | ||
1077 | { | ||
1078 | Evas_Event_Mouse_Out ev; | ||
1079 | int event_id = 0; | ||
1080 | |||
1081 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1082 | return; | ||
1083 | MAGIC_CHECK_END(); | ||
1084 | e->pointer.inside = 0; | ||
1085 | |||
1086 | if (e->events_frozen > 0) return; | ||
1087 | e->last_timestamp = timestamp; | ||
1088 | |||
1089 | _evas_object_event_new(); | ||
1090 | |||
1091 | event_id = _evas_event_counter; | ||
1092 | ev.buttons = e->pointer.button; | ||
1093 | ev.output.x = e->pointer.x; | ||
1094 | ev.output.y = e->pointer.y; | ||
1095 | ev.canvas.x = e->pointer.x; | ||
1096 | ev.canvas.y = e->pointer.y; | ||
1097 | ev.data = (void *)data; | ||
1098 | ev.modifiers = &(e->modifiers); | ||
1099 | ev.locks = &(e->locks); | ||
1100 | ev.timestamp = timestamp; | ||
1101 | ev.event_flags = e->default_event_flags; | ||
1102 | |||
1103 | _evas_walk(e); | ||
1104 | /* if our mouse button is inside any objects */ | ||
1105 | { | ||
1106 | /* go thru old list of in objects */ | ||
1107 | Eina_List *l, *copy; | ||
1108 | Evas_Object *obj; | ||
1109 | |||
1110 | copy = evas_event_list_copy(e->pointer.object.in); | ||
1111 | EINA_LIST_FOREACH(copy, l, obj) | ||
1112 | { | ||
1113 | ev.canvas.x = e->pointer.x; | ||
1114 | ev.canvas.y = e->pointer.y; | ||
1115 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
1116 | if (obj->mouse_in) | ||
1117 | { | ||
1118 | obj->mouse_in = 0; | ||
1119 | if (!obj->delete_me) | ||
1120 | { | ||
1121 | if (e->events_frozen <= 0) | ||
1122 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev, event_id); | ||
1123 | } | ||
1124 | obj->mouse_grabbed = 0; | ||
1125 | } | ||
1126 | if (e->delete_me) break; | ||
1127 | } | ||
1128 | if (copy) copy = eina_list_free(copy); | ||
1129 | /* free our old list of ins */ | ||
1130 | e->pointer.object.in = eina_list_free(e->pointer.object.in); | ||
1131 | e->pointer.mouse_grabbed = 0; | ||
1132 | _evas_post_event_callback_call(e); | ||
1133 | } | ||
1134 | _evas_unwalk(e); | ||
1135 | } | ||
1136 | |||
1137 | EAPI void | ||
1138 | evas_event_feed_multi_down(Evas *e, | ||
1139 | int d, int x, int y, | ||
1140 | double rad, double radx, double rady, | ||
1141 | double pres, double ang, | ||
1142 | double fx, double fy, | ||
1143 | Evas_Button_Flags flags, unsigned int timestamp, | ||
1144 | const void *data) | ||
1145 | { | ||
1146 | Eina_List *l, *copy; | ||
1147 | Evas_Event_Multi_Down ev; | ||
1148 | Evas_Object *obj; | ||
1149 | int addgrab = 0; | ||
1150 | int event_id = 0; | ||
1151 | |||
1152 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1153 | return; | ||
1154 | MAGIC_CHECK_END(); | ||
1155 | |||
1156 | e->pointer.downs++; | ||
1157 | if (e->events_frozen > 0) return; | ||
1158 | e->last_timestamp = timestamp; | ||
1159 | |||
1160 | _evas_object_event_new(); | ||
1161 | |||
1162 | event_id = _evas_event_counter; | ||
1163 | ev.device = d; | ||
1164 | ev.output.x = x; | ||
1165 | ev.output.y = y; | ||
1166 | ev.canvas.x = x; | ||
1167 | ev.canvas.y = y; | ||
1168 | ev.radius = rad; | ||
1169 | ev.radius_x = radx; | ||
1170 | ev.radius_y = rady; | ||
1171 | ev.pressure = pres; | ||
1172 | ev.angle = ang; | ||
1173 | ev.canvas.xsub = fx; | ||
1174 | ev.canvas.ysub = fy; | ||
1175 | ev.data = (void *)data; | ||
1176 | ev.modifiers = &(e->modifiers); | ||
1177 | ev.locks = &(e->locks); | ||
1178 | ev.flags = flags; | ||
1179 | ev.timestamp = timestamp; | ||
1180 | ev.event_flags = e->default_event_flags; | ||
1181 | |||
1182 | _evas_walk(e); | ||
1183 | /* append new touch point to the touch point list */ | ||
1184 | _evas_touch_point_append(e, d, x, y); | ||
1185 | if (e->pointer.mouse_grabbed == 0) | ||
1186 | { | ||
1187 | if (e->pointer.downs > 1) addgrab = e->pointer.downs - 1; | ||
1188 | } | ||
1189 | copy = evas_event_list_copy(e->pointer.object.in); | ||
1190 | EINA_LIST_FOREACH(copy, l, obj) | ||
1191 | { | ||
1192 | if (obj->pointer_mode != EVAS_OBJECT_POINTER_MODE_NOGRAB) | ||
1193 | { | ||
1194 | obj->mouse_grabbed += addgrab + 1; | ||
1195 | e->pointer.mouse_grabbed += addgrab + 1; | ||
1196 | } | ||
1197 | } | ||
1198 | EINA_LIST_FOREACH(copy, l, obj) | ||
1199 | { | ||
1200 | ev.canvas.x = x; | ||
1201 | ev.canvas.y = y; | ||
1202 | ev.canvas.xsub = fx; | ||
1203 | ev.canvas.ysub = fy; | ||
1204 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
1205 | if (x != ev.canvas.x) | ||
1206 | ev.canvas.xsub = ev.canvas.x; // fixme - lost precision | ||
1207 | if (y != ev.canvas.y) | ||
1208 | ev.canvas.ysub = ev.canvas.y; // fixme - lost precision | ||
1209 | if (e->events_frozen <= 0) | ||
1210 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_DOWN, &ev, event_id); | ||
1211 | if (e->delete_me) break; | ||
1212 | } | ||
1213 | if (copy) eina_list_free(copy); | ||
1214 | _evas_post_event_callback_call(e); | ||
1215 | /* update touch point's state to EVAS_TOUCH_POINT_STILL */ | ||
1216 | _evas_touch_point_update(e, d, x, y, EVAS_TOUCH_POINT_STILL); | ||
1217 | _evas_unwalk(e); | ||
1218 | } | ||
1219 | |||
1220 | EAPI void | ||
1221 | evas_event_feed_multi_up(Evas *e, | ||
1222 | int d, int x, int y, | ||
1223 | double rad, double radx, double rady, | ||
1224 | double pres, double ang, | ||
1225 | double fx, double fy, | ||
1226 | Evas_Button_Flags flags, unsigned int timestamp, | ||
1227 | const void *data) | ||
1228 | { | ||
1229 | Eina_List *l, *copy; | ||
1230 | Evas_Event_Multi_Up ev; | ||
1231 | Evas_Object *obj; | ||
1232 | int event_id = 0; | ||
1233 | |||
1234 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1235 | return; | ||
1236 | MAGIC_CHECK_END(); | ||
1237 | |||
1238 | e->pointer.downs--; | ||
1239 | if (e->events_frozen > 0) return; | ||
1240 | e->last_timestamp = timestamp; | ||
1241 | |||
1242 | _evas_object_event_new(); | ||
1243 | |||
1244 | event_id = _evas_event_counter; | ||
1245 | ev.device = d; | ||
1246 | ev.output.x = x; | ||
1247 | ev.output.y = y; | ||
1248 | ev.canvas.x = x; | ||
1249 | ev.canvas.y = y; | ||
1250 | ev.radius = rad; | ||
1251 | ev.radius_x = radx; | ||
1252 | ev.radius_y = rady; | ||
1253 | ev.pressure = pres; | ||
1254 | ev.angle = ang; | ||
1255 | ev.canvas.xsub = fx; | ||
1256 | ev.canvas.ysub = fy; | ||
1257 | ev.data = (void *)data; | ||
1258 | ev.modifiers = &(e->modifiers); | ||
1259 | ev.locks = &(e->locks); | ||
1260 | ev.flags = flags; | ||
1261 | ev.timestamp = timestamp; | ||
1262 | ev.event_flags = e->default_event_flags; | ||
1263 | |||
1264 | _evas_walk(e); | ||
1265 | /* update released touch point */ | ||
1266 | _evas_touch_point_update(e, d, x, y, EVAS_TOUCH_POINT_UP); | ||
1267 | copy = evas_event_list_copy(e->pointer.object.in); | ||
1268 | EINA_LIST_FOREACH(copy, l, obj) | ||
1269 | { | ||
1270 | ev.canvas.x = x; | ||
1271 | ev.canvas.y = y; | ||
1272 | ev.canvas.xsub = fx; | ||
1273 | ev.canvas.ysub = fy; | ||
1274 | _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y, obj->mouse_grabbed); | ||
1275 | if (x != ev.canvas.x) | ||
1276 | ev.canvas.xsub = ev.canvas.x; // fixme - lost precision | ||
1277 | if (y != ev.canvas.y) | ||
1278 | ev.canvas.ysub = ev.canvas.y; // fixme - lost precision | ||
1279 | if ((obj->pointer_mode != EVAS_OBJECT_POINTER_MODE_NOGRAB) && | ||
1280 | (obj->mouse_grabbed > 0)) | ||
1281 | { | ||
1282 | obj->mouse_grabbed--; | ||
1283 | e->pointer.mouse_grabbed--; | ||
1284 | } | ||
1285 | if (e->events_frozen <= 0) | ||
1286 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_UP, &ev, event_id); | ||
1287 | if (e->delete_me) break; | ||
1288 | } | ||
1289 | if (copy) copy = eina_list_free(copy); | ||
1290 | if ((e->pointer.mouse_grabbed == 0) && !_post_up_handle(e, timestamp, data)) | ||
1291 | _evas_post_event_callback_call(e); | ||
1292 | /* remove released touch point from the touch point list */ | ||
1293 | _evas_touch_point_remove(e, d); | ||
1294 | _evas_unwalk(e); | ||
1295 | } | ||
1296 | |||
1297 | EAPI void | ||
1298 | evas_event_feed_multi_move(Evas *e, | ||
1299 | int d, int x, int y, | ||
1300 | double rad, double radx, double rady, | ||
1301 | double pres, double ang, | ||
1302 | double fx, double fy, | ||
1303 | unsigned int timestamp, const void *data) | ||
1304 | { | ||
1305 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1306 | return; | ||
1307 | MAGIC_CHECK_END(); | ||
1308 | |||
1309 | if (e->events_frozen > 0) return; | ||
1310 | e->last_timestamp = timestamp; | ||
1311 | |||
1312 | if ((!e->pointer.inside) && (e->pointer.mouse_grabbed == 0)) return; | ||
1313 | |||
1314 | _evas_walk(e); | ||
1315 | /* update moved touch point */ | ||
1316 | _evas_touch_point_update(e, d, x, y, EVAS_TOUCH_POINT_MOVE); | ||
1317 | /* if our mouse button is grabbed to any objects */ | ||
1318 | if (e->pointer.mouse_grabbed > 0) | ||
1319 | { | ||
1320 | /* go thru old list of in objects */ | ||
1321 | Eina_List *l, *copy; | ||
1322 | Evas_Event_Multi_Move ev; | ||
1323 | Evas_Object *obj; | ||
1324 | int event_id = 0; | ||
1325 | |||
1326 | _evas_object_event_new(); | ||
1327 | |||
1328 | event_id = _evas_event_counter; | ||
1329 | ev.device = d; | ||
1330 | ev.cur.output.x = x; | ||
1331 | ev.cur.output.y = y; | ||
1332 | ev.cur.canvas.x = x; | ||
1333 | ev.cur.canvas.y = y; | ||
1334 | ev.radius = rad; | ||
1335 | ev.radius_x = radx; | ||
1336 | ev.radius_y = rady; | ||
1337 | ev.pressure = pres; | ||
1338 | ev.angle = ang; | ||
1339 | ev.cur.canvas.xsub = fx; | ||
1340 | ev.cur.canvas.ysub = fy; | ||
1341 | ev.data = (void *)data; | ||
1342 | ev.modifiers = &(e->modifiers); | ||
1343 | ev.locks = &(e->locks); | ||
1344 | ev.timestamp = timestamp; | ||
1345 | ev.event_flags = e->default_event_flags; | ||
1346 | |||
1347 | copy = evas_event_list_copy(e->pointer.object.in); | ||
1348 | EINA_LIST_FOREACH(copy, l, obj) | ||
1349 | { | ||
1350 | if ((e->events_frozen <= 0) && | ||
1351 | (evas_object_clippers_is_visible(obj) || obj->mouse_grabbed) && | ||
1352 | (!evas_event_passes_through(obj)) && | ||
1353 | (!evas_event_freezes_through(obj)) && | ||
1354 | (!obj->clip.clipees)) | ||
1355 | { | ||
1356 | ev.cur.canvas.x = x; | ||
1357 | ev.cur.canvas.y = y; | ||
1358 | ev.cur.canvas.xsub = fx; | ||
1359 | ev.cur.canvas.ysub = fy; | ||
1360 | _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); | ||
1361 | if (x != ev.cur.canvas.x) | ||
1362 | ev.cur.canvas.xsub = ev.cur.canvas.x; // fixme - lost precision | ||
1363 | if (y != ev.cur.canvas.y) | ||
1364 | ev.cur.canvas.ysub = ev.cur.canvas.y; // fixme - lost precision | ||
1365 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_MOVE, &ev, event_id); | ||
1366 | } | ||
1367 | if (e->delete_me) break; | ||
1368 | } | ||
1369 | _evas_post_event_callback_call(e); | ||
1370 | } | ||
1371 | else | ||
1372 | { | ||
1373 | Eina_List *ins; | ||
1374 | Eina_List *l, *copy; | ||
1375 | Evas_Event_Multi_Move ev; | ||
1376 | Evas_Object *obj; | ||
1377 | int event_id = 0; | ||
1378 | |||
1379 | _evas_object_event_new(); | ||
1380 | |||
1381 | event_id = _evas_event_counter; | ||
1382 | ev.device = d; | ||
1383 | ev.cur.output.x = x; | ||
1384 | ev.cur.output.y = y; | ||
1385 | ev.cur.canvas.x = x; | ||
1386 | ev.cur.canvas.y = y; | ||
1387 | ev.radius = rad; | ||
1388 | ev.radius_x = radx; | ||
1389 | ev.radius_y = rady; | ||
1390 | ev.pressure = pres; | ||
1391 | ev.angle = ang; | ||
1392 | ev.cur.canvas.xsub = fx; | ||
1393 | ev.cur.canvas.ysub = fy; | ||
1394 | ev.data = (void *)data; | ||
1395 | ev.modifiers = &(e->modifiers); | ||
1396 | ev.locks = &(e->locks); | ||
1397 | ev.timestamp = timestamp; | ||
1398 | ev.event_flags = e->default_event_flags; | ||
1399 | |||
1400 | /* get all new in objects */ | ||
1401 | ins = evas_event_objects_event_list(e, NULL, x, y); | ||
1402 | /* go thru old list of in objects */ | ||
1403 | copy = evas_event_list_copy(e->pointer.object.in); | ||
1404 | EINA_LIST_FOREACH(copy, l, obj) | ||
1405 | { | ||
1406 | /* if its under the pointer and its visible and its in the new */ | ||
1407 | /* in list */ | ||
1408 | // FIXME: i don't think we need this | ||
1409 | // evas_object_clip_recalc(obj); | ||
1410 | if ((e->events_frozen <= 0) && | ||
1411 | evas_object_is_in_output_rect(obj, x, y, 1, 1) && | ||
1412 | (evas_object_clippers_is_visible(obj) || | ||
1413 | obj->mouse_grabbed) && | ||
1414 | eina_list_data_find(ins, obj) && | ||
1415 | (!evas_event_passes_through(obj)) && | ||
1416 | (!evas_event_freezes_through(obj)) && | ||
1417 | (!obj->clip.clipees) && | ||
1418 | ((!obj->precise_is_inside) || evas_object_is_inside(obj, x, y)) | ||
1419 | ) | ||
1420 | { | ||
1421 | ev.cur.canvas.x = x; | ||
1422 | ev.cur.canvas.y = y; | ||
1423 | ev.cur.canvas.xsub = fx; | ||
1424 | ev.cur.canvas.ysub = fy; | ||
1425 | _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y, obj->mouse_grabbed); | ||
1426 | if (x != ev.cur.canvas.x) | ||
1427 | ev.cur.canvas.xsub = ev.cur.canvas.x; // fixme - lost precision | ||
1428 | if (y != ev.cur.canvas.y) | ||
1429 | ev.cur.canvas.ysub = ev.cur.canvas.y; // fixme - lost precision | ||
1430 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_MOVE, &ev, event_id); | ||
1431 | } | ||
1432 | if (e->delete_me) break; | ||
1433 | } | ||
1434 | if (copy) copy = eina_list_free(copy); | ||
1435 | if (e->pointer.mouse_grabbed == 0) | ||
1436 | { | ||
1437 | /* free our old list of ins */ | ||
1438 | eina_list_free(e->pointer.object.in); | ||
1439 | /* and set up the new one */ | ||
1440 | e->pointer.object.in = ins; | ||
1441 | } | ||
1442 | else | ||
1443 | { | ||
1444 | /* free our cur ins */ | ||
1445 | eina_list_free(ins); | ||
1446 | } | ||
1447 | _evas_post_event_callback_call(e); | ||
1448 | } | ||
1449 | _evas_unwalk(e); | ||
1450 | } | ||
1451 | |||
1452 | EAPI void | ||
1453 | evas_event_feed_key_down(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) | ||
1454 | { | ||
1455 | int event_id = 0; | ||
1456 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1457 | return; | ||
1458 | MAGIC_CHECK_END(); | ||
1459 | |||
1460 | if (!keyname) return; | ||
1461 | if (e->events_frozen > 0) return; | ||
1462 | e->last_timestamp = timestamp; | ||
1463 | _evas_walk(e); | ||
1464 | |||
1465 | Evas_Event_Key_Down ev; | ||
1466 | Eina_Bool exclusive; | ||
1467 | |||
1468 | _evas_object_event_new(); | ||
1469 | |||
1470 | event_id = _evas_event_counter; | ||
1471 | exclusive = EINA_FALSE; | ||
1472 | ev.keyname = (char *)keyname; | ||
1473 | ev.data = (void *)data; | ||
1474 | ev.modifiers = &(e->modifiers); | ||
1475 | ev.locks = &(e->locks); | ||
1476 | ev.key = key; | ||
1477 | ev.string = string; | ||
1478 | ev.compose = compose; | ||
1479 | ev.timestamp = timestamp; | ||
1480 | ev.event_flags = e->default_event_flags; | ||
1481 | |||
1482 | if (e->grabs) | ||
1483 | { | ||
1484 | Eina_List *l; | ||
1485 | Evas_Key_Grab *g; | ||
1486 | |||
1487 | e->walking_grabs++; | ||
1488 | EINA_LIST_FOREACH(e->grabs, l, g) | ||
1489 | { | ||
1490 | if (g->just_added) | ||
1491 | { | ||
1492 | g->just_added = EINA_FALSE; | ||
1493 | continue; | ||
1494 | } | ||
1495 | if (g->delete_me) continue; | ||
1496 | if (((e->modifiers.mask & g->modifiers) || | ||
1497 | (g->modifiers == e->modifiers.mask)) && | ||
1498 | (!strcmp(keyname, g->keyname))) | ||
1499 | { | ||
1500 | if (!(e->modifiers.mask & g->not_modifiers)) | ||
1501 | { | ||
1502 | if (e->events_frozen <= 0 && | ||
1503 | !evas_event_freezes_through(g->object)) | ||
1504 | evas_object_event_callback_call(g->object, | ||
1505 | EVAS_CALLBACK_KEY_DOWN, | ||
1506 | &ev, event_id); | ||
1507 | if (g->exclusive) exclusive = EINA_TRUE; | ||
1508 | } | ||
1509 | } | ||
1510 | if (e->delete_me) break; | ||
1511 | } | ||
1512 | e->walking_grabs--; | ||
1513 | if (e->walking_grabs <= 0) | ||
1514 | { | ||
1515 | while (e->delete_grabs > 0) | ||
1516 | { | ||
1517 | e->delete_grabs--; | ||
1518 | for (l = e->grabs; l;) | ||
1519 | { | ||
1520 | g = eina_list_data_get(l); | ||
1521 | l = eina_list_next(l); | ||
1522 | if (g->delete_me) | ||
1523 | evas_key_grab_free(g->object, g->keyname, g->modifiers, | ||
1524 | g->not_modifiers); | ||
1525 | } | ||
1526 | } | ||
1527 | } | ||
1528 | } | ||
1529 | if ((e->focused) && (!exclusive)) | ||
1530 | { | ||
1531 | if (e->events_frozen <= 0 && !evas_event_freezes_through(e->focused)) | ||
1532 | evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_DOWN, | ||
1533 | &ev, event_id); | ||
1534 | } | ||
1535 | _evas_post_event_callback_call(e); | ||
1536 | _evas_unwalk(e); | ||
1537 | } | ||
1538 | |||
1539 | EAPI void | ||
1540 | evas_event_feed_key_up(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) | ||
1541 | { | ||
1542 | int event_id = 0; | ||
1543 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1544 | return; | ||
1545 | MAGIC_CHECK_END(); | ||
1546 | if (!keyname) return; | ||
1547 | if (e->events_frozen > 0) return; | ||
1548 | e->last_timestamp = timestamp; | ||
1549 | _evas_walk(e); | ||
1550 | |||
1551 | Evas_Event_Key_Up ev; | ||
1552 | Eina_Bool exclusive; | ||
1553 | |||
1554 | _evas_object_event_new(); | ||
1555 | |||
1556 | event_id = _evas_event_counter; | ||
1557 | exclusive = EINA_FALSE; | ||
1558 | ev.keyname = (char *)keyname; | ||
1559 | ev.data = (void *)data; | ||
1560 | ev.modifiers = &(e->modifiers); | ||
1561 | ev.locks = &(e->locks); | ||
1562 | ev.key = key; | ||
1563 | ev.string = string; | ||
1564 | ev.compose = compose; | ||
1565 | ev.timestamp = timestamp; | ||
1566 | ev.event_flags = e->default_event_flags; | ||
1567 | |||
1568 | if (e->grabs) | ||
1569 | { | ||
1570 | Eina_List *l; | ||
1571 | Evas_Key_Grab *g; | ||
1572 | |||
1573 | e->walking_grabs++; | ||
1574 | EINA_LIST_FOREACH(e->grabs, l, g) | ||
1575 | { | ||
1576 | if (g->just_added) | ||
1577 | { | ||
1578 | g->just_added = EINA_FALSE; | ||
1579 | continue; | ||
1580 | } | ||
1581 | if (g->delete_me) continue; | ||
1582 | if (((e->modifiers.mask & g->modifiers) || | ||
1583 | (g->modifiers == e->modifiers.mask)) && | ||
1584 | (!((e->modifiers.mask & g->not_modifiers) || | ||
1585 | (g->not_modifiers == ~e->modifiers.mask))) && | ||
1586 | (!strcmp(keyname, g->keyname))) | ||
1587 | { | ||
1588 | if (e->events_frozen <= 0 && | ||
1589 | !evas_event_freezes_through(g->object)) | ||
1590 | evas_object_event_callback_call(g->object, | ||
1591 | EVAS_CALLBACK_KEY_UP, &ev, event_id); | ||
1592 | if (g->exclusive) exclusive = EINA_TRUE; | ||
1593 | } | ||
1594 | if (e->delete_me) break; | ||
1595 | } | ||
1596 | e->walking_grabs--; | ||
1597 | if (e->walking_grabs <= 0) | ||
1598 | { | ||
1599 | while (e->delete_grabs > 0) | ||
1600 | { | ||
1601 | Eina_List *ll, *l_next; | ||
1602 | Evas_Key_Grab *gr; | ||
1603 | |||
1604 | e->delete_grabs--; | ||
1605 | EINA_LIST_FOREACH_SAFE(e->grabs, ll, l_next, gr) | ||
1606 | { | ||
1607 | if (gr->delete_me) | ||
1608 | evas_key_grab_free(gr->object, gr->keyname, | ||
1609 | gr->modifiers, gr->not_modifiers); | ||
1610 | } | ||
1611 | } | ||
1612 | } | ||
1613 | } | ||
1614 | if ((e->focused) && (!exclusive)) | ||
1615 | { | ||
1616 | if (e->events_frozen <= 0 && !evas_event_freezes_through(e->focused)) | ||
1617 | evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_UP, | ||
1618 | &ev, event_id); | ||
1619 | } | ||
1620 | _evas_post_event_callback_call(e); | ||
1621 | _evas_unwalk(e); | ||
1622 | } | ||
1623 | |||
1624 | EAPI void | ||
1625 | evas_event_feed_hold(Evas *e, int hold, unsigned int timestamp, const void *data) | ||
1626 | { | ||
1627 | Eina_List *l, *copy; | ||
1628 | Evas_Event_Hold ev; | ||
1629 | Evas_Object *obj; | ||
1630 | int event_id = 0; | ||
1631 | |||
1632 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1633 | return; | ||
1634 | MAGIC_CHECK_END(); | ||
1635 | |||
1636 | if (e->events_frozen > 0) return; | ||
1637 | e->last_timestamp = timestamp; | ||
1638 | |||
1639 | _evas_object_event_new(); | ||
1640 | |||
1641 | event_id = _evas_event_counter; | ||
1642 | ev.hold = hold; | ||
1643 | ev.data = (void *)data; | ||
1644 | ev.timestamp = timestamp; | ||
1645 | ev.event_flags = e->default_event_flags; | ||
1646 | |||
1647 | _evas_walk(e); | ||
1648 | copy = evas_event_list_copy(e->pointer.object.in); | ||
1649 | EINA_LIST_FOREACH(copy, l, obj) | ||
1650 | { | ||
1651 | if ((e->events_frozen <= 0) && !evas_event_freezes_through(obj)) | ||
1652 | evas_object_event_callback_call(obj, EVAS_CALLBACK_HOLD, &ev, event_id); | ||
1653 | if (e->delete_me) break; | ||
1654 | } | ||
1655 | if (copy) copy = eina_list_free(copy); | ||
1656 | _evas_post_event_callback_call(e); | ||
1657 | _evas_unwalk(e); | ||
1658 | _evas_object_event_new(); | ||
1659 | } | ||
1660 | |||
1661 | EAPI void | ||
1662 | evas_object_freeze_events_set(Evas_Object *obj, Eina_Bool freeze) | ||
1663 | { | ||
1664 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1665 | return; | ||
1666 | MAGIC_CHECK_END(); | ||
1667 | |||
1668 | freeze = !!freeze; | ||
1669 | if (obj->freeze_events == freeze) return; | ||
1670 | obj->freeze_events = freeze; | ||
1671 | evas_object_smart_member_cache_invalidate(obj, EINA_FALSE, EINA_TRUE); | ||
1672 | } | ||
1673 | |||
1674 | EAPI Eina_Bool | ||
1675 | evas_object_freeze_events_get(const Evas_Object *obj) | ||
1676 | { | ||
1677 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1678 | return EINA_FALSE; | ||
1679 | MAGIC_CHECK_END(); | ||
1680 | return obj->freeze_events; | ||
1681 | } | ||
1682 | |||
1683 | EAPI void | ||
1684 | evas_object_pass_events_set(Evas_Object *obj, Eina_Bool pass) | ||
1685 | { | ||
1686 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1687 | return; | ||
1688 | MAGIC_CHECK_END(); | ||
1689 | pass = !!pass; | ||
1690 | if (obj->pass_events == pass) return; | ||
1691 | obj->pass_events = pass; | ||
1692 | evas_object_smart_member_cache_invalidate(obj, EINA_TRUE, EINA_FALSE); | ||
1693 | if (evas_object_is_in_output_rect(obj, | ||
1694 | obj->layer->evas->pointer.x, | ||
1695 | obj->layer->evas->pointer.y, 1, 1) && | ||
1696 | ((!obj->precise_is_inside) || | ||
1697 | (evas_object_is_inside(obj, | ||
1698 | obj->layer->evas->pointer.x, | ||
1699 | obj->layer->evas->pointer.y)))) | ||
1700 | evas_event_feed_mouse_move(obj->layer->evas, | ||
1701 | obj->layer->evas->pointer.x, | ||
1702 | obj->layer->evas->pointer.y, | ||
1703 | obj->layer->evas->last_timestamp, | ||
1704 | NULL); | ||
1705 | } | ||
1706 | |||
1707 | EAPI Eina_Bool | ||
1708 | evas_object_pass_events_get(const Evas_Object *obj) | ||
1709 | { | ||
1710 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1711 | return EINA_FALSE; | ||
1712 | MAGIC_CHECK_END(); | ||
1713 | return obj->pass_events; | ||
1714 | } | ||
1715 | |||
1716 | EAPI void | ||
1717 | evas_object_repeat_events_set(Evas_Object *obj, Eina_Bool repeat) | ||
1718 | { | ||
1719 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1720 | return; | ||
1721 | MAGIC_CHECK_END(); | ||
1722 | repeat = !!repeat; | ||
1723 | if (obj->repeat_events == repeat) return; | ||
1724 | obj->repeat_events = repeat; | ||
1725 | if (evas_object_is_in_output_rect(obj, | ||
1726 | obj->layer->evas->pointer.x, | ||
1727 | obj->layer->evas->pointer.y, 1, 1) && | ||
1728 | ((!obj->precise_is_inside) || | ||
1729 | (evas_object_is_inside(obj, | ||
1730 | obj->layer->evas->pointer.x, | ||
1731 | obj->layer->evas->pointer.y)))) | ||
1732 | evas_event_feed_mouse_move(obj->layer->evas, | ||
1733 | obj->layer->evas->pointer.x, | ||
1734 | obj->layer->evas->pointer.y, | ||
1735 | obj->layer->evas->last_timestamp, | ||
1736 | NULL); | ||
1737 | } | ||
1738 | |||
1739 | EAPI Eina_Bool | ||
1740 | evas_object_repeat_events_get(const Evas_Object *obj) | ||
1741 | { | ||
1742 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1743 | return EINA_FALSE; | ||
1744 | MAGIC_CHECK_END(); | ||
1745 | return obj->repeat_events; | ||
1746 | } | ||
1747 | |||
1748 | EAPI void | ||
1749 | evas_object_propagate_events_set(Evas_Object *obj, Eina_Bool prop) | ||
1750 | { | ||
1751 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1752 | return; | ||
1753 | MAGIC_CHECK_END(); | ||
1754 | obj->no_propagate = !prop; | ||
1755 | } | ||
1756 | |||
1757 | EAPI Eina_Bool | ||
1758 | evas_object_propagate_events_get(const Evas_Object *obj) | ||
1759 | { | ||
1760 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1761 | return EINA_FALSE; | ||
1762 | MAGIC_CHECK_END(); | ||
1763 | return !(obj->no_propagate); | ||
1764 | } | ||
1765 | |||
1766 | EAPI void | ||
1767 | evas_object_pointer_mode_set(Evas_Object *obj, Evas_Object_Pointer_Mode setting) | ||
1768 | { | ||
1769 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1770 | return; | ||
1771 | MAGIC_CHECK_END(); | ||
1772 | obj->pointer_mode = setting; | ||
1773 | } | ||
1774 | |||
1775 | EAPI Evas_Object_Pointer_Mode | ||
1776 | evas_object_pointer_mode_get(const Evas_Object *obj) | ||
1777 | { | ||
1778 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1779 | return EVAS_OBJECT_POINTER_MODE_AUTOGRAB; | ||
1780 | MAGIC_CHECK_END(); | ||
1781 | return obj->pointer_mode; | ||
1782 | } | ||
1783 | |||
1784 | EAPI void | ||
1785 | evas_event_refeed_event(Evas *e, void *event_copy, Evas_Callback_Type event_type) | ||
1786 | { | ||
1787 | switch (event_type) | ||
1788 | { | ||
1789 | case EVAS_CALLBACK_MOUSE_IN: | ||
1790 | { | ||
1791 | Evas_Event_Mouse_In *ev = event_copy; | ||
1792 | evas_event_feed_mouse_in(e, ev->timestamp, ev->data); | ||
1793 | break; | ||
1794 | } | ||
1795 | case EVAS_CALLBACK_MOUSE_OUT: | ||
1796 | { | ||
1797 | Evas_Event_Mouse_Out *ev = event_copy; | ||
1798 | evas_event_feed_mouse_out(e, ev->timestamp, ev->data); | ||
1799 | break; | ||
1800 | } | ||
1801 | case EVAS_CALLBACK_MOUSE_DOWN: | ||
1802 | { | ||
1803 | Evas_Event_Mouse_Down *ev = event_copy; | ||
1804 | evas_event_feed_mouse_down(e, ev->button, ev->flags, ev-> timestamp, ev->data); | ||
1805 | break; | ||
1806 | } | ||
1807 | case EVAS_CALLBACK_MOUSE_UP: | ||
1808 | { | ||
1809 | Evas_Event_Mouse_Up *ev = event_copy; | ||
1810 | evas_event_feed_mouse_up(e, ev->button, ev->flags, ev-> timestamp, ev->data); | ||
1811 | break; | ||
1812 | } | ||
1813 | case EVAS_CALLBACK_MOUSE_MOVE: | ||
1814 | { | ||
1815 | Evas_Event_Mouse_Move *ev = event_copy; | ||
1816 | evas_event_feed_mouse_move(e, ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp, ev->data); | ||
1817 | break; | ||
1818 | } | ||
1819 | case EVAS_CALLBACK_MOUSE_WHEEL: | ||
1820 | { | ||
1821 | Evas_Event_Mouse_Wheel *ev = event_copy; | ||
1822 | evas_event_feed_mouse_wheel(e, ev->direction, ev-> z, ev->timestamp, ev->data); | ||
1823 | break; | ||
1824 | } | ||
1825 | case EVAS_CALLBACK_MULTI_DOWN: | ||
1826 | { | ||
1827 | Evas_Event_Multi_Down *ev = event_copy; | ||
1828 | evas_event_feed_multi_down(e, ev->device, ev->canvas.x, ev->canvas.y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, ev->canvas.xsub, ev->canvas.ysub, ev->flags, ev->timestamp, ev->data); | ||
1829 | break; | ||
1830 | } | ||
1831 | case EVAS_CALLBACK_MULTI_UP: | ||
1832 | { | ||
1833 | Evas_Event_Multi_Up *ev = event_copy; | ||
1834 | evas_event_feed_multi_up(e, ev->device, ev->canvas.x, ev->canvas.y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, ev->canvas.xsub, ev->canvas.ysub, ev->flags, ev->timestamp, ev->data); | ||
1835 | break; | ||
1836 | } | ||
1837 | case EVAS_CALLBACK_MULTI_MOVE: | ||
1838 | { | ||
1839 | Evas_Event_Multi_Move *ev = event_copy; | ||
1840 | evas_event_feed_multi_move(e, ev->device, ev->cur.canvas.x, ev->cur.canvas.y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, ev->cur.canvas.xsub, ev->cur.canvas.ysub, ev->timestamp, ev->data); | ||
1841 | break; | ||
1842 | } | ||
1843 | case EVAS_CALLBACK_KEY_DOWN: | ||
1844 | { | ||
1845 | Evas_Event_Key_Down *ev = event_copy; | ||
1846 | evas_event_feed_key_down(e, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, ev->data); | ||
1847 | break; | ||
1848 | } | ||
1849 | case EVAS_CALLBACK_KEY_UP: | ||
1850 | { | ||
1851 | Evas_Event_Key_Up *ev = event_copy; | ||
1852 | evas_event_feed_key_up(e, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, ev->data); | ||
1853 | break; | ||
1854 | } | ||
1855 | default: /* All non-input events are not handeled */ | ||
1856 | break; | ||
1857 | } | ||
1858 | } | ||
1859 | |||
1860 | EAPI int | ||
1861 | evas_event_down_count_get(const Evas *e) | ||
1862 | { | ||
1863 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1864 | return 0; | ||
1865 | MAGIC_CHECK_END(); | ||
1866 | return e->pointer.downs; | ||
1867 | } | ||