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