1 #include "evas_common.h"
2 #include "evas_private.h"
5 _evas_event_havemap_adjust(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
9 if (!obj->havemap_parent) return;
10 pmap = obj->smart.parent;
14 if ((pmap->cur.map) && (pmap->cur.map->count == 4) && (pmap->cur.usemap))
16 pmap = pmap->smart.parent;
19 evas_map_coords_get(pmap->cur.map, *x, *y, x, y, obj->mouse_grabbed);
22 *x += pmap->cur.map->normal_geometry.x;
23 *y += pmap->cur.map->normal_geometry.y;
28 _evas_event_object_list_in_get(Evas *e, Eina_List *in,
29 const Eina_Inlist *list, Evas_Object *stop,
30 int x, int y, int *no_rep, int parmap)
34 EINA_INLIST_REVERSE_FOREACH(list, obj)
36 if (parmap) obj->havemap_parent = 1;
37 else obj->havemap_parent = 0;
44 if (evas_event_passes_through(obj)) continue;
45 if ((obj->cur.visible) && (obj->delete_me == 0) &&
46 (!obj->clip.clipees) &&
47 (evas_object_clippers_is_visible(obj)))
55 if (((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
57 inside = evas_object_is_in_output_rect(obj, x, y, 1, 1);
60 if (!evas_map_coords_get(obj->cur.map, x, y,
62 &(obj->cur.map->my), 0))
71 in = _evas_event_object_list_in_get
73 evas_object_smart_members_get_direct(obj),
75 obj->cur.geometry.x + obj->cur.map->mx,
76 obj->cur.geometry.y + obj->cur.map->my,
82 in = _evas_event_object_list_in_get
83 (e, in, evas_object_smart_members_get_direct(obj),
84 stop, x, y, &norep, parmap);
96 if (((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
98 inside = evas_object_is_in_output_rect(obj, x, y, 1, 1);
101 if (!evas_map_coords_get(obj->cur.map, x, y,
103 &(obj->cur.map->my), 0))
110 inside = evas_object_is_in_output_rect(obj, x, y, 1, 1);
111 if (inside && ((!obj->precise_is_inside) ||
112 (evas_object_is_inside(obj, x, y))))
114 in = eina_list_append(in, obj);
115 if (!obj->repeat_events)
129 evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y)
132 Eina_List *in = NULL;
134 if (!e->layers) return NULL;
135 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
140 in = _evas_event_object_list_in_get(e, in,
141 EINA_INLIST_GET(lay->objects),
142 stop, x, y, &norep, 0);
143 if (norep) return in;
148 static Eina_List *evas_event_list_copy(Eina_List *list);
150 evas_event_list_copy(Eina_List *list)
152 Eina_List *l, *new_l = NULL;
155 EINA_LIST_FOREACH(list, l, data)
156 new_l = eina_list_append(new_l, data);
159 /* public functions */
162 * @addtogroup Evas_Event_Freezing_Group
167 * Freeze all event processing.
168 * @param e The canvas to freeze event processing on.
170 * This function will indicate to evas that the canvas @p e is to have
171 * all event processing frozen until a matching evas_event_thaw()
172 * function is called on the same canvas. Every freeze call must be
173 * matched by a thaw call in order to completely thaw out a canvas.
178 * extern Evas_Object *object;
180 * evas_event_freeze(evas);
181 * evas_object_move(object, 50, 100);
182 * evas_object_resize(object, 200, 200);
183 * evas_event_thaw(evas);
187 evas_event_freeze(Evas *e)
189 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
196 * Thaw a canvas out after freezing.
198 * @param e The canvas to thaw out.
200 * This will thaw out a canvas after a matching evas_event_freeze()
201 * call. If this call completely thaws out a canvas, events will start
202 * being processed again after this call, but this call will not
203 * invole any "missed" events to be evaluated.
205 * See evas_event_freeze() for an example.
208 evas_event_thaw(Evas *e)
210 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
214 if (e->events_frozen == 0)
218 EINA_INLIST_FOREACH((EINA_INLIST_GET(e->layers)), lay)
222 EINA_INLIST_FOREACH(lay->objects, obj)
224 evas_object_clip_recalc(obj);
225 evas_object_recalc_clippees(obj);
229 if (e->events_frozen < 0)
230 evas_debug_generic(" Thaw of events when already thawed!!!\n");
238 * @addtogroup Evas_Event_Feeding_Group
243 * Return the freeze count of a given canvas.
244 * @param e The canvas to fetch the freeze count from.
246 * This returns the number of times the canvas has been told to freeze
247 * events. It is possible to call evas_event_freeze() multiple times,
248 * and these must be matched by evas_event_thaw() calls. This call
249 * allows the program to discover just how many times things have been
250 * frozen in case it may want to break out of a deep freeze state
251 * where the count is high.
257 * while (evas_event_freeze_get(evas) > 0) evas_event_thaw(evas);
262 evas_event_freeze_get(const Evas *e)
264 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
267 return e->events_frozen;
272 * Mouse down event feed.
274 * @param e The given canvas pointer.
275 * @param b The button number.
276 * @param flags The evas button flags.
277 * @param timestamp The timestamp of the mouse down event.
278 * @param data The data for canvas.
280 * This function will set some evas properties that is necessary when
281 * the mouse button is pressed. It prepares information to be treated
282 * by the callback function.
286 evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
290 Evas_Event_Mouse_Down ev;
293 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
297 if ((b < 1) || (b > 32)) return;
299 e->pointer.button |= (1 << (b - 1));
301 if (e->events_frozen > 0) return;
302 e->last_timestamp = timestamp;
304 _evas_object_event_new();
307 ev.output.x = e->pointer.x;
308 ev.output.y = e->pointer.y;
309 ev.canvas.x = e->pointer.x;
310 ev.canvas.y = e->pointer.y;
311 ev.data = (void *)data;
312 ev.modifiers = &(e->modifiers);
313 ev.locks = &(e->locks);
315 ev.timestamp = timestamp;
316 ev.event_flags = EVAS_EVENT_FLAG_NONE;
319 ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y);
320 /* free our old list of ins */
321 e->pointer.object.in = eina_list_free(e->pointer.object.in);
322 /* and set up the new one */
323 e->pointer.object.in = ins;
324 copy = evas_event_list_copy(e->pointer.object.in);
325 EINA_LIST_FOREACH(copy, l, obj)
327 if (obj->delete_me) continue;
329 ev.canvas.x = e->pointer.x;
330 ev.canvas.y = e->pointer.y;
331 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
332 if (obj->pointer_mode != EVAS_OBJECT_POINTER_MODE_NOGRAB)
334 obj->mouse_grabbed++;
335 e->pointer.mouse_grabbed++;
338 if (e->events_frozen <= 0)
339 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_DOWN, &ev);
340 if (e->delete_me) break;
342 if (copy) eina_list_free(copy);
343 e->last_mouse_down_counter++;
344 _evas_post_event_callback_call(e);
349 * Mouse up event feed.
351 * @param e The given canvas pointer.
352 * @param b The button number.
353 * @param flags evas button flags.
354 * @param timestamp The timestamp of the mouse up event.
355 * @param data The data for canvas.
357 * This function will set some evas properties that is necessary when
358 * the mouse button is released. It prepares information to be treated
359 * by the callback function.
363 evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
367 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
371 if ((b < 1) || (b > 32)) return;
373 e->pointer.button &= ~(1 << (b - 1));
375 if (e->events_frozen > 0) return;
376 e->last_timestamp = timestamp;
379 Evas_Event_Mouse_Up ev;
382 _evas_object_event_new();
385 ev.output.x = e->pointer.x;
386 ev.output.y = e->pointer.y;
387 ev.canvas.x = e->pointer.x;
388 ev.canvas.y = e->pointer.y;
389 ev.data = (void *)data;
390 ev.modifiers = &(e->modifiers);
391 ev.locks = &(e->locks);
393 ev.timestamp = timestamp;
394 ev.event_flags = EVAS_EVENT_FLAG_NONE;
397 copy = evas_event_list_copy(e->pointer.object.in);
398 EINA_LIST_FOREACH(copy, l, obj)
400 ev.canvas.x = e->pointer.x;
401 ev.canvas.y = e->pointer.y;
402 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
403 if ((obj->pointer_mode != EVAS_OBJECT_POINTER_MODE_NOGRAB) &&
404 (obj->mouse_in) && (obj->mouse_grabbed > 0))
406 obj->mouse_grabbed--;
407 e->pointer.mouse_grabbed--;
411 if (e->events_frozen <= 0)
412 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_UP, &ev);
414 if (e->delete_me) break;
416 if (copy) copy = eina_list_free(copy);
417 e->last_mouse_up_counter++;
418 _evas_post_event_callback_call(e);
421 if (!e->pointer.button)
426 Evas_Event_Mouse_Out ev;
429 _evas_object_event_new();
431 ev.buttons = e->pointer.button;
432 ev.output.x = e->pointer.x;
433 ev.output.y = e->pointer.y;
434 ev.canvas.x = e->pointer.x;
435 ev.canvas.y = e->pointer.y;
436 ev.data = (void *)data;
437 ev.modifiers = &(e->modifiers);
438 ev.locks = &(e->locks);
439 ev.timestamp = timestamp;
440 ev.event_flags = EVAS_EVENT_FLAG_NONE;
442 /* get new list of ins */
443 ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y);
444 /* go thru old list of in objects */
445 copy = evas_event_list_copy(e->pointer.object.in);
446 EINA_LIST_FOREACH(copy, l, obj)
448 ev.canvas.x = e->pointer.x;
449 ev.canvas.y = e->pointer.y;
450 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
451 if ((!eina_list_data_find(ins, obj)) ||
452 (!e->pointer.inside))
455 if (e->events_frozen <= 0)
456 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
458 if (e->delete_me) break;
460 _evas_post_event_callback_call(e);
462 if (copy) copy = eina_list_free(copy);
463 if (e->pointer.inside)
465 Evas_Event_Mouse_In ev;
468 _evas_object_event_new();
470 ev.buttons = e->pointer.button;
471 ev.output.x = e->pointer.x;
472 ev.output.y = e->pointer.y;
473 ev.canvas.x = e->pointer.x;
474 ev.canvas.y = e->pointer.y;
475 ev.data = (void *)data;
476 ev.modifiers = &(e->modifiers);
477 ev.locks = &(e->locks);
478 ev.timestamp = timestamp;
479 ev.event_flags = EVAS_EVENT_FLAG_NONE;
481 EINA_LIST_FOREACH(ins, l, obj)
483 ev.canvas.x = e->pointer.x;
484 ev.canvas.y = e->pointer.y;
485 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
486 if (!eina_list_data_find(e->pointer.object.in, obj))
489 if (e->events_frozen <= 0)
490 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
492 if (e->delete_me) break;
494 _evas_post_event_callback_call(e);
498 ins = eina_list_free(ins);
500 /* free our old list of ins */
501 e->pointer.object.in = eina_list_free(e->pointer.object.in);
502 /* and set up the new one */
503 e->pointer.object.in = ins;
504 if (e->pointer.inside)
505 evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data);
508 if (e->pointer.mouse_grabbed < 0)
510 ERR("BUG? e->pointer.mouse_grabbed (=%d) < 0!",
511 e->pointer.mouse_grabbed);
514 if ((e->pointer.button == 0) && (e->pointer.mouse_grabbed != 0))
516 INF("restore to 0 grabs (from %i)", e->pointer.mouse_grabbed);
517 e->pointer.mouse_grabbed = 0;
524 * Mouse cancel event feed.
526 * @param e The given canvas pointer.
527 * @param timestamp The timestamp of the mouse up event.
528 * @param data The data for canvas.
530 * This function will call evas_event_feed_mouse_up() when a
531 * mouse cancel event happens.
535 evas_event_feed_mouse_cancel(Evas *e, unsigned int timestamp, const void *data)
539 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
543 if (e->events_frozen > 0) return;
546 for (i = 0; i < 32; i++)
548 if ((e->pointer.button & (1 << i)))
549 evas_event_feed_mouse_up(e, i + 1, 0, timestamp, data);
555 * Mouse wheel event feed.
557 * @param e The given canvas pointer.
558 * @param direction The wheel mouse direction.
559 * @param z How much mouse wheel was scrolled up or down.
560 * @param timestamp The timestamp of the mouse up event.
561 * @param data The data for canvas.
563 * This function will set some evas properties that is necessary when
564 * the mouse wheel is scrolled up or down. It prepares information to
565 * be treated by the callback function.
569 evas_event_feed_mouse_wheel(Evas *e, int direction, int z, unsigned int timestamp, const void *data)
572 Evas_Event_Mouse_Wheel ev;
575 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
579 if (e->events_frozen > 0) return;
580 e->last_timestamp = timestamp;
582 _evas_object_event_new();
584 ev.direction = direction;
586 ev.output.x = e->pointer.x;
587 ev.output.y = e->pointer.y;
588 ev.canvas.x = e->pointer.x;
589 ev.canvas.y = e->pointer.y;
590 ev.data = (void *) data;
591 ev.modifiers = &(e->modifiers);
592 ev.locks = &(e->locks);
593 ev.timestamp = timestamp;
594 ev.event_flags = EVAS_EVENT_FLAG_NONE;
597 copy = evas_event_list_copy(e->pointer.object.in);
599 EINA_LIST_FOREACH(copy, l, obj)
601 ev.canvas.x = e->pointer.x;
602 ev.canvas.y = e->pointer.y;
603 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
604 if (e->events_frozen <= 0)
605 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_WHEEL, &ev);
606 if (e->delete_me) break;
608 if (copy) copy = eina_list_free(copy);
609 _evas_post_event_callback_call(e);
615 * Mouse move event feed.
617 * @param e The given canvas pointer.
618 * @param x The horizontal position of the mouse pointer.
619 * @param y The vertical position of the mouse pointer.
620 * @param timestamp The timestamp of the mouse up event.
621 * @param data The data for canvas.
623 * This function will set some evas properties that is necessary when
624 * the mouse is moved from its last position. It prepares information
625 * to be treated by the callback function.
629 evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const void *data)
632 //// Evas_Coord pcx, pcy;
634 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
640 //// pcx = e->pointer.canvas_x;
641 //// pcy = e->pointer.canvas_y;
643 if (e->events_frozen > 0) return;
644 e->last_timestamp = timestamp;
648 //// e->pointer.canvas_x = x;
649 //// e->pointer.canvas_y = y;
650 //// e->pointer.canvas_x = evas_coord_screen_x_to_world(e, x);
651 //// e->pointer.canvas_y = evas_coord_screen_y_to_world(e, y);
652 if ((!e->pointer.inside) && (e->pointer.mouse_grabbed == 0)) return;
654 /* if our mouse button is grabbed to any objects */
655 if (e->pointer.mouse_grabbed > 0)
657 /* go thru old list of in objects */
658 Eina_List *outs = NULL;
662 Evas_Event_Mouse_Move ev;
665 _evas_object_event_new();
667 ev.buttons = e->pointer.button;
668 ev.cur.output.x = e->pointer.x;
669 ev.cur.output.y = e->pointer.y;
670 ev.cur.canvas.x = e->pointer.x;
671 ev.cur.canvas.y = e->pointer.y;
672 ev.prev.output.x = px;
673 ev.prev.output.y = py;
674 ev.prev.canvas.x = px;
675 ev.prev.canvas.y = py;
676 ev.data = (void *)data;
677 ev.modifiers = &(e->modifiers);
678 ev.locks = &(e->locks);
679 ev.timestamp = timestamp;
680 ev.event_flags = EVAS_EVENT_FLAG_NONE;
681 copy = evas_event_list_copy(e->pointer.object.in);
682 EINA_LIST_FOREACH(copy, l, obj)
684 ev.cur.canvas.x = e->pointer.x;
685 ev.cur.canvas.y = e->pointer.y;
686 _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y);
687 if ((obj->cur.visible) &&
688 (evas_object_clippers_is_visible(obj)) &&
689 (!evas_event_passes_through(obj)) &&
690 (!obj->clip.clipees))
692 if ((px != x) || (py != y))
694 if (e->events_frozen <= 0)
695 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev);
699 outs = eina_list_append(outs, obj);
700 if (e->delete_me) break;
702 _evas_post_event_callback_call(e);
705 Evas_Event_Mouse_Out ev;
707 _evas_object_event_new();
709 ev.buttons = e->pointer.button;
710 ev.output.x = e->pointer.x;
711 ev.output.y = e->pointer.y;
712 ev.canvas.x = e->pointer.x;
713 ev.canvas.y = e->pointer.y;
714 ev.data = (void *)data;
715 ev.modifiers = &(e->modifiers);
716 ev.locks = &(e->locks);
717 ev.timestamp = timestamp;
718 ev.event_flags = EVAS_EVENT_FLAG_NONE;
720 if (copy) copy = eina_list_free(copy);
726 outs = eina_list_remove(outs, obj);
727 if ((obj->mouse_grabbed == 0) && (!e->delete_me))
729 ev.canvas.x = e->pointer.x;
730 ev.canvas.y = e->pointer.y;
731 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
732 e->pointer.object.in = eina_list_remove(e->pointer.object.in, obj);
736 if (e->events_frozen <= 0)
737 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
741 _evas_post_event_callback_call(e);
748 Evas_Event_Mouse_Move ev;
749 Evas_Event_Mouse_Out ev2;
750 Evas_Event_Mouse_In ev3;
753 _evas_object_event_new();
755 ev.buttons = e->pointer.button;
756 ev.cur.output.x = e->pointer.x;
757 ev.cur.output.y = e->pointer.y;
758 ev.cur.canvas.x = e->pointer.x;
759 ev.cur.canvas.y = e->pointer.y;
760 ev.prev.output.x = px;
761 ev.prev.output.y = py;
762 ev.prev.canvas.x = px;
763 ev.prev.canvas.y = py;
764 ev.data = (void *)data;
765 ev.modifiers = &(e->modifiers);
766 ev.locks = &(e->locks);
767 ev.timestamp = timestamp;
768 ev.event_flags = EVAS_EVENT_FLAG_NONE;
770 ev2.buttons = e->pointer.button;
771 ev2.output.x = e->pointer.x;
772 ev2.output.y = e->pointer.y;
773 ev2.canvas.x = e->pointer.x;
774 ev2.canvas.y = e->pointer.y;
775 ev2.data = (void *)data;
776 ev2.modifiers = &(e->modifiers);
777 ev2.locks = &(e->locks);
778 ev2.timestamp = timestamp;
779 ev2.event_flags = EVAS_EVENT_FLAG_NONE;
781 ev3.buttons = e->pointer.button;
782 ev3.output.x = e->pointer.x;
783 ev3.output.y = e->pointer.y;
784 ev3.canvas.x = e->pointer.x;
785 ev3.canvas.y = e->pointer.y;
786 ev3.data = (void *)data;
787 ev3.modifiers = &(e->modifiers);
788 ev3.locks = &(e->locks);
789 ev3.timestamp = timestamp;
790 ev3.event_flags = EVAS_EVENT_FLAG_NONE;
792 /* get all new in objects */
793 ins = evas_event_objects_event_list(e, NULL, x, y);
794 /* go thru old list of in objects */
795 copy = evas_event_list_copy(e->pointer.object.in);
796 EINA_LIST_FOREACH(copy, l, obj)
798 /* if its under the pointer and its visible and its in the new */
800 // FIXME: i don't think we need this
801 // evas_object_clip_recalc(obj);
802 if (evas_object_is_in_output_rect(obj, x, y, 1, 1) &&
803 (obj->cur.visible) &&
804 (evas_object_clippers_is_visible(obj)) &&
805 (eina_list_data_find(ins, obj)) &&
806 (!evas_event_passes_through(obj)) &&
807 (!obj->clip.clipees) &&
808 ((!obj->precise_is_inside) ||
809 (evas_object_is_inside(obj, x, y))))
811 if ((px != x) || (py != y))
813 ev.cur.canvas.x = e->pointer.x;
814 ev.cur.canvas.y = e->pointer.y;
815 _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y);
816 if (e->events_frozen <= 0)
817 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev);
820 /* otherwise it has left the object */
824 ev2.canvas.x = e->pointer.x;
825 ev2.canvas.y = e->pointer.y;
826 _evas_event_havemap_adjust(obj, &ev2.canvas.x, &ev2.canvas.y);
827 if (e->events_frozen <= 0)
828 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev2);
830 if (e->delete_me) break;
832 _evas_post_event_callback_call(e);
834 _evas_object_event_new();
836 if (copy) copy = eina_list_free(copy);
837 /* go thru our current list of ins */
838 EINA_LIST_FOREACH(ins, l, obj)
840 ev3.canvas.x = e->pointer.x;
841 ev3.canvas.y = e->pointer.y;
842 _evas_event_havemap_adjust(obj, &ev3.canvas.x, &ev3.canvas.y);
843 /* if its not in the old list of ins send an enter event */
844 if (!eina_list_data_find(e->pointer.object.in, obj))
847 if (e->events_frozen <= 0)
848 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev3);
850 if (e->delete_me) break;
852 /* free our old list of ins */
853 eina_list_free(e->pointer.object.in);
854 /* and set up the new one */
855 e->pointer.object.in = ins;
856 _evas_post_event_callback_call(e);
862 * Mouse in event feed.
864 * @param e The given canvas pointer.
865 * @param timestamp The timestamp of the mouse up event.
866 * @param data The data for canvas.
868 * This function will set some evas properties that is necessary when
869 * the mouse in event happens. It prepares information to be treated
870 * by the callback function.
874 evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data)
878 Evas_Event_Mouse_In ev;
881 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
884 e->pointer.inside = 1;
886 if (e->events_frozen > 0) return;
887 e->last_timestamp = timestamp;
889 if (e->pointer.mouse_grabbed != 0) return;
891 _evas_object_event_new();
893 ev.buttons = e->pointer.button;
894 ev.output.x = e->pointer.x;
895 ev.output.y = e->pointer.y;
896 ev.canvas.x = e->pointer.x;
897 ev.canvas.y = e->pointer.y;
898 ev.data = (void *)data;
899 ev.modifiers = &(e->modifiers);
900 ev.locks = &(e->locks);
901 ev.timestamp = timestamp;
902 ev.event_flags = EVAS_EVENT_FLAG_NONE;
905 /* get new list of ins */
906 ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y);
907 EINA_LIST_FOREACH(ins, l, obj)
909 ev.canvas.x = e->pointer.x;
910 ev.canvas.y = e->pointer.y;
911 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
912 if (!eina_list_data_find(e->pointer.object.in, obj))
915 if (e->events_frozen <= 0)
916 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
918 if (e->delete_me) break;
920 /* free our old list of ins */
921 e->pointer.object.in = eina_list_free(e->pointer.object.in);
922 /* and set up the new one */
923 e->pointer.object.in = ins;
924 _evas_post_event_callback_call(e);
925 evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data);
930 * Mouse out event feed.
932 * @param e The given canvas pointer.
933 * @param timestamp Timestamp of the mouse up event.
934 * @param data The data for canvas.
936 * This function will set some evas properties that is necessary when
937 * the mouse out event happens. It prepares information to be treated
938 * by the callback function.
942 evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data)
944 Evas_Event_Mouse_Out ev;
946 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
949 e->pointer.inside = 0;
951 if (e->events_frozen > 0) return;
952 e->last_timestamp = timestamp;
954 _evas_object_event_new();
956 ev.buttons = e->pointer.button;
957 ev.output.x = e->pointer.x;
958 ev.output.y = e->pointer.y;
959 ev.canvas.x = e->pointer.x;
960 ev.canvas.y = e->pointer.y;
961 ev.data = (void *)data;
962 ev.modifiers = &(e->modifiers);
963 ev.locks = &(e->locks);
964 ev.timestamp = timestamp;
965 ev.event_flags = EVAS_EVENT_FLAG_NONE;
968 /* if our mouse button is grabbed to any objects */
969 if (e->pointer.mouse_grabbed == 0)
971 /* go thru old list of in objects */
975 copy = evas_event_list_copy(e->pointer.object.in);
976 EINA_LIST_FOREACH(copy, l, obj)
978 ev.canvas.x = e->pointer.x;
979 ev.canvas.y = e->pointer.y;
980 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
984 if (e->events_frozen <= 0)
985 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
987 if (e->delete_me) break;
989 if (copy) copy = eina_list_free(copy);
990 /* free our old list of ins */
991 e->pointer.object.in = eina_list_free(e->pointer.object.in);
992 _evas_post_event_callback_call(e);
998 evas_event_feed_multi_down(Evas *e,
1000 double rad, double radx, double rady,
1001 double pres, double ang,
1002 double fx, double fy,
1003 Evas_Button_Flags flags, unsigned int timestamp,
1006 Eina_List *l, *copy;
1007 Evas_Event_Multi_Down ev;
1010 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1014 if (e->events_frozen > 0) return;
1015 e->last_timestamp = timestamp;
1017 _evas_object_event_new();
1029 ev.canvas.xsub = fx;
1030 ev.canvas.ysub = fy;
1031 ev.data = (void *)data;
1032 ev.modifiers = &(e->modifiers);
1033 ev.locks = &(e->locks);
1035 ev.timestamp = timestamp;
1036 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1039 copy = evas_event_list_copy(e->pointer.object.in);
1040 EINA_LIST_FOREACH(copy, l, obj)
1044 ev.canvas.xsub = fx;
1045 ev.canvas.ysub = fy;
1046 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
1047 if (x != ev.canvas.x)
1048 ev.canvas.xsub = ev.canvas.x; // fixme - lost precision
1049 if (y != ev.canvas.y)
1050 ev.canvas.ysub = ev.canvas.y; // fixme - lost precision
1051 if (e->events_frozen <= 0)
1052 evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_DOWN, &ev);
1053 if (e->delete_me) break;
1055 if (copy) eina_list_free(copy);
1056 _evas_post_event_callback_call(e);
1061 evas_event_feed_multi_up(Evas *e,
1062 int d, int x, int y,
1063 double rad, double radx, double rady,
1064 double pres, double ang,
1065 double fx, double fy,
1066 Evas_Button_Flags flags, unsigned int timestamp,
1069 Eina_List *l, *copy;
1070 Evas_Event_Multi_Up ev;
1073 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1077 if (e->events_frozen > 0) return;
1078 e->last_timestamp = timestamp;
1080 _evas_object_event_new();
1092 ev.canvas.xsub = fx;
1093 ev.canvas.ysub = fy;
1094 ev.data = (void *)data;
1095 ev.modifiers = &(e->modifiers);
1096 ev.locks = &(e->locks);
1098 ev.timestamp = timestamp;
1099 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1102 copy = evas_event_list_copy(e->pointer.object.in);
1103 EINA_LIST_FOREACH(copy, l, obj)
1107 ev.canvas.xsub = fx;
1108 ev.canvas.ysub = fy;
1109 _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
1110 if (x != ev.canvas.x)
1111 ev.canvas.xsub = ev.canvas.x; // fixme - lost precision
1112 if (y != ev.canvas.y)
1113 ev.canvas.ysub = ev.canvas.y; // fixme - lost precision
1114 if (e->events_frozen <= 0)
1115 evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_UP, &ev);
1116 if (e->delete_me) break;
1118 if (copy) copy = eina_list_free(copy);
1119 _evas_post_event_callback_call(e);
1124 evas_event_feed_multi_move(Evas *e,
1125 int d, int x, int y,
1126 double rad, double radx, double rady,
1127 double pres, double ang,
1128 double fx, double fy,
1129 unsigned int timestamp, const void *data)
1131 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1135 if (e->events_frozen > 0) return;
1136 e->last_timestamp = timestamp;
1138 if (!e->pointer.inside) return;
1141 /* if our mouse button is grabbed to any objects */
1142 if (e->pointer.mouse_grabbed > 0)
1144 /* go thru old list of in objects */
1145 Eina_List *l, *copy;
1146 Evas_Event_Multi_Move ev;
1149 _evas_object_event_new();
1152 ev.cur.output.x = x;
1153 ev.cur.output.y = y;
1154 ev.cur.canvas.x = x;
1155 ev.cur.canvas.y = y;
1161 ev.cur.canvas.xsub = fx;
1162 ev.cur.canvas.ysub = fy;
1163 ev.data = (void *)data;
1164 ev.modifiers = &(e->modifiers);
1165 ev.locks = &(e->locks);
1166 ev.timestamp = timestamp;
1167 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1169 copy = evas_event_list_copy(e->pointer.object.in);
1170 EINA_LIST_FOREACH(copy, l, obj)
1172 if ((obj->cur.visible) &&
1173 (evas_object_clippers_is_visible(obj)) &&
1174 (!evas_event_passes_through(obj)) &&
1175 (!obj->clip.clipees))
1177 ev.cur.canvas.x = x;
1178 ev.cur.canvas.y = y;
1179 ev.cur.canvas.xsub = fx;
1180 ev.cur.canvas.ysub = fy;
1181 _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y);
1182 if (x != ev.cur.canvas.x)
1183 ev.cur.canvas.xsub = ev.cur.canvas.x; // fixme - lost precision
1184 if (y != ev.cur.canvas.y)
1185 ev.cur.canvas.ysub = ev.cur.canvas.y; // fixme - lost precision
1186 if (e->events_frozen <= 0)
1187 evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_MOVE, &ev);
1189 if (e->delete_me) break;
1191 _evas_post_event_callback_call(e);
1196 Eina_List *l, *copy;
1197 Evas_Event_Multi_Move ev;
1200 _evas_object_event_new();
1203 ev.cur.output.x = x;
1204 ev.cur.output.y = y;
1205 ev.cur.canvas.x = x;
1206 ev.cur.canvas.y = y;
1212 ev.cur.canvas.xsub = fx;
1213 ev.cur.canvas.ysub = fy;
1214 ev.data = (void *)data;
1215 ev.modifiers = &(e->modifiers);
1216 ev.locks = &(e->locks);
1217 ev.timestamp = timestamp;
1218 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1220 /* get all new in objects */
1221 ins = evas_event_objects_event_list(e, NULL, x, y);
1222 /* go thru old list of in objects */
1223 copy = evas_event_list_copy(e->pointer.object.in);
1224 EINA_LIST_FOREACH(copy, l, obj)
1226 /* if its under the pointer and its visible and its in the new */
1228 // FIXME: i don't think we need this
1229 // evas_object_clip_recalc(obj);
1230 if (evas_object_is_in_output_rect(obj, x, y, 1, 1) &&
1231 (obj->cur.visible) &&
1232 (evas_object_clippers_is_visible(obj)) &&
1233 (eina_list_data_find(ins, obj)) &&
1234 (!evas_event_passes_through(obj)) &&
1235 (!obj->clip.clipees) &&
1236 ((!obj->precise_is_inside) ||
1237 (evas_object_is_inside(obj, x, y))))
1239 ev.cur.canvas.x = x;
1240 ev.cur.canvas.y = y;
1241 ev.cur.canvas.xsub = fx;
1242 ev.cur.canvas.ysub = fy;
1243 _evas_event_havemap_adjust(obj, &ev.cur.canvas.x, &ev.cur.canvas.y);
1244 if (x != ev.cur.canvas.x)
1245 ev.cur.canvas.xsub = ev.cur.canvas.x; // fixme - lost precision
1246 if (y != ev.cur.canvas.y)
1247 ev.cur.canvas.ysub = ev.cur.canvas.y; // fixme - lost precision
1248 if (e->events_frozen <= 0)
1249 evas_object_event_callback_call(obj, EVAS_CALLBACK_MULTI_MOVE, &ev);
1251 if (e->delete_me) break;
1253 if (copy) copy = eina_list_free(copy);
1254 /* free our old list of ins */
1255 eina_list_free(e->pointer.object.in);
1256 /* and set up the new one */
1257 e->pointer.object.in = ins;
1258 _evas_post_event_callback_call(e);
1264 * Key down event feed
1266 * @param e The canvas to thaw out
1267 * @param keyname Name of the key
1268 * @param key The key pressed.
1269 * @param string A String
1270 * @param compose The compose string
1271 * @param timestamp Timestamp of the mouse up event
1272 * @param data Data for canvas.
1274 * This function will set some evas properties that is necessary when
1275 * a key is pressed. It prepares information to be treated by the
1276 * callback function.
1280 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)
1282 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1285 if (!keyname) return;
1286 if (e->events_frozen > 0) return;
1287 e->last_timestamp = timestamp;
1290 Evas_Event_Key_Down ev;
1293 _evas_object_event_new();
1296 ev.keyname = (char *)keyname;
1297 ev.data = (void *)data;
1298 ev.modifiers = &(e->modifiers);
1299 ev.locks = &(e->locks);
1302 ev.compose = compose;
1303 ev.timestamp = timestamp;
1304 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1311 EINA_LIST_FOREACH(e->grabs, l, g)
1318 if (g->delete_me) continue;
1319 if (((e->modifiers.mask & g->modifiers) ||
1320 (g->modifiers == e->modifiers.mask)) &&
1321 (!strcmp(keyname, g->keyname)))
1323 if (!(e->modifiers.mask & g->not_modifiers))
1325 if (e->events_frozen <= 0)
1326 evas_object_event_callback_call(g->object, EVAS_CALLBACK_KEY_DOWN, &ev);
1327 if (g->exclusive) exclusive = 1;
1330 if (e->delete_me) break;
1333 if (e->walking_grabs <= 0)
1335 while (e->delete_grabs > 0)
1338 for (l = e->grabs; l;)
1340 g = eina_list_data_get(l);
1341 l = eina_list_next(l);
1343 evas_key_grab_free(g->object, g->keyname, g->modifiers, g->not_modifiers);
1348 if ((e->focused) && (!exclusive))
1350 if (e->events_frozen <= 0)
1351 evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_DOWN, &ev);
1353 _evas_post_event_callback_call(e);
1361 * @param e The canvas to thaw out
1362 * @param keyname Name of the key
1363 * @param key The key released.
1364 * @param string string
1365 * @param compose compose
1366 * @param timestamp Timestamp of the mouse up event
1367 * @param data Data for canvas.
1369 * This function will set some evas properties that is necessary when
1370 * a key is released. It prepares information to be treated by the
1371 * callback function.
1375 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)
1377 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1380 if (!keyname) return;
1381 if (e->events_frozen > 0) return;
1382 e->last_timestamp = timestamp;
1385 Evas_Event_Key_Up ev;
1388 _evas_object_event_new();
1391 ev.keyname = (char *)keyname;
1392 ev.data = (void *)data;
1393 ev.modifiers = &(e->modifiers);
1394 ev.locks = &(e->locks);
1397 ev.compose = compose;
1398 ev.timestamp = timestamp;
1399 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1406 EINA_LIST_FOREACH(e->grabs, l, g)
1413 if (g->delete_me) continue;
1414 if (((e->modifiers.mask & g->modifiers) ||
1415 (g->modifiers == e->modifiers.mask)) &&
1416 (!((e->modifiers.mask & g->not_modifiers) ||
1417 (g->not_modifiers == ~e->modifiers.mask))) &&
1418 (!strcmp(keyname, g->keyname)))
1420 if (e->events_frozen <= 0)
1421 evas_object_event_callback_call(g->object, EVAS_CALLBACK_KEY_UP, &ev);
1422 if (g->exclusive) exclusive = 1;
1424 if (e->delete_me) break;
1427 if (e->walking_grabs <= 0)
1429 while (e->delete_grabs > 0)
1431 Eina_List *l, *l_next;
1435 EINA_LIST_FOREACH_SAFE(e->grabs, l, l_next, g)
1438 evas_key_grab_free(g->object, g->keyname, g->modifiers, g->not_modifiers);
1443 if ((e->focused) && (!exclusive))
1445 if (e->events_frozen <= 0)
1446 evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_UP, &ev);
1448 _evas_post_event_callback_call(e);
1456 * @param e The given canvas pointer.
1457 * @param hold The hold.
1458 * @param timestamp The timestamp of the mouse up event.
1459 * @param data The data for canvas.
1461 * This function makes the object to stop sending events.
1465 evas_event_feed_hold(Evas *e, int hold, unsigned int timestamp, const void *data)
1467 Eina_List *l, *copy;
1471 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1475 if (e->events_frozen > 0) return;
1476 e->last_timestamp = timestamp;
1478 _evas_object_event_new();
1481 ev.data = (void *)data;
1482 ev.timestamp = timestamp;
1483 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1486 copy = evas_event_list_copy(e->pointer.object.in);
1487 EINA_LIST_FOREACH(copy, l, obj)
1489 if (e->events_frozen <= 0)
1490 evas_object_event_callback_call(obj, EVAS_CALLBACK_HOLD, &ev);
1491 if (e->delete_me) break;
1493 if (copy) copy = eina_list_free(copy);
1494 _evas_post_event_callback_call(e);
1496 _evas_object_event_new();
1504 * @addtogroup Evas_Object_Group_Events
1509 * Set an object's pass events state.
1510 * @param obj the evas object
1511 * @param pass whether to pass events or not
1513 * If @p pass is true, this will cause events on @p obj to be ignored.
1514 * They will be triggered on the next lower object (that is not set to
1515 * pass events) instead.
1517 * If @p pass is false, events will be processed as normal.
1520 evas_object_pass_events_set(Evas_Object *obj, Eina_Bool pass)
1522 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1525 if (obj->pass_events == !!pass) return;
1526 obj->pass_events = pass;
1527 evas_object_smart_member_cache_invalidate(obj);
1528 if (evas_object_is_in_output_rect(obj,
1529 obj->layer->evas->pointer.x,
1530 obj->layer->evas->pointer.y, 1, 1) &&
1531 ((!obj->precise_is_inside) ||
1532 (evas_object_is_inside(obj,
1533 obj->layer->evas->pointer.x,
1534 obj->layer->evas->pointer.y))))
1535 evas_event_feed_mouse_move(obj->layer->evas,
1536 obj->layer->evas->pointer.x,
1537 obj->layer->evas->pointer.y,
1538 obj->layer->evas->last_timestamp,
1543 * Determine whether an object is set to pass events.
1545 * @return pass events state
1548 evas_object_pass_events_get(const Evas_Object *obj)
1550 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1553 return obj->pass_events;
1557 * Set an object's repeat events state.
1558 * @param obj the object
1559 * @param repeat wheter to repeat events or not
1561 * If @p repeat is true, this will cause events on @p obj to trigger
1562 * callbacks, but also to be repeated on the next lower object in the
1565 * If @p repeat is false, events occuring on @p obj will be processed
1569 evas_object_repeat_events_set(Evas_Object *obj, Eina_Bool repeat)
1571 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1574 if (obj->repeat_events == !!repeat) return;
1575 obj->repeat_events = repeat;
1576 if (evas_object_is_in_output_rect(obj,
1577 obj->layer->evas->pointer.x,
1578 obj->layer->evas->pointer.y, 1, 1) &&
1579 ((!obj->precise_is_inside) ||
1580 (evas_object_is_inside(obj,
1581 obj->layer->evas->pointer.x,
1582 obj->layer->evas->pointer.y))))
1583 evas_event_feed_mouse_move(obj->layer->evas,
1584 obj->layer->evas->pointer.x,
1585 obj->layer->evas->pointer.y,
1586 obj->layer->evas->last_timestamp,
1591 * Determine whether an object is set to repeat events.
1593 * @return repeat events state
1596 evas_object_repeat_events_get(const Evas_Object *obj)
1598 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1601 return obj->repeat_events;
1605 * Set whether events on a smart member object should propagate to its
1608 * @param obj the smart member object
1609 * @param prop wheter to propagate events or not
1611 * This function has no effect if @p obj is not a member of a smart
1614 * If @p prop is true, events occuring on this object will propagate on
1615 * to the smart object of which @p obj is a member.
1617 * If @p prop is false, events for which callbacks are set on the member
1618 * object, @p obj, will not be passed on to the parent smart object.
1620 * The default value is true.
1623 evas_object_propagate_events_set(Evas_Object *obj, Eina_Bool prop)
1625 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1628 obj->no_propagate = !prop;
1632 * Determine whether an object is set to propagate events.
1634 * @return propogate events state
1637 evas_object_propagate_events_get(const Evas_Object *obj)
1639 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1642 return !(obj->no_propagate);
1650 * Set pointer behavior.
1653 * @param setting desired behavior.
1655 * This function has direct effect on event callbacks related to
1658 * If @p setting is EVAS_OBJECT_POINTER_MODE_AUTOGRAB, then when mouse
1659 * is down at this object, events will be restricted to it as source,
1660 * mouse moves, for example, will be emitted even if outside this
1663 * If @p setting is EVAS_OBJECT_POINTER_MODE_NOGRAB, then events will
1664 * be emitted just when inside this object area.
1666 * The default value is EVAS_OBJECT_POINTER_MODE_AUTOGRAB.
1668 * @ingroup Evas_Object_Group_Extras
1671 evas_object_pointer_mode_set(Evas_Object *obj, Evas_Object_Pointer_Mode setting)
1673 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1676 obj->pointer_mode = setting;
1680 * Determine how pointer will behave.
1682 * @return pointer behavior.
1683 * @ingroup Evas_Object_Group_Extras
1685 EAPI Evas_Object_Pointer_Mode
1686 evas_object_pointer_mode_get(const Evas_Object *obj)
1688 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1691 return obj->pointer_mode;