rem: x = (x < -width) ? 0 : x; x = (x > scr->scr_width) ? scr->scr_width - width : x; y = (y < 0) ? 0 : y; y = (y > scr->scr_height) ? scr->scr_height - height : y;
add: if (x < rect.pos.x - width) x = rect.pos.x; if (x > rect.pos.x + rect.size.width) x = rect.pos.x + rect.size.width - width; if (y < rect.pos.y) y = rect.pos.y; if (y > rect.pos.y + rect.size.height) y = rect.pos.y + rect.size.height - height;
context: restoreMenu(WScreen *scr, WMPropList *menu, int which){    int x, y;    Bool lowered = False;    WMenu *pmenu = NULL;    if (!menu)        return False;    if (!getMenuInfo(menu, &x, &y, &lowered))        return False;#ifndef LITE    if (which & WSS_SWITCHMENU) {        OpenSwitchMenu(scr, x, y, False);        pmenu = scr->switch_menu;    }#endif /* !LITE */    if (pmenu) {        int width = MENUW(pmenu);        int height = MENUH(pmenu);        if (lowered) {            changeMenuLevels(pmenu, True);        }        x = (x < -width) ? 0 : x;        x = (x > scr->scr_width) ? scr->scr_width - width : x;        y = (y < 0) ? 0 : y;        y = (y > scr->scr_height) ? scr->scr_height - height : y;        wMenuMove(pmenu, x, y, True);        pmenu->flags.buttoned = 1;        wFrameWindowShowButton(pmenu->frame, WFF_RIGHT_BUTTON);        return True;    }    return False;}