summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2010-03-04 14:48:21 +0000
committerCedric BAIL <cedric.bail@free.fr>2010-03-04 14:48:21 +0000
commitd790cbfd003f62e62d37fa9a6ca997268f0db62e (patch)
treea42005da85bdb18487d37da15b8b381da7699e67 /legacy
parentae586e291e7a53e74eb66fda8ec7ff5b17c41e51 (diff)
* evas: Now an object will only receive once the same event.
Previously, due to propagation to parent, an event could have been received more than once by an object. This triggered strange behaviour in edje for example where you could receive mouse,down,1 signal many time for one swallowed object. This patch is a fix for that problem, I hope it doesn't break anything (e17 and elementary_test run fine here, but report any break related to events please). SVN revision: 46869
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/src/lib/canvas/evas_callbacks.c4
-rw-r--r--legacy/evas/src/lib/canvas/evas_events.c37
-rw-r--r--legacy/evas/src/lib/canvas/evas_focus.c2
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_inform.c14
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_main.c6
-rw-r--r--legacy/evas/src/lib/include/evas_inline.x6
-rw-r--r--legacy/evas/src/lib/include/evas_private.h3
7 files changed, 72 insertions, 0 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_callbacks.c b/legacy/evas/src/lib/canvas/evas_callbacks.c
index 6750a85a59..c61d73c2b5 100644
--- a/legacy/evas/src/lib/canvas/evas_callbacks.c
+++ b/legacy/evas/src/lib/canvas/evas_callbacks.c
@@ -2,6 +2,7 @@
2#include "evas_private.h" 2#include "evas_private.h"
3 3
4static void evas_object_event_callback_clear(Evas_Object *obj); 4static void evas_object_event_callback_clear(Evas_Object *obj);
5int _evas_event_counter = 0;
5 6
6void 7void
7evas_event_callback_list_post_free(Eina_Inlist **list) 8evas_event_callback_list_post_free(Eina_Inlist **list)
@@ -95,6 +96,9 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void
95 Evas_Button_Flags flags = EVAS_BUTTON_NONE; 96 Evas_Button_Flags flags = EVAS_BUTTON_NONE;
96 Evas *e; 97 Evas *e;
97 98
99 if (obj->last_event == _evas_event_counter) return ;
100 obj->last_event = _evas_event_counter;
101
98 if (obj->delete_me) return; 102 if (obj->delete_me) return;
99 e = evas_object_evas_get(obj); 103 e = evas_object_evas_get(obj);
100 104
diff --git a/legacy/evas/src/lib/canvas/evas_events.c b/legacy/evas/src/lib/canvas/evas_events.c
index fedd8380a6..5b03acd168 100644
--- a/legacy/evas/src/lib/canvas/evas_events.c
+++ b/legacy/evas/src/lib/canvas/evas_events.c
@@ -295,6 +295,8 @@ evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int
295 if (e->events_frozen > 0) return; 295 if (e->events_frozen > 0) return;
296 e->last_timestamp = timestamp; 296 e->last_timestamp = timestamp;
297 297
298 _evas_object_event_new();
299
298 ev.button = b; 300 ev.button = b;
299 ev.output.x = e->pointer.x; 301 ev.output.x = e->pointer.x;
300 ev.output.y = e->pointer.y; 302 ev.output.y = e->pointer.y;
@@ -368,6 +370,8 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t
368 Evas_Event_Mouse_Up ev; 370 Evas_Event_Mouse_Up ev;
369 Evas_Object *obj; 371 Evas_Object *obj;
370 372
373 _evas_object_event_new();
374
371 ev.button = b; 375 ev.button = b;
372 ev.output.x = e->pointer.x; 376 ev.output.x = e->pointer.x;
373 ev.output.y = e->pointer.y; 377 ev.output.y = e->pointer.y;
@@ -409,6 +413,8 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t
409 Evas_Event_Mouse_Out ev; 413 Evas_Event_Mouse_Out ev;
410 Evas_Object *obj; 414 Evas_Object *obj;
411 415
416 _evas_object_event_new();
417
412 ev.buttons = e->pointer.button; 418 ev.buttons = e->pointer.button;
413 ev.output.x = e->pointer.x; 419 ev.output.x = e->pointer.x;
414 ev.output.y = e->pointer.y; 420 ev.output.y = e->pointer.y;
@@ -446,6 +452,8 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t
446 Evas_Event_Mouse_In ev; 452 Evas_Event_Mouse_In ev;
447 Evas_Object *obj; 453 Evas_Object *obj;
448 454
455 _evas_object_event_new();
456
449 ev.buttons = e->pointer.button; 457 ev.buttons = e->pointer.button;
450 ev.output.x = e->pointer.x; 458 ev.output.x = e->pointer.x;
451 ev.output.y = e->pointer.y; 459 ev.output.y = e->pointer.y;
@@ -558,6 +566,8 @@ evas_event_feed_mouse_wheel(Evas *e, int direction, int z, unsigned int timestam
558 if (e->events_frozen > 0) return; 566 if (e->events_frozen > 0) return;
559 e->last_timestamp = timestamp; 567 e->last_timestamp = timestamp;
560 568
569 _evas_object_event_new();
570
561 ev.direction = direction; 571 ev.direction = direction;
562 ev.z = z; 572 ev.z = z;
563 ev.output.x = e->pointer.x; 573 ev.output.x = e->pointer.x;
@@ -638,6 +648,8 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const
638 Evas_Event_Mouse_Move ev; 648 Evas_Event_Mouse_Move ev;
639 Evas_Object *obj; 649 Evas_Object *obj;
640 650
651 _evas_object_event_new();
652
641 ev.buttons = e->pointer.button; 653 ev.buttons = e->pointer.button;
642 ev.cur.output.x = e->pointer.x; 654 ev.cur.output.x = e->pointer.x;
643 ev.cur.output.y = e->pointer.y; 655 ev.cur.output.y = e->pointer.y;
@@ -677,6 +689,8 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const
677 { 689 {
678 Evas_Event_Mouse_Out ev; 690 Evas_Event_Mouse_Out ev;
679 691
692 _evas_object_event_new();
693
680 ev.buttons = e->pointer.button; 694 ev.buttons = e->pointer.button;
681 ev.output.x = e->pointer.x; 695 ev.output.x = e->pointer.x;
682 ev.output.y = e->pointer.y; 696 ev.output.y = e->pointer.y;
@@ -717,6 +731,8 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const
717 Evas_Event_Mouse_In ev3; 731 Evas_Event_Mouse_In ev3;
718 Evas_Object *obj; 732 Evas_Object *obj;
719 733
734 _evas_object_event_new();
735
720 ev.buttons = e->pointer.button; 736 ev.buttons = e->pointer.button;
721 ev.cur.output.x = e->pointer.x; 737 ev.cur.output.x = e->pointer.x;
722 ev.cur.output.y = e->pointer.y; 738 ev.cur.output.y = e->pointer.y;
@@ -794,6 +810,9 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const
794 } 810 }
795 if (e->delete_me) break; 811 if (e->delete_me) break;
796 } 812 }
813
814 _evas_object_event_new();
815
797 if (copy) copy = eina_list_free(copy); 816 if (copy) copy = eina_list_free(copy);
798 /* go thru our current list of ins */ 817 /* go thru our current list of ins */
799 EINA_LIST_FOREACH(ins, l, obj) 818 EINA_LIST_FOREACH(ins, l, obj)
@@ -849,6 +868,8 @@ evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data)
849 868
850 if (e->pointer.mouse_grabbed != 0) return; 869 if (e->pointer.mouse_grabbed != 0) return;
851 870
871 _evas_object_event_new();
872
852 ev.buttons = e->pointer.button; 873 ev.buttons = e->pointer.button;
853 ev.output.x = e->pointer.x; 874 ev.output.x = e->pointer.x;
854 ev.output.y = e->pointer.y; 875 ev.output.y = e->pointer.y;
@@ -910,6 +931,8 @@ evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data)
910 if (e->events_frozen > 0) return; 931 if (e->events_frozen > 0) return;
911 e->last_timestamp = timestamp; 932 e->last_timestamp = timestamp;
912 933
934 _evas_object_event_new();
935
913 ev.buttons = e->pointer.button; 936 ev.buttons = e->pointer.button;
914 ev.output.x = e->pointer.x; 937 ev.output.x = e->pointer.x;
915 ev.output.y = e->pointer.y; 938 ev.output.y = e->pointer.y;
@@ -968,6 +991,8 @@ evas_event_feed_multi_down(Evas *e,
968 if (e->events_frozen > 0) return; 991 if (e->events_frozen > 0) return;
969 e->last_timestamp = timestamp; 992 e->last_timestamp = timestamp;
970 993
994 _evas_object_event_new();
995
971 ev.device = d; 996 ev.device = d;
972 ev.output.x = x; 997 ev.output.x = x;
973 ev.output.y = y; 998 ev.output.y = y;
@@ -1028,6 +1053,8 @@ evas_event_feed_multi_up(Evas *e,
1028 if (e->events_frozen > 0) return; 1053 if (e->events_frozen > 0) return;
1029 e->last_timestamp = timestamp; 1054 e->last_timestamp = timestamp;
1030 1055
1056 _evas_object_event_new();
1057
1031 ev.device = d; 1058 ev.device = d;
1032 ev.output.x = x; 1059 ev.output.x = x;
1033 ev.output.y = y; 1060 ev.output.y = y;
@@ -1095,6 +1122,8 @@ evas_event_feed_multi_move(Evas *e,
1095 Evas_Event_Multi_Move ev; 1122 Evas_Event_Multi_Move ev;
1096 Evas_Object *obj; 1123 Evas_Object *obj;
1097 1124
1125 _evas_object_event_new();
1126
1098 ev.device = d; 1127 ev.device = d;
1099 ev.cur.output.x = x; 1128 ev.cur.output.x = x;
1100 ev.cur.output.y = y; 1129 ev.cur.output.y = y;
@@ -1143,6 +1172,8 @@ evas_event_feed_multi_move(Evas *e,
1143 Evas_Event_Multi_Move ev; 1172 Evas_Event_Multi_Move ev;
1144 Evas_Object *obj; 1173 Evas_Object *obj;
1145 1174
1175 _evas_object_event_new();
1176
1146 ev.device = d; 1177 ev.device = d;
1147 ev.cur.output.x = x; 1178 ev.cur.output.x = x;
1148 ev.cur.output.y = y; 1179 ev.cur.output.y = y;
@@ -1233,6 +1264,8 @@ evas_event_feed_key_down(Evas *e, const char *keyname, const char *key, const ch
1233 Evas_Event_Key_Down ev; 1264 Evas_Event_Key_Down ev;
1234 int exclusive; 1265 int exclusive;
1235 1266
1267 _evas_object_event_new();
1268
1236 exclusive = 0; 1269 exclusive = 0;
1237 ev.keyname = (char *)keyname; 1270 ev.keyname = (char *)keyname;
1238 ev.data = (void *)data; 1271 ev.data = (void *)data;
@@ -1325,6 +1358,8 @@ evas_event_feed_key_up(Evas *e, const char *keyname, const char *key, const char
1325 Evas_Event_Key_Up ev; 1358 Evas_Event_Key_Up ev;
1326 int exclusive; 1359 int exclusive;
1327 1360
1361 _evas_object_event_new();
1362
1328 exclusive = 0; 1363 exclusive = 0;
1329 ev.keyname = (char *)keyname; 1364 ev.keyname = (char *)keyname;
1330 ev.data = (void *)data; 1365 ev.data = (void *)data;
@@ -1412,6 +1447,8 @@ evas_event_feed_hold(Evas *e, int hold, unsigned int timestamp, const void *data
1412 if (e->events_frozen > 0) return; 1447 if (e->events_frozen > 0) return;
1413 e->last_timestamp = timestamp; 1448 e->last_timestamp = timestamp;
1414 1449
1450 _evas_object_event_new();
1451
1415 ev.hold = hold; 1452 ev.hold = hold;
1416 ev.data = (void *)data; 1453 ev.data = (void *)data;
1417 ev.timestamp = timestamp; 1454 ev.timestamp = timestamp;
diff --git a/legacy/evas/src/lib/canvas/evas_focus.c b/legacy/evas/src/lib/canvas/evas_focus.c
index 60619d8acf..9ce9cd8bfa 100644
--- a/legacy/evas/src/lib/canvas/evas_focus.c
+++ b/legacy/evas/src/lib/canvas/evas_focus.c
@@ -31,6 +31,8 @@ evas_object_focus_set(Evas_Object *obj, Eina_Bool focus)
31 return; 31 return;
32 MAGIC_CHECK_END(); 32 MAGIC_CHECK_END();
33 33
34 _evas_object_event_new();
35
34 if (focus) 36 if (focus)
35 { 37 {
36 if (obj->focused) return; 38 if (obj->focused) return;
diff --git a/legacy/evas/src/lib/canvas/evas_object_inform.c b/legacy/evas/src/lib/canvas/evas_object_inform.c
index 07554297d5..8fbd040e58 100644
--- a/legacy/evas/src/lib/canvas/evas_object_inform.c
+++ b/legacy/evas/src/lib/canvas/evas_object_inform.c
@@ -6,41 +6,55 @@
6void 6void
7evas_object_inform_call_show(Evas_Object *obj) 7evas_object_inform_call_show(Evas_Object *obj)
8{ 8{
9 _evas_object_event_new();
10
9 evas_object_event_callback_call(obj, EVAS_CALLBACK_SHOW, NULL); 11 evas_object_event_callback_call(obj, EVAS_CALLBACK_SHOW, NULL);
10} 12}
11 13
12void 14void
13evas_object_inform_call_hide(Evas_Object *obj) 15evas_object_inform_call_hide(Evas_Object *obj)
14{ 16{
17 _evas_object_event_new();
18
15 evas_object_event_callback_call(obj, EVAS_CALLBACK_HIDE, NULL); 19 evas_object_event_callback_call(obj, EVAS_CALLBACK_HIDE, NULL);
16} 20}
17 21
18void 22void
19evas_object_inform_call_move(Evas_Object *obj) 23evas_object_inform_call_move(Evas_Object *obj)
20{ 24{
25 _evas_object_event_new();
26
21 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOVE, NULL); 27 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOVE, NULL);
22} 28}
23 29
24void 30void
25evas_object_inform_call_resize(Evas_Object *obj) 31evas_object_inform_call_resize(Evas_Object *obj)
26{ 32{
33 _evas_object_event_new();
34
27 evas_object_event_callback_call(obj, EVAS_CALLBACK_RESIZE, NULL); 35 evas_object_event_callback_call(obj, EVAS_CALLBACK_RESIZE, NULL);
28} 36}
29 37
30void 38void
31evas_object_inform_call_restack(Evas_Object *obj) 39evas_object_inform_call_restack(Evas_Object *obj)
32{ 40{
41 _evas_object_event_new();
42
33 evas_object_event_callback_call(obj, EVAS_CALLBACK_RESTACK, NULL); 43 evas_object_event_callback_call(obj, EVAS_CALLBACK_RESTACK, NULL);
34} 44}
35 45
36void 46void
37evas_object_inform_call_changed_size_hints(Evas_Object *obj) 47evas_object_inform_call_changed_size_hints(Evas_Object *obj)
38{ 48{
49 _evas_object_event_new();
50
39 evas_object_event_callback_call(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, NULL); 51 evas_object_event_callback_call(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, NULL);
40} 52}
41 53
42void 54void
43evas_object_inform_call_image_preloaded(Evas_Object *obj) 55evas_object_inform_call_image_preloaded(Evas_Object *obj)
44{ 56{
57 _evas_object_event_new();
58
45 evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_PRELOADED, NULL); 59 evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_PRELOADED, NULL);
46} 60}
diff --git a/legacy/evas/src/lib/canvas/evas_object_main.c b/legacy/evas/src/lib/canvas/evas_object_main.c
index 9a3088cd04..f13017305b 100644
--- a/legacy/evas/src/lib/canvas/evas_object_main.c
+++ b/legacy/evas/src/lib/canvas/evas_object_main.c
@@ -374,6 +374,8 @@ evas_object_del(Evas_Object *obj)
374 374
375 if (obj->delete_me) return; 375 if (obj->delete_me) return;
376 376
377 _evas_object_event_new();
378
377 evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL); 379 evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL);
378 if (obj->name) evas_object_name_set(obj, NULL); 380 if (obj->name) evas_object_name_set(obj, NULL);
379 if (!obj->layer) 381 if (!obj->layer)
@@ -385,6 +387,7 @@ evas_object_del(Evas_Object *obj)
385 { 387 {
386 obj->focused = 0; 388 obj->focused = 0;
387 obj->layer->evas->focused = NULL; 389 obj->layer->evas->focused = NULL;
390 _evas_object_event_new();
388 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL); 391 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
389 } 392 }
390 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; 393 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
@@ -395,6 +398,7 @@ evas_object_del(Evas_Object *obj)
395 if (obj->cur.clipper) evas_object_clip_unset(obj); 398 if (obj->cur.clipper) evas_object_clip_unset(obj);
396 if (obj->smart.smart) evas_object_smart_del(obj); 399 if (obj->smart.smart) evas_object_smart_del(obj);
397 evas_object_map_set(obj, NULL); 400 evas_object_map_set(obj, NULL);
401 _evas_object_event_new();
398 evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL); 402 evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL);
399 evas_object_smart_cleanup(obj); 403 evas_object_smart_cleanup(obj);
400 obj->delete_me = 1; 404 obj->delete_me = 1;
@@ -1139,6 +1143,8 @@ evas_object_hide(Evas_Object *obj)
1139 { 1143 {
1140 Evas_Event_Mouse_Out ev; 1144 Evas_Event_Mouse_Out ev;
1141 1145
1146 _evas_object_event_new();
1147
1142 obj->mouse_in = 0; 1148 obj->mouse_in = 0;
1143 ev.buttons = obj->layer->evas->pointer.button; 1149 ev.buttons = obj->layer->evas->pointer.button;
1144 ev.output.x = obj->layer->evas->pointer.x; 1150 ev.output.x = obj->layer->evas->pointer.x;
diff --git a/legacy/evas/src/lib/include/evas_inline.x b/legacy/evas/src/lib/include/evas_inline.x
index 0f2469d7b1..c08ee9af95 100644
--- a/legacy/evas/src/lib/include/evas_inline.x
+++ b/legacy/evas/src/lib/include/evas_inline.x
@@ -1,6 +1,12 @@
1#ifndef EVAS_INLINE_H 1#ifndef EVAS_INLINE_H
2#define EVAS_INLINE_H 2#define EVAS_INLINE_H
3 3
4static inline void
5_evas_object_event_new(void)
6{
7 _evas_event_counter++;
8}
9
4static inline int 10static inline int
5evas_object_was_visible(Evas_Object *obj) 11evas_object_was_visible(Evas_Object *obj)
6{ 12{
diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h
index 6522a91b90..426906573b 100644
--- a/legacy/evas/src/lib/include/evas_private.h
+++ b/legacy/evas/src/lib/include/evas_private.h
@@ -461,6 +461,8 @@ struct _Evas_Object
461 int last_mouse_up_counter; 461 int last_mouse_up_counter;
462 int mouse_grabbed; 462 int mouse_grabbed;
463 463
464 int last_event;
465
464 Evas_Object_Pointer_Mode pointer_mode : 1; 466 Evas_Object_Pointer_Mode pointer_mode : 1;
465 467
466 Eina_Bool store : 1; 468 Eina_Bool store : 1;
@@ -827,6 +829,7 @@ void _evas_object_text_rehint(Evas_Object *obj);
827void _evas_object_textblock_rehint(Evas_Object *obj); 829void _evas_object_textblock_rehint(Evas_Object *obj);
828 830
829extern int _evas_alloc_error; 831extern int _evas_alloc_error;
832extern int _evas_event_counter;
830 833
831struct _Evas_Imaging_Image 834struct _Evas_Imaging_Image
832{ 835{