forked from enlightenment/efl
* 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
This commit is contained in:
parent
ae586e291e
commit
d790cbfd00
|
@ -2,6 +2,7 @@
|
|||
#include "evas_private.h"
|
||||
|
||||
static void evas_object_event_callback_clear(Evas_Object *obj);
|
||||
int _evas_event_counter = 0;
|
||||
|
||||
void
|
||||
evas_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
|
|||
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
|
||||
Evas *e;
|
||||
|
||||
if (obj->last_event == _evas_event_counter) return ;
|
||||
obj->last_event = _evas_event_counter;
|
||||
|
||||
if (obj->delete_me) return;
|
||||
e = evas_object_evas_get(obj);
|
||||
|
||||
|
|
|
@ -295,6 +295,8 @@ evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int
|
|||
if (e->events_frozen > 0) return;
|
||||
e->last_timestamp = timestamp;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.button = b;
|
||||
ev.output.x = e->pointer.x;
|
||||
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
|
|||
Evas_Event_Mouse_Up ev;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.button = b;
|
||||
ev.output.x = e->pointer.x;
|
||||
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
|
|||
Evas_Event_Mouse_Out ev;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.output.x = e->pointer.x;
|
||||
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
|
|||
Evas_Event_Mouse_In ev;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.output.x = e->pointer.x;
|
||||
ev.output.y = e->pointer.y;
|
||||
|
@ -558,6 +566,8 @@ evas_event_feed_mouse_wheel(Evas *e, int direction, int z, unsigned int timestam
|
|||
if (e->events_frozen > 0) return;
|
||||
e->last_timestamp = timestamp;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.direction = direction;
|
||||
ev.z = z;
|
||||
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
|
|||
Evas_Event_Mouse_Move ev;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.cur.output.x = e->pointer.x;
|
||||
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
|
|||
{
|
||||
Evas_Event_Mouse_Out ev;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.output.x = e->pointer.x;
|
||||
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
|
|||
Evas_Event_Mouse_In ev3;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.cur.output.x = e->pointer.x;
|
||||
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
|
|||
}
|
||||
if (e->delete_me) break;
|
||||
}
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
if (copy) copy = eina_list_free(copy);
|
||||
/* go thru our current list of ins */
|
||||
EINA_LIST_FOREACH(ins, l, obj)
|
||||
|
@ -849,6 +868,8 @@ evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data)
|
|||
|
||||
if (e->pointer.mouse_grabbed != 0) return;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.output.x = e->pointer.x;
|
||||
ev.output.y = e->pointer.y;
|
||||
|
@ -910,6 +931,8 @@ evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data)
|
|||
if (e->events_frozen > 0) return;
|
||||
e->last_timestamp = timestamp;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.buttons = e->pointer.button;
|
||||
ev.output.x = e->pointer.x;
|
||||
ev.output.y = e->pointer.y;
|
||||
|
@ -968,6 +991,8 @@ evas_event_feed_multi_down(Evas *e,
|
|||
if (e->events_frozen > 0) return;
|
||||
e->last_timestamp = timestamp;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.device = d;
|
||||
ev.output.x = x;
|
||||
ev.output.y = y;
|
||||
|
@ -1028,6 +1053,8 @@ evas_event_feed_multi_up(Evas *e,
|
|||
if (e->events_frozen > 0) return;
|
||||
e->last_timestamp = timestamp;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.device = d;
|
||||
ev.output.x = x;
|
||||
ev.output.y = y;
|
||||
|
@ -1095,6 +1122,8 @@ evas_event_feed_multi_move(Evas *e,
|
|||
Evas_Event_Multi_Move ev;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.device = d;
|
||||
ev.cur.output.x = x;
|
||||
ev.cur.output.y = y;
|
||||
|
@ -1143,6 +1172,8 @@ evas_event_feed_multi_move(Evas *e,
|
|||
Evas_Event_Multi_Move ev;
|
||||
Evas_Object *obj;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.device = d;
|
||||
ev.cur.output.x = x;
|
||||
ev.cur.output.y = y;
|
||||
|
@ -1233,6 +1264,8 @@ evas_event_feed_key_down(Evas *e, const char *keyname, const char *key, const ch
|
|||
Evas_Event_Key_Down ev;
|
||||
int exclusive;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
exclusive = 0;
|
||||
ev.keyname = (char *)keyname;
|
||||
ev.data = (void *)data;
|
||||
|
@ -1325,6 +1358,8 @@ evas_event_feed_key_up(Evas *e, const char *keyname, const char *key, const char
|
|||
Evas_Event_Key_Up ev;
|
||||
int exclusive;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
exclusive = 0;
|
||||
ev.keyname = (char *)keyname;
|
||||
ev.data = (void *)data;
|
||||
|
@ -1412,6 +1447,8 @@ evas_event_feed_hold(Evas *e, int hold, unsigned int timestamp, const void *data
|
|||
if (e->events_frozen > 0) return;
|
||||
e->last_timestamp = timestamp;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
ev.hold = hold;
|
||||
ev.data = (void *)data;
|
||||
ev.timestamp = timestamp;
|
||||
|
|
|
@ -31,6 +31,8 @@ evas_object_focus_set(Evas_Object *obj, Eina_Bool focus)
|
|||
return;
|
||||
MAGIC_CHECK_END();
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
if (focus)
|
||||
{
|
||||
if (obj->focused) return;
|
||||
|
|
|
@ -6,41 +6,55 @@
|
|||
void
|
||||
evas_object_inform_call_show(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_SHOW, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
evas_object_inform_call_hide(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_HIDE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
evas_object_inform_call_move(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_MOVE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
evas_object_inform_call_resize(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_RESIZE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
evas_object_inform_call_restack(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_RESTACK, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
evas_object_inform_call_changed_size_hints(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
evas_object_inform_call_image_preloaded(Evas_Object *obj)
|
||||
{
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_IMAGE_PRELOADED, NULL);
|
||||
}
|
||||
|
|
|
@ -374,6 +374,8 @@ evas_object_del(Evas_Object *obj)
|
|||
|
||||
if (obj->delete_me) return;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL);
|
||||
if (obj->name) evas_object_name_set(obj, NULL);
|
||||
if (!obj->layer)
|
||||
|
@ -385,6 +387,7 @@ evas_object_del(Evas_Object *obj)
|
|||
{
|
||||
obj->focused = 0;
|
||||
obj->layer->evas->focused = NULL;
|
||||
_evas_object_event_new();
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
|
||||
}
|
||||
obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
|
||||
|
@ -395,6 +398,7 @@ evas_object_del(Evas_Object *obj)
|
|||
if (obj->cur.clipper) evas_object_clip_unset(obj);
|
||||
if (obj->smart.smart) evas_object_smart_del(obj);
|
||||
evas_object_map_set(obj, NULL);
|
||||
_evas_object_event_new();
|
||||
evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL);
|
||||
evas_object_smart_cleanup(obj);
|
||||
obj->delete_me = 1;
|
||||
|
@ -1139,6 +1143,8 @@ evas_object_hide(Evas_Object *obj)
|
|||
{
|
||||
Evas_Event_Mouse_Out ev;
|
||||
|
||||
_evas_object_event_new();
|
||||
|
||||
obj->mouse_in = 0;
|
||||
ev.buttons = obj->layer->evas->pointer.button;
|
||||
ev.output.x = obj->layer->evas->pointer.x;
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#ifndef EVAS_INLINE_H
|
||||
#define EVAS_INLINE_H
|
||||
|
||||
static inline void
|
||||
_evas_object_event_new(void)
|
||||
{
|
||||
_evas_event_counter++;
|
||||
}
|
||||
|
||||
static inline int
|
||||
evas_object_was_visible(Evas_Object *obj)
|
||||
{
|
||||
|
|
|
@ -461,6 +461,8 @@ struct _Evas_Object
|
|||
int last_mouse_up_counter;
|
||||
int mouse_grabbed;
|
||||
|
||||
int last_event;
|
||||
|
||||
Evas_Object_Pointer_Mode pointer_mode : 1;
|
||||
|
||||
Eina_Bool store : 1;
|
||||
|
@ -827,6 +829,7 @@ void _evas_object_text_rehint(Evas_Object *obj);
|
|||
void _evas_object_textblock_rehint(Evas_Object *obj);
|
||||
|
||||
extern int _evas_alloc_error;
|
||||
extern int _evas_event_counter;
|
||||
|
||||
struct _Evas_Imaging_Image
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue