VirtualBox

Changeset 34754 in vbox for trunk


Ignore:
Timestamp:
Dec 6, 2010 2:40:03 PM (14 years ago)
Author:
vboxsync
Message:

Main/VMMDev: optionally report multi-monitor mouse co-ordinates relative to the whole virtual framebuffer and not to the first screen

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VMMDev.h

    r34438 r34754  
    266266#define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER                  RT_BIT(3)
    267267/** The guest can read VMMDev events to find out about pointer movement */
    268 #define VMMDEV_MOUSE_GUEST_USES_EVENT                       RT_BIT(4)
     268#define VMMDEV_MOUSE_NEW_PROTOCOL                           RT_BIT(4)
    269269/** If the guest changes the status of the
    270270 * VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR bit, the host will honour this */
     
    281281/** The mask of all capabilities which the guest can legitimately change */
    282282#define VMMDEV_MOUSE_GUEST_MASK \
    283       (VMMDEV_MOUSE_NOTIFY_HOST_MASK | VMMDEV_MOUSE_GUEST_USES_EVENT)
     283      (VMMDEV_MOUSE_NOTIFY_HOST_MASK | VMMDEV_MOUSE_NEW_PROTOCOL)
    284284/** The mask of host capability changes for which notification events should
    285285 * be sent */
  • trunk/src/VBox/Additions/x11/vboxmouse/vboxmouse_15.c

    r32831 r34754  
    177177            rc = VbglR3SetMouseStatus(  fFeatures
    178178                                      | VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
    179                                       | VMMDEV_MOUSE_GUEST_USES_EVENT);
     179                                      | VMMDEV_MOUSE_NEW_PROTOCOL);
    180180        if (!RT_SUCCESS(rc)) {
    181181            xf86Msg(X_ERROR, "%s: Failed to switch guest mouse into absolute mode\n",
     
    194194            rc = VbglR3SetMouseStatus(  fFeatures
    195195                                      & ~VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE
    196                                       & ~VMMDEV_MOUSE_GUEST_USES_EVENT);
     196                                      & ~VMMDEV_MOUSE_NEW_PROTOCOL);
    197197        xf86RemoveEnabledDevice(pInfo);
    198198        device->public.on = FALSE;
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.cpp

    r33540 r34754  
    210210        *aBitsPerPixel = getBitsPerPixel();
    211211    return S_OK;
     212}
     213
     214void Display::getFramebufferDimensions(int32_t *px1, int32_t *py1,
     215                                       int32_t *px2, int32_t *py2)
     216{
     217    AssertPtrReturnVoid(px1);
     218    AssertPtrReturnVoid(py1);
     219    AssertPtrReturnVoid(px2);
     220    AssertPtrReturnVoid(py2);
     221    *px1 = 0;
     222    *py1 = 0;
     223    *px2 = getWidth();
     224    *py2 = getHeight();
    212225}
    213226
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.h

    r28800 r34754  
    5555    STDMETHODIMP ResizeCompleted();
    5656    STDMETHODIMP GetScreenResolution(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
     57    void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2,
     58                                  int32_t *py2);
    5759
    5860    void resetFramebuffer();
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r34739 r34754  
    930930            mParent->consoleVRDPServer()->SendUpdateBitmap(uScreenId, x, y, w, h);
    931931    }
     932}
     933
     934void Display::getFramebufferDimensions(int32_t *px1, int32_t *py1,
     935                                       int32_t *px2, int32_t *py2)
     936{
     937    AssertPtrReturnVoid(px1);
     938    AssertPtrReturnVoid(py1);
     939    AssertPtrReturnVoid(px2);
     940    AssertPtrReturnVoid(py2);
     941    int32_t x1 = 0, y1 = 0, x2 = 0, y2 = 0;
     942    for (unsigned i = 0; i < mcMonitors; ++i)
     943    {
     944        x1 = RT_MIN(x1, maFramebuffers[i].xOrigin);
     945        y1 = RT_MIN(y1, maFramebuffers[i].yOrigin);
     946        x2 = RT_MAX(x2, maFramebuffers[i].xOrigin + (int32_t)maFramebuffers[i].w);
     947        y2 = RT_MAX(y2, maFramebuffers[i].yOrigin + (int32_t)maFramebuffers[i].h);
     948    }
     949    *px1 = x1;
     950    *py1 = y1;
     951    *px2 = x2;
     952    *py2 = y2;
    932953}
    933954
  • trunk/src/VBox/Main/MouseImpl.cpp

    r34395 r34754  
    453453    ComAssertRet(pDisplay, E_FAIL);
    454454
    455     ULONG displayWidth, displayHeight;
    456     /* Takes the display lock */
    457     HRESULT rc = pDisplay->GetScreenResolution (0, &displayWidth, &displayHeight,
    458                                                 NULL);
    459     if (FAILED(rc))
    460         return rc;
    461 
    462     *pcX = displayWidth ? ((x - 1) * 0xFFFF) / displayWidth: 0;
    463     *pcY = displayHeight ? ((y - 1) * 0xFFFF) / displayHeight: 0;
     455    if (!(mfVMMDevGuestCaps & VMMDEV_MOUSE_NEW_PROTOCOL))
     456    {
     457        ULONG displayWidth, displayHeight;
     458        /* Takes the display lock */
     459        HRESULT rc = pDisplay->GetScreenResolution(0, &displayWidth, &displayHeight,
     460                                                   NULL);
     461        if (FAILED(rc))
     462            return rc;
     463
     464        *pcX = displayWidth ? ((x - 1) * 0xFFFF) / displayWidth: 0;
     465        *pcY = displayHeight ? ((y - 1) * 0xFFFF) / displayHeight: 0;
     466    }
     467    else
     468    {
     469        int32_t x1, y1, x2, y2;
     470        pDisplay->getFramebufferDimensions(&x1, &y1, &x2, &y2);
     471        *pcX = x1 != x2 ? (x - 1 - x1) * 0xFFFF / (x2 - x1) : 0;
     472        *pcY = y1 != y2 ? (y - 1 - y1) * 0xFFFF / (y2 - y1) : 0;
     473    }
    464474    return S_OK;
    465475}
     
    512522    rc = reportAbsEvent(mouseXAbs, mouseYAbs, dz, dw, fButtons,
    513523                        RT_BOOL(  mfVMMDevGuestCaps
    514                                 & VMMDEV_MOUSE_GUEST_USES_EVENT));
     524                                & VMMDEV_MOUSE_NEW_PROTOCOL));
    515525
    516526#ifndef VBOXBFE_WITHOUT_COM
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r34739 r34754  
    139139        return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
    140140    }
     141    void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2,
     142                                  int32_t *py2);
    141143#ifdef MMSEAMLESS
    142144    int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
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