Hi,
when you register an event handler for ECORE_X_MOUSE_IN/OUT for a
specific window, your callbacks will also be called if a
EnterNotify/LeaveNotify event occured in a subwindow/child of the window
you registered a callback on.
That's the reason why ecore_evas' mouse_in/out callbacks are *always*
called twice (ecore_evas creates 2 windows, dunno why though).
Can't be just ignore subwindow events in EnterNotify and LeaveNotify
handlers?
When the caller wants to know about events on a subwindow, he should
register the callback accordingly, IMHO :]
If you object to this patch, what's a better way to stop ecore_evas from
calling the mouse_in/out callbacks twice? :)
--
Regards,
Tilman
Index: ecore_x_events.c
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_events.c,v
retrieving revision 1.30
diff -u -r1.30 ecore_x_events.c
--- ecore_x_events.c 9 May 2004 08:15:34 -0000 1.30
+++ ecore_x_events.c 11 Jul 2004 13:48:59 -0000
@@ -454,7 +454,10 @@
}
{
Ecore_X_Event_Mouse_In *e;
-
+
+ /* don't report mouse in's on subwindows */
+ if (xevent->xcrossing.subwindow) return;
+
e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
if (!e) return;
e->modifiers = xevent->xcrossing.state;
@@ -462,8 +465,7 @@
e->y = xevent->xcrossing.y;
e->root.x = xevent->xcrossing.x_root;
e->root.y = xevent->xcrossing.y_root;
- if (xevent->xcrossing.subwindow) e->win = xevent->xcrossing.subwindow;
- else e->win = xevent->xcrossing.window;
+ e->win = xevent->xcrossing.window;
e->event_win = xevent->xcrossing.window;
if (xevent->xcrossing.mode == NotifyNormal) e->mode =
ECORE_X_EVENT_MODE_NORMAL;
else if (xevent->xcrossing.mode == NotifyGrab) e->mode =
ECORE_X_EVENT_MODE_GRAB;
@@ -504,7 +506,10 @@
}
{
Ecore_X_Event_Mouse_Out *e;
-
+
+ /* don't report mouse out's on subwindows */
+ if (xevent->xcrossing.subwindow) return;
+
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
if (!e) return;
e->modifiers = xevent->xcrossing.state;
@@ -512,8 +517,7 @@
e->y = xevent->xcrossing.y;
e->root.x = xevent->xcrossing.x_root;
e->root.y = xevent->xcrossing.y_root;
- if (xevent->xcrossing.subwindow) e->win = xevent->xcrossing.subwindow;
- else e->win = xevent->xcrossing.window;
+ e->win = xevent->xcrossing.window;
e->event_win = xevent->xcrossing.window;
if (xevent->xcrossing.mode == NotifyNormal) e->mode =
ECORE_X_EVENT_MODE_NORMAL;
else if (xevent->xcrossing.mode == NotifyGrab) e->mode =
ECORE_X_EVENT_MODE_GRAB;