Listing 2. Modifications to the NVPointerMoved Subroutine

void
NVPointerMoved(int index, int x, int y)
{
    ScrnInfoPtr pScrn = xf86Screens[index];
    NVPtr pNv = NVPTR(pScrn);
    int newX, newY;
    /*  new section   */
    if(pNv->Flip == 1) {
       newX = pScrn->pScreen-width - x - 1;
       newY = y;
    }
    else {
   /*
    * old section
    *   this section just does the x-y transform
    *   needed for rotating the Xserver
    */
        if(pNv->Rotate == 1) {
            newX = pScrn->pScreen->height - y - 1;
            newY = x;
        }
        else {
             newX = y;
             newY = pScrn->pScreen->width - x - 1;
        }
    }
    (*pNv->PointerMoved)(index, newX, newY);
}