rem: int screenW = scr->scr_width; int screenH = scr->scr_height;
context: getScrollAmount(WMenu *menu, int *hamount, int *vamount){    WScreen *scr = menu->menu->screen_ptr;    int menuX1 = menu->frame_x;    int menuY1 = menu->frame_y;    int menuX2 = menu->frame_x + MENUW(menu);    int menuY2 = menu->frame_y + MENUH(menu);    int screenW = scr->scr_width;    int screenH = scr->scr_height;    int xroot, yroot;    *hamount = 0;    *vamount = 0;    getPointerPosition(scr, &xroot, &yroot);    if (xroot <= 1 && menuX1 < 0) {        /* scroll to the right */        *hamount = WMIN(MENU_SCROLL_STEP, abs(menuX1));    } else if (xroot >= screenW-2 && menuX2 > screenW-1) {        /* scroll to the left */        *hamount = WMIN(MENU_SCROLL_STEP, abs(menuX2-screenW-1));        if (*hamount==0)            *hamount = 1;        *hamount = -*hamount;    }    if (yroot <= 1 && menuY1 < 0) {        /* scroll down */        *vamount = WMIN(MENU_SCROLL_STEP, abs(menuY1));    } else if (yroot >= screenH-2 && menuY2 > screenH-1) {        /* scroll up */        *vamount = WMIN(MENU_SCROLL_STEP, abs(menuY2-screenH-2));        *vamount = -*vamount;    }}