1 #include "evas_common.h"
2 #include "evas_private.h"
5 _evas_event_object_list_in_get(Evas *e, Eina_List *in, const Eina_Inlist *list, Evas_Object *stop, int x, int y, int *no_rep)
10 EINA_INLIST_REVERSE_FOREACH(list, obj)
17 if (!evas_event_passes_through(obj))
19 if ((obj->cur.visible) && (obj->delete_me == 0) &&
20 (!obj->clip.clipees) &&
21 (evas_object_clippers_is_visible(obj)))
28 in = _evas_event_object_list_in_get(e, in,
29 evas_object_smart_members_get_direct(obj),
39 if (evas_object_is_in_output_rect(obj, x, y, 1, 1) &&
40 ((!obj->precise_is_inside) ||
41 (evas_object_is_inside(obj, x, y))))
43 in = eina_list_append(in, obj);
44 if (!obj->repeat_events)
59 evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y)
64 if (!e->layers) return NULL;
65 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
70 in = _evas_event_object_list_in_get(e, in, EINA_INLIST_GET(lay->objects), stop,
77 static Eina_List *evas_event_list_copy(Eina_List *list);
79 evas_event_list_copy(Eina_List *list)
81 Eina_List *l, *new_l = NULL;
84 EINA_LIST_FOREACH(list, l, data)
85 new_l = eina_list_append(new_l, data);
88 /* public functions */
91 * @defgroup Evas_Event_Freezing_Group Evas Event Freezing Functions
93 * Functions that deal with the freezing of event processing of an
98 * Freeze all event processing.
99 * @param e The canvas to freeze event processing on.
101 * This function will indicate to evas that the canvas @p e is to have
102 * all event processing frozen until a matching evas_event_thaw()
103 * function is called on the same canvas. Every freeze call must be
104 * matched by a thaw call in order to completely thaw out a canvas.
109 * extern Evas_Object *object;
111 * evas_event_freeze(evas);
112 * evas_object_move(object, 50, 100);
113 * evas_object_resize(object, 200, 200);
114 * evas_event_thaw(evas);
116 * @ingroup Evas_Event_Freezing_Group
119 evas_event_freeze(Evas *e)
121 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
128 * Thaw a canvas out after freezing.
130 * @param e The canvas to thaw out.
132 * This will thaw out a canvas after a matching evas_event_freeze()
133 * call. If this call completely thaws out a canvas, events will start
134 * being processed again after this call, but this call will not
135 * invole any "missed" events to be evaluated.
137 * See evas_event_freeze() for an example.
138 * @ingroup Evas_Event_Freezing_Group
141 evas_event_thaw(Evas *e)
143 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
147 if (e->events_frozen == 0)
151 EINA_INLIST_FOREACH((EINA_INLIST_GET(e->layers)), lay)
155 EINA_INLIST_FOREACH(lay->objects, obj)
157 evas_object_clip_recalc(obj);
158 evas_object_recalc_clippees(obj);
162 if (e->events_frozen < 0)
163 evas_debug_generic(" Thaw of events when already thawed!!!\n");
167 * Return the freeze count of a given canvas.
168 * @param e The canvas to fetch the freeze count from.
170 * This returns the number of times the canvas has been told to freeze
171 * events. It is possible to call evas_event_freeze() multiple times,
172 * and these must be matched by evas_event_thaw() calls. This call
173 * allows the program to discover just how many times things have been
174 * frozen in case it may want to break out of a deep freeze state
175 * where the count is high.
181 * while (evas_event_freeze_get(evas) > 0) evas_event_thaw(evas);
183 * @ingroup Evas_Event_Freezing_Group
186 evas_event_freeze_get(const Evas *e)
188 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
191 return e->events_frozen;
196 * Mouse down event feed.
198 * @param e The given canvas pointer.
199 * @param b The button number.
200 * @param flags The evas button flags.
201 * @param timestamp The timestamp of the mouse down event.
202 * @param data The data for canvas.
204 * This function will set some evas properties that is necessary when
205 * the mouse button is pressed. It prepares information to be treated
206 * by the callback function.
210 evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
213 Evas_Event_Mouse_Down ev;
216 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
220 if ((b < 1) || (b > 32)) return;
222 e->pointer.button |= (1 << (b - 1));
224 if (e->events_frozen > 0) return;
225 e->last_timestamp = timestamp;
228 ev.output.x = e->pointer.x;
229 ev.output.y = e->pointer.y;
230 ev.canvas.x = e->pointer.x;
231 ev.canvas.y = e->pointer.y;
232 ev.data = (void *)data;
233 ev.modifiers = &(e->modifiers);
234 ev.locks = &(e->locks);
236 ev.timestamp = timestamp;
237 ev.event_flags = EVAS_EVENT_FLAG_NONE;
240 copy = evas_event_list_copy(e->pointer.object.in);
241 EINA_LIST_FOREACH(copy, l, obj)
243 if (obj->pointer_mode != EVAS_OBJECT_POINTER_MODE_NOGRAB)
245 obj->mouse_grabbed++;
246 e->pointer.mouse_grabbed++;
249 if (e->events_frozen <= 0)
250 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_DOWN, &ev);
251 if (e->delete_me) break;
253 if (copy) eina_list_free(copy);
254 e->last_mouse_down_counter++;
259 * Mouse up event feed.
261 * @param e The given canvas pointer.
262 * @param b The button number.
263 * @param flags evas button flags.
264 * @param timestamp The timestamp of the mouse up event.
265 * @param data The data for canvas.
267 * This function will set some evas properties that is necessary when
268 * the mouse button is released. It prepares information to be treated
269 * by the callback function.
273 evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data)
277 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
281 if ((b < 1) || (b > 32)) return;
283 e->pointer.button &= ~(1 << (b - 1));
285 if (e->events_frozen > 0) return;
286 e->last_timestamp = timestamp;
289 Evas_Event_Mouse_Up ev;
293 ev.output.x = e->pointer.x;
294 ev.output.y = e->pointer.y;
295 ev.canvas.x = e->pointer.x;
296 ev.canvas.y = e->pointer.y;
297 ev.data = (void *)data;
298 ev.modifiers = &(e->modifiers);
299 ev.locks = &(e->locks);
301 ev.timestamp = timestamp;
302 ev.event_flags = EVAS_EVENT_FLAG_NONE;
305 copy = evas_event_list_copy(e->pointer.object.in);
306 EINA_LIST_FOREACH(copy, l, obj)
308 if ((obj->pointer_mode != EVAS_OBJECT_POINTER_MODE_NOGRAB) &&
309 (obj->mouse_in) && (obj->mouse_grabbed > 0))
311 obj->mouse_grabbed--;
312 e->pointer.mouse_grabbed--;
314 if (e->events_frozen <= 0)
315 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_UP, &ev);
316 if (e->delete_me) break;
318 if (copy) copy = eina_list_free(copy);
319 e->last_mouse_up_counter++;
322 if (!e->pointer.button)
327 Evas_Event_Mouse_Out ev;
330 ev.buttons = e->pointer.button;
331 ev.output.x = e->pointer.x;
332 ev.output.y = e->pointer.y;
333 ev.canvas.x = e->pointer.x;
334 ev.canvas.y = e->pointer.y;
335 ev.data = (void *)data;
336 ev.modifiers = &(e->modifiers);
337 ev.locks = &(e->locks);
338 ev.timestamp = timestamp;
339 ev.event_flags = EVAS_EVENT_FLAG_NONE;
341 /* get new list of ins */
342 ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y);
343 /* go thru old list of in objects */
344 copy = evas_event_list_copy(e->pointer.object.in);
345 EINA_LIST_FOREACH(copy, l, obj)
347 if ((!eina_list_data_find(ins, obj)) ||
348 (!e->pointer.inside))
352 if (e->events_frozen <= 0)
353 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
355 if (e->delete_me) break;
358 if (copy) copy = eina_list_free(copy);
359 if (e->pointer.inside)
361 Evas_Event_Mouse_In ev;
364 ev.buttons = e->pointer.button;
365 ev.output.x = e->pointer.x;
366 ev.output.y = e->pointer.y;
367 ev.canvas.x = e->pointer.x;
368 ev.canvas.y = e->pointer.y;
369 ev.data = (void *)data;
370 ev.modifiers = &(e->modifiers);
371 ev.locks = &(e->locks);
372 ev.timestamp = timestamp;
373 ev.event_flags = EVAS_EVENT_FLAG_NONE;
375 EINA_LIST_FOREACH(ins, l, obj)
377 if (!eina_list_data_find(e->pointer.object.in, obj))
381 if (e->events_frozen <= 0)
382 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
384 if (e->delete_me) break;
389 ins = eina_list_free(ins);
391 /* free our old list of ins */
392 e->pointer.object.in = eina_list_free(e->pointer.object.in);
393 /* and set up the new one */
394 e->pointer.object.in = ins;
395 if (e->pointer.inside)
396 evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data);
399 if (e->pointer.mouse_grabbed < 0)
401 fprintf(stderr, "BUG? e->pointer.mouse_grabbed (=%d) < 0!\n",
402 e->pointer.mouse_grabbed);
405 if ((e->pointer.button == 0) && (e->pointer.mouse_grabbed != 0))
407 printf("restore to 0 grabs (from %i)\n", e->pointer.mouse_grabbed);
408 e->pointer.mouse_grabbed = 0;
415 * Mouse cancel event feed.
417 * @param e The given canvas pointer.
418 * @param timestamp The timestamp of the mouse up event.
419 * @param data The data for canvas.
421 * This function will call evas_event_feed_mouse_up() when a
422 * mouse cancel event happens.
426 evas_event_feed_mouse_cancel(Evas *e, unsigned int timestamp, const void *data)
430 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
434 if (e->events_frozen > 0) return;
437 for (i = 0; i < 32; i++)
439 if ((e->pointer.button & (1 << i)))
440 evas_event_feed_mouse_up(e, i + 1, 0, timestamp, data);
446 * Mouse wheel event feed.
448 * @param e The given canvas pointer.
449 * @param direction The wheel mouse direction.
450 * @param z How much mouse wheel was scrolled up or down.
451 * @param timestamp The timestamp of the mouse up event.
452 * @param data The data for canvas.
454 * This function will set some evas properties that is necessary when
455 * the mouse wheel is scrolled up or down. It prepares information to
456 * be treated by the callback function.
460 evas_event_feed_mouse_wheel(Evas *e, int direction, int z, unsigned int timestamp, const void *data)
463 Evas_Event_Mouse_Wheel ev;
466 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
470 if (e->events_frozen > 0) return;
471 e->last_timestamp = timestamp;
473 ev.direction = direction;
475 ev.output.x = e->pointer.x;
476 ev.output.y = e->pointer.y;
477 ev.canvas.x = e->pointer.x;
478 ev.canvas.y = e->pointer.y;
479 ev.data = (void *) data;
480 ev.modifiers = &(e->modifiers);
481 ev.locks = &(e->locks);
482 ev.timestamp = timestamp;
483 ev.event_flags = EVAS_EVENT_FLAG_NONE;
486 copy = evas_event_list_copy(e->pointer.object.in);
488 EINA_LIST_FOREACH(copy, l, obj)
490 if (e->events_frozen <= 0)
491 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_WHEEL, &ev);
492 if (e->delete_me) break;
494 if (copy) copy = eina_list_free(copy);
500 * Mouse move event feed.
502 * @param e The given canvas pointer.
503 * @param x The horizontal position of the mouse pointer.
504 * @param y The vertical position of the mouse pointer.
505 * @param timestamp The timestamp of the mouse up event.
506 * @param data The data for canvas.
508 * This function will set some evas properties that is necessary when
509 * the mouse is moved from its last position. It prepares information
510 * to be treated by the callback function.
514 evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const void *data)
517 //// Evas_Coord pcx, pcy;
519 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
525 //// pcx = e->pointer.canvas_x;
526 //// pcy = e->pointer.canvas_y;
528 if (e->events_frozen > 0) return;
529 e->last_timestamp = timestamp;
533 //// e->pointer.canvas_x = x;
534 //// e->pointer.canvas_y = y;
535 //// e->pointer.canvas_x = evas_coord_screen_x_to_world(e, x);
536 //// e->pointer.canvas_y = evas_coord_screen_y_to_world(e, y);
537 if ((!e->pointer.inside) && (e->pointer.mouse_grabbed == 0)) return;
539 /* if our mouse button is grabbed to any objects */
540 if (e->pointer.mouse_grabbed > 0)
542 /* go thru old list of in objects */
543 Eina_List *outs = NULL;
547 Evas_Event_Mouse_Move ev;
550 ev.buttons = e->pointer.button;
551 ev.cur.output.x = e->pointer.x;
552 ev.cur.output.y = e->pointer.y;
553 ev.cur.canvas.x = e->pointer.x;
554 ev.cur.canvas.y = e->pointer.y;
555 ev.prev.output.x = px;
556 ev.prev.output.y = py;
557 ev.prev.canvas.x = px;
558 ev.prev.canvas.y = py;
559 ev.data = (void *)data;
560 ev.modifiers = &(e->modifiers);
561 ev.locks = &(e->locks);
562 ev.timestamp = timestamp;
563 ev.event_flags = EVAS_EVENT_FLAG_NONE;
564 copy = evas_event_list_copy(e->pointer.object.in);
565 EINA_LIST_FOREACH(copy, l, obj)
567 if ((obj->cur.visible) &&
568 (evas_object_clippers_is_visible(obj)) &&
569 (!evas_event_passes_through(obj)) &&
570 (!obj->clip.clipees))
572 if ((px != x) || (py != y))
574 if (e->events_frozen <= 0)
575 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev);
579 outs = eina_list_append(outs, obj);
580 if (e->delete_me) break;
584 Evas_Event_Mouse_Out ev;
586 ev.buttons = e->pointer.button;
587 ev.output.x = e->pointer.x;
588 ev.output.y = e->pointer.y;
589 ev.canvas.x = e->pointer.x;
590 ev.canvas.y = e->pointer.y;
591 ev.data = (void *)data;
592 ev.modifiers = &(e->modifiers);
593 ev.locks = &(e->locks);
594 ev.timestamp = timestamp;
595 ev.event_flags = EVAS_EVENT_FLAG_NONE;
597 if (copy) copy = eina_list_free(copy);
603 outs = eina_list_remove(outs, obj);
604 if ((obj->mouse_grabbed == 0) && (!e->delete_me))
606 e->pointer.object.in = eina_list_remove(e->pointer.object.in, obj);
609 if (e->events_frozen <= 0)
610 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
620 Evas_Event_Mouse_Move ev;
621 Evas_Event_Mouse_Out ev2;
622 Evas_Event_Mouse_In ev3;
625 ev.buttons = e->pointer.button;
626 ev.cur.output.x = e->pointer.x;
627 ev.cur.output.y = e->pointer.y;
628 ev.cur.canvas.x = e->pointer.x;
629 ev.cur.canvas.y = e->pointer.y;
630 ev.prev.output.x = px;
631 ev.prev.output.y = py;
632 ev.prev.canvas.x = px;
633 ev.prev.canvas.y = py;
634 ev.data = (void *)data;
635 ev.modifiers = &(e->modifiers);
636 ev.locks = &(e->locks);
637 ev.timestamp = timestamp;
638 ev.event_flags = EVAS_EVENT_FLAG_NONE;
640 ev2.buttons = e->pointer.button;
641 ev2.output.x = e->pointer.x;
642 ev2.output.y = e->pointer.y;
643 ev2.canvas.x = e->pointer.x;
644 ev2.canvas.y = e->pointer.y;
645 ev2.data = (void *)data;
646 ev2.modifiers = &(e->modifiers);
647 ev2.locks = &(e->locks);
648 ev2.timestamp = timestamp;
649 ev2.event_flags = EVAS_EVENT_FLAG_NONE;
651 ev3.buttons = e->pointer.button;
652 ev3.output.x = e->pointer.x;
653 ev3.output.y = e->pointer.y;
654 ev3.canvas.x = e->pointer.x;
655 ev3.canvas.y = e->pointer.y;
656 ev3.data = (void *)data;
657 ev3.modifiers = &(e->modifiers);
658 ev3.locks = &(e->locks);
659 ev3.timestamp = timestamp;
660 ev3.event_flags = EVAS_EVENT_FLAG_NONE;
662 /* get all new in objects */
663 ins = evas_event_objects_event_list(e, NULL, x, y);
664 /* go thru old list of in objects */
665 copy = evas_event_list_copy(e->pointer.object.in);
666 EINA_LIST_FOREACH(copy, l, obj)
668 /* if its under the pointer and its visible and its in the new */
670 // FIXME: i don't think we need this
671 // evas_object_clip_recalc(obj);
672 if (evas_object_is_in_output_rect(obj, x, y, 1, 1) &&
673 (obj->cur.visible) &&
674 (evas_object_clippers_is_visible(obj)) &&
675 (eina_list_data_find(ins, obj)) &&
676 (!evas_event_passes_through(obj)) &&
677 (!obj->clip.clipees) &&
678 ((!obj->precise_is_inside) ||
679 (evas_object_is_inside(obj, x, y))))
681 if ((px != x) || (py != y))
683 if (e->events_frozen <= 0)
684 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_MOVE, &ev);
687 /* otherwise it has left the object */
691 if (e->events_frozen <= 0)
692 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev2);
694 if (e->delete_me) break;
696 if (copy) copy = eina_list_free(copy);
697 /* go thru our current list of ins */
698 EINA_LIST_FOREACH(ins, l, obj)
700 /* if its not in the old list of ins send an enter event */
701 if (!eina_list_data_find(e->pointer.object.in, obj))
705 if (e->events_frozen <= 0)
706 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev3);
708 if (e->delete_me) break;
710 /* free our old list of ins */
711 eina_list_free(e->pointer.object.in);
712 /* and set up the new one */
713 e->pointer.object.in = ins;
719 * Mouse in event feed.
721 * @param e The given canvas pointer.
722 * @param timestamp The timestamp of the mouse up event.
723 * @param data The data for canvas.
725 * This function will set some evas properties that is necessary when
726 * the mouse in event happens. It prepares information to be treated
727 * by the callback function.
731 evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data)
735 Evas_Event_Mouse_In ev;
738 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
741 e->pointer.inside = 1;
743 if (e->events_frozen > 0) return;
744 e->last_timestamp = timestamp;
746 if (e->pointer.mouse_grabbed != 0) return;
748 ev.buttons = e->pointer.button;
749 ev.output.x = e->pointer.x;
750 ev.output.y = e->pointer.y;
751 ev.canvas.x = e->pointer.x;
752 ev.canvas.y = e->pointer.y;
753 ev.data = (void *)data;
754 ev.modifiers = &(e->modifiers);
755 ev.locks = &(e->locks);
756 ev.timestamp = timestamp;
757 ev.event_flags = EVAS_EVENT_FLAG_NONE;
760 /* get new list of ins */
761 ins = evas_event_objects_event_list(e, NULL, e->pointer.x, e->pointer.y);
762 EINA_LIST_FOREACH(ins, l, obj)
764 if (!eina_list_data_find(e->pointer.object.in, obj))
768 if (e->events_frozen <= 0)
769 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
771 if (e->delete_me) break;
773 /* free our old list of ins */
774 e->pointer.object.in = eina_list_free(e->pointer.object.in);
775 /* and set up the new one */
776 e->pointer.object.in = ins;
777 evas_event_feed_mouse_move(e, e->pointer.x, e->pointer.y, timestamp, data);
782 * Mouse out event feed.
784 * @param e The given canvas pointer.
785 * @param timestamp Timestamp of the mouse up event.
786 * @param data The data for canvas.
788 * This function will set some evas properties that is necessary when
789 * the mouse out event happens. It prepares information to be treated
790 * by the callback function.
794 evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data)
796 Evas_Event_Mouse_Out ev;
798 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
801 e->pointer.inside = 0;
803 if (e->events_frozen > 0) return;
804 e->last_timestamp = timestamp;
806 ev.buttons = e->pointer.button;
807 ev.output.x = e->pointer.x;
808 ev.output.y = e->pointer.y;
809 ev.canvas.x = e->pointer.x;
810 ev.canvas.y = e->pointer.y;
811 ev.data = (void *)data;
812 ev.modifiers = &(e->modifiers);
813 ev.locks = &(e->locks);
814 ev.timestamp = timestamp;
815 ev.event_flags = EVAS_EVENT_FLAG_NONE;
818 /* if our mouse button is grabbed to any objects */
819 if (e->pointer.mouse_grabbed == 0)
821 /* go thru old list of in objects */
825 copy = evas_event_list_copy(e->pointer.object.in);
826 EINA_LIST_FOREACH(copy, l, obj)
829 if (e->events_frozen <= 0)
830 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
832 if (e->delete_me) break;
834 if (copy) copy = eina_list_free(copy);
835 /* free our old list of ins */
836 e->pointer.object.in = eina_list_free(e->pointer.object.in);
842 * Key down event feed
844 * @param e The canvas to thaw out
845 * @param keyname Name of the key
846 * @param key The key pressed.
847 * @param string A String
848 * @param compose The compose string
849 * @param timestamp Timestamp of the mouse up event
850 * @param data Data for canvas.
852 * This function will set some evas properties that is necessary when
853 * a key is pressed. It prepares information to be treated by the
858 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)
860 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
863 if (!keyname) return;
864 if (e->events_frozen > 0) return;
865 e->last_timestamp = timestamp;
868 Evas_Event_Key_Down ev;
872 ev.keyname = (char *)keyname;
873 ev.data = (void *)data;
874 ev.modifiers = &(e->modifiers);
875 ev.locks = &(e->locks);
878 ev.compose = compose;
879 ev.timestamp = timestamp;
880 ev.event_flags = EVAS_EVENT_FLAG_NONE;
887 EINA_LIST_FOREACH(e->grabs, l, g)
894 if (g->delete_me) continue;
895 if (((e->modifiers.mask & g->modifiers) ||
896 (g->modifiers == e->modifiers.mask)) &&
897 (!strcmp(keyname, g->keyname)))
899 if (!(e->modifiers.mask & g->not_modifiers))
901 if (e->events_frozen <= 0)
902 evas_object_event_callback_call(g->object, EVAS_CALLBACK_KEY_DOWN, &ev);
903 if (g->exclusive) exclusive = 1;
906 if (e->delete_me) break;
909 if (e->walking_grabs <= 0)
911 while (e->delete_grabs > 0)
914 for (l = e->grabs; l;)
916 g = eina_list_data_get(l);
917 l = eina_list_next(l);
919 evas_key_grab_free(g->object, g->keyname, g->modifiers, g->not_modifiers);
924 if ((e->focused) && (!exclusive))
926 if (e->events_frozen <= 0)
927 evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_DOWN, &ev);
936 * @param e The canvas to thaw out
937 * @param keyname Name of the key
938 * @param key The key released.
939 * @param string string
940 * @param compose compose
941 * @param timestamp Timestamp of the mouse up event
942 * @param data Data for canvas.
944 * This function will set some evas properties that is necessary when
945 * a key is released. It prepares information to be treated by the
950 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)
952 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
955 if (!keyname) return;
956 if (e->events_frozen > 0) return;
957 e->last_timestamp = timestamp;
960 Evas_Event_Key_Up ev;
964 ev.keyname = (char *)keyname;
965 ev.data = (void *)data;
966 ev.modifiers = &(e->modifiers);
967 ev.locks = &(e->locks);
970 ev.compose = compose;
971 ev.timestamp = timestamp;
972 ev.event_flags = EVAS_EVENT_FLAG_NONE;
979 EINA_LIST_FOREACH(e->grabs, l, g)
986 if (g->delete_me) continue;
987 if (((e->modifiers.mask & g->modifiers) ||
988 (g->modifiers == e->modifiers.mask)) &&
989 (!((e->modifiers.mask & g->not_modifiers) ||
990 (g->not_modifiers == ~e->modifiers.mask))) &&
991 (!strcmp(keyname, g->keyname)))
993 if (e->events_frozen <= 0)
994 evas_object_event_callback_call(g->object, EVAS_CALLBACK_KEY_UP, &ev);
995 if (g->exclusive) exclusive = 1;
997 if (e->delete_me) break;
1000 if (e->walking_grabs <= 0)
1002 while (e->delete_grabs > 0)
1004 Eina_List *l, *l_next;
1008 EINA_LIST_FOREACH_SAFE(e->grabs, l, l_next, g)
1011 evas_key_grab_free(g->object, g->keyname, g->modifiers, g->not_modifiers);
1016 if ((e->focused) && (!exclusive))
1018 if (e->events_frozen <= 0)
1019 evas_object_event_callback_call(e->focused, EVAS_CALLBACK_KEY_UP, &ev);
1028 * @param e The given canvas pointer.
1029 * @param hold The hold.
1030 * @param timestamp The timestamp of the mouse up event.
1031 * @param data The data for canvas.
1033 * This function makes the object to stop sending events.
1037 evas_event_feed_hold(Evas *e, int hold, unsigned int timestamp, const void *data)
1039 Eina_List *l, *copy;
1043 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1047 if (e->events_frozen > 0) return;
1048 e->last_timestamp = timestamp;
1051 ev.data = (void *)data;
1052 ev.timestamp = timestamp;
1053 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1056 copy = evas_event_list_copy(e->pointer.object.in);
1057 EINA_LIST_FOREACH(copy, l, obj)
1059 if (e->events_frozen <= 0)
1060 evas_object_event_callback_call(obj, EVAS_CALLBACK_HOLD, &ev);
1061 if (e->delete_me) break;
1063 if (copy) copy = eina_list_free(copy);
1069 * @addtogroup Evas_Object_Group
1074 * Set an object's pass events state.
1075 * @param obj the evas object
1076 * @param pass whether to pass events or not
1078 * If @p pass is true, this will cause events on @p obj to be ignored.
1079 * They will be triggered on the next lower object (that is not set to
1080 * pass events) instead.
1082 * If @p pass is false, events will be processed as normal.
1084 * @ingroup Evas_Object_Event_Flags_Group
1087 evas_object_pass_events_set(Evas_Object *obj, Eina_Bool pass)
1089 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1092 obj->pass_events = pass;
1093 evas_object_smart_member_cache_invalidate(obj);
1094 if (evas_object_is_in_output_rect(obj,
1095 obj->layer->evas->pointer.x,
1096 obj->layer->evas->pointer.y, 1, 1) &&
1097 ((!obj->precise_is_inside) ||
1098 (evas_object_is_inside(obj,
1099 obj->layer->evas->pointer.x,
1100 obj->layer->evas->pointer.y))))
1101 evas_event_feed_mouse_move(obj->layer->evas,
1102 obj->layer->evas->pointer.x,
1103 obj->layer->evas->pointer.y,
1104 obj->layer->evas->last_timestamp,
1109 * Determine whether an object is set to pass events.
1111 * @return pass events state
1113 * @ingroup Evas_Object_Event_Flags_Group
1116 evas_object_pass_events_get(const Evas_Object *obj)
1118 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1121 return obj->pass_events;
1125 * Set an object's repeat events state.
1126 * @param obj the object
1127 * @param repeat wheter to repeat events or not
1129 * If @p repeat is true, this will cause events on @p obj to trigger
1130 * callbacks, but also to be repeated on the next lower object in the
1133 * If @p repeat is false, events occuring on @p obj will be processed
1136 * @ingroup Evas_Object_Event_Flags_Group
1139 evas_object_repeat_events_set(Evas_Object *obj, Eina_Bool repeat)
1141 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1144 obj->repeat_events = repeat;
1145 if (evas_object_is_in_output_rect(obj,
1146 obj->layer->evas->pointer.x,
1147 obj->layer->evas->pointer.y, 1, 1) &&
1148 ((!obj->precise_is_inside) ||
1149 (evas_object_is_inside(obj,
1150 obj->layer->evas->pointer.x,
1151 obj->layer->evas->pointer.y))))
1152 evas_event_feed_mouse_move(obj->layer->evas,
1153 obj->layer->evas->pointer.x,
1154 obj->layer->evas->pointer.y,
1155 obj->layer->evas->last_timestamp,
1160 * Determine whether an object is set to repeat events.
1162 * @return repeat events state
1164 * @ingroup Evas_Object_Event_Flags_Group
1167 evas_object_repeat_events_get(const Evas_Object *obj)
1169 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1172 return obj->repeat_events;
1176 * Set whether events on a smart member object should propagate to its
1179 * @param obj the smart member object
1180 * @param prop wheter to propagate events or not
1182 * This function has no effect if @p obj is not a member of a smart
1185 * If @p prop is true, events occuring on this object will propagate on
1186 * to the smart object of which @p obj is a member.
1188 * If @p prop is false, events for which callbacks are set on the member
1189 * object, @p obj, will not be passed on to the parent smart object.
1191 * The default value is true.
1192 * @ingroup Evas_Object_Event_Flags_Group
1195 evas_object_propagate_events_set(Evas_Object *obj, Eina_Bool prop)
1197 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1200 obj->no_propagate = !prop;
1204 * Determine whether an object is set to propagate events.
1206 * @return propogate events state
1208 * @ingroup Evas_Object_Event_Flags_Group
1211 evas_object_propagate_events_get(const Evas_Object *obj)
1213 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1216 return !(obj->no_propagate);
1224 * Set pointer behavior.
1227 * @param setting desired behavior.
1229 * This function has direct effect on event callbacks related to
1232 * If @p setting is EVAS_OBJECT_POINTER_MODE_AUTOGRAB, then when mouse
1233 * is down at this object, events will be restricted to it as source,
1234 * mouse moves, for example, will be emitted even if outside this
1237 * If @p setting is EVAS_OBJECT_POINTER_MODE_NOGRAB, then events will
1238 * be emitted just when inside this object area.
1240 * The default value is EVAS_OBJECT_POINTER_MODE_AUTOGRAB.
1243 evas_object_pointer_mode_set(Evas_Object *obj, Evas_Object_Pointer_Mode setting)
1245 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1248 obj->pointer_mode = setting;
1252 * Determine how pointer will behave.
1254 * @return pointer behavior.
1256 EAPI Evas_Object_Pointer_Mode
1257 evas_object_pointer_mode_get(const Evas_Object *obj)
1259 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1262 return obj->pointer_mode;