VirtualBox

Changeset 38271 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 1, 2011 9:01:03 PM (13 years ago)
Author:
vboxsync
Message:

Main/MouseImpl: correct absolute axis scaling to return the centre of the cursor hotspot pixel to the guest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/MouseImpl.cpp

    r38242 r38271  
    4848    MOUSE_RANGE_LOWER = 0,
    4949    /** Higher end */
    50     MOUSE_RANGE_UPPER = 0xFFFF
     50    MOUSE_RANGE_UPPER = 0xFFFF,
     51    /** Full range */
     52    MOUSE_RANGE = MOUSE_RANGE_UPPER - MOUSE_RANGE_LOWER
    5153};
    5254/** @} */
     
    501503            return rc;
    502504
    503         *pcX = displayWidth ? ((x - 1) * MOUSE_RANGE_UPPER) / (LONG) displayWidth: 0;
    504         *pcY = displayHeight ? ((y - 1) * MOUSE_RANGE_UPPER) / (LONG) displayHeight: 0;
     505        *pcX = displayWidth ? (x * MOUSE_RANGE - MOUSE_RANGE / 2) / (LONG) displayWidth: 0;
     506        *pcY = displayHeight ? (y * MOUSE_RANGE - MOUSE_RANGE / 2) / (LONG) displayHeight: 0;
    505507    }
    506508    else
     
    509511        /* Takes the display lock */
    510512        pDisplay->getFramebufferDimensions(&x1, &y1, &x2, &y2);
    511         *pcX = x1 < x2 ? (x - 1 - x1) * MOUSE_RANGE_UPPER / (x2 - x1 - 1) : 0;
    512         *pcY = y1 < y2 ? (y - 1 - y1) * MOUSE_RANGE_UPPER / (y2 - y1 - 1) : 0;
     513        *pcX = x1 < x2 ? ((x - x1) * MOUSE_RANGE - MOUSE_RANGE / 2) / (x2 - x1) : 0;
     514        *pcY = y1 < y2 ? ((y - y1) * MOUSE_RANGE - MOUSE_RANGE / 2) / (y2 - y1) : 0;
    513515        if (   *pcX < MOUSE_RANGE_LOWER || *pcX > MOUSE_RANGE_UPPER
    514516            || *pcY < MOUSE_RANGE_LOWER || *pcY > MOUSE_RANGE_UPPER)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette