diff --git a/WINGs/wevent.c b/WINGs/wevent.c index e71b811..e6d886d 100644 --- a/WINGs/wevent.c +++ b/WINGs/wevent.c @@ -214,6 +214,24 @@ int WMHandleEvent(WMEvent * event) } else { extern W_View *W_GetViewForWindow(Window id); view = W_GetViewForWindow((Window)window); + /* Route pointer events to the deepest child at click point */ + if (view && (mask & (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask))) { + int ex = event->u.button.x; + int ey = event->u.button.y; + W_View *child = view->childrenList; + while (child) { + if (child->flags.mapped && + ex >= child->pos.x && ex < child->pos.x + child->size.width && + ey >= child->pos.y && ey < child->pos.y + child->size.height) { + ex -= child->pos.x; + ey -= child->pos.y; + view = child; + child = view->childrenList; + } else { + child = child->nextSister; + } + } + } } if (!view) {