rem: rect = wGetRectForHead(scr, wGetHeadForPoint(scr, (WMPoint){ x, y }));
add: rect = wGetRectForHead(scr, wGetHeadForPoint(scr, wmkpoint(x, y)));
context: wMenuScroll(WMenu *menu, XEvent *event){    WMenu *smenu;    WMenu *omenu = parentMenu(menu);    WScreen *scr = menu->frame->screen_ptr;    int done = 0;    int jump_back = 0;    int old_frame_x = omenu->frame_x;    int old_frame_y = omenu->frame_y;    XEvent ev;    if (omenu->jump_back)        WMDeleteTimerWithClientData(omenu->jump_back);    if ((/*omenu->flags.buttoned &&*/ !wPreferences.wrap_menus)        || omenu->flags.app_menu) {        jump_back = 1;    }    if (!wPreferences.wrap_menus)        raiseMenus(omenu, True);    else        raiseMenus(menu, False);    if (!menu->timer)        scrollMenuCallback(menu);    while(!done) {        int x, y, on_border, on_x_edge, on_y_edge, on_title;        WMRect rect;        WMNextEvent(dpy, &ev);        switch (ev.type) {        case EnterNotify:            WMHandleEvent(&ev);        case MotionNotify:            x = (ev.type==MotionNotify) ? ev.xmotion.x_root : ev.xcrossing.x_root;            y = (ev.type==MotionNotify) ? ev.xmotion.y_root : ev.xcrossing.y_root;            /* on_border is != 0 if the pointer is between the menu             * and the screen border and is close enough to the border */            on_border = isPointNearBoder(menu, x, y);            smenu = wMenuUnderPointer(scr);            if ((smenu==NULL && !on_border) || (smenu && parentMenu(smenu)!=omenu)) {                done = 1;                break;            }            rect = wGetRectForHead(scr, wGetHeadForPoint(scr, (WMPoint){ x, y }));            on_x_edge = x <= rect.pos.x + 1 || x >= rect.pos.x + rect.size.width - 2;            on_y_edge = y <= rect.pos.y + 1 || y >= rect.pos.y + rect.size.height - 2;            on_border = on_x_edge || on_y_edge;            if (!on_border && !jump_back) {                done = 1;                break;            }            if (menu->timer && (smenu!=menu || (!on_y_edge && !on_x_edge))) {                WMDeleteTimerHandler(menu->timer);                menu->timer = NULL;            }            if (smenu != NULL)                menu = smenu;            if (!menu->timer)                scrollMenuCallback(menu);            break;        case ButtonPress:            /* True if we push on title, or drag the omenu to other position */            on_title = ev.xbutton.x_root >= omenu->frame_x &&                ev.xbutton.x_root <= omenu->frame_x + MENUW(omenu) &&                ev.xbutton.y_root >= omenu->frame_y &&                ev.xbutton.y_root <= omenu->frame_y + omenu->frame->top_width;            WMHandleEvent(&ev);            smenu = wMenuUnderPointer(scr);            if (smenu == NULL || (smenu && smenu->flags.buttoned && smenu != omenu))                done = 1;            else if (smenu==omenu && on_title) {                jump_back = 0;                done = 1;            }            break;        case KeyPress:            done = 1;        default:            WMHandleEvent(&ev);            break;        }    }    if (menu->timer) {        WMDeleteTimerHandler(menu->timer);        menu->timer = NULL;    }    if (jump_back) {        _delay *delayer;        if (!omenu->jump_back) {            delayer=wmalloc(sizeof(_delay));            delayer->menu=omenu;            delayer->ox=old_frame_x;            delayer->oy=old_frame_y;            omenu->jump_back=delayer;            scr->flags.jump_back_pending = 1;        }        else delayer = omenu->jump_back;        WMAddTimerHandler(MENU_JUMP_BACK_DELAY,(WMCallback*)_leaving, delayer);    }}