VirtualBox

Changeset 40626 in vbox


Ignore:
Timestamp:
Mar 26, 2012 9:01:06 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77045
Message:

ConsoleVRDPServer: use the new mouse pointers inteface for VRDE.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleVRDPServer.h

    r37282 r40626  
    2525
    2626#include <VBox/RemoteDesktop/VRDEImage.h>
     27#include <VBox/RemoteDesktop/VRDEMousePtr.h>
    2728
    2829#include <VBox/HostServices/VBoxClipboardExt.h>
     
    8586    void EnableConnections (void);
    8687    void DisconnectClient (uint32_t u32ClientId, bool fReconnect);
     88    int MousePointer(BOOL alpha, ULONG xHot, ULONG yHot, ULONG width, ULONG height, const uint8_t *pu8Shape);
    8789    void MousePointerUpdate (const VRDECOLORPOINTER *pPointer);
    8890    void MousePointerHide (void);
     
    259261                                                void *pvData,
    260262                                                uint32_t cbData);
     263    /* Mouse pointer interface. */
     264    VRDEMOUSEPTRINTERFACE m_interfaceMousePtr;
    261265};
    262266
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r39493 r40626  
    371371        else if (width != 0 && height != 0)
    372372        {
     373            uint8_t* shape = aShape.raw();
     374
     375            dumpPointer(shape, width, height, true);
     376
     377            if (m_server->MousePointer(alpha, xHot, yHot, width, height, shape) == VINF_SUCCESS)
     378            {
     379                return S_OK;
     380            }
     381
    373382            /* Pointer consists of 1 bpp AND and 24 BPP XOR masks.
    374383             * 'shape' AND mask followed by XOR mask.
     
    387396             * because most pointers are 32x32.
    388397             */
    389             uint8_t* shape = aShape.raw();
    390 
    391             dumpPointer(shape, width, height, true);
    392398
    393399            int cbDstAndMask = (((width + 7) / 8) * height + 3) & ~3;
     
    13651371    memset(&m_interfaceImage, 0, sizeof (m_interfaceImage));
    13661372    memset(&m_interfaceCallbacksImage, 0, sizeof (m_interfaceCallbacksImage));
     1373    RT_ZERO(m_interfaceMousePtr);
    13671374}
    13681375
     
    15721579                    if (RT_SUCCESS(vrc))
    15731580                    {
     1581                        LogRel(("VRDE: [%s]\n", VRDE_IMAGE_INTERFACE_NAME));
    15741582                        m_fInterfaceImage = true;
     1583                    }
     1584
     1585                    /* Mouse pointer interface. */
     1586                    m_interfaceMousePtr.header.u64Version = 1;
     1587                    m_interfaceMousePtr.header.u64Size = sizeof(m_interfaceMousePtr);
     1588
     1589                    vrc = mpEntryPoints->VRDEGetInterface(mhServer,
     1590                                                          VRDE_MOUSEPTR_INTERFACE_NAME,
     1591                                                          &m_interfaceMousePtr.header,
     1592                                                          NULL,
     1593                                                          this);
     1594                    if (RT_SUCCESS(vrc))
     1595                    {
     1596                        LogRel(("VRDE: [%s]\n", VRDE_MOUSEPTR_INTERFACE_NAME));
     1597                    }
     1598                    else
     1599                    {
     1600                        RT_ZERO(m_interfaceMousePtr);
    15751601                    }
    15761602
     
    19641990        mpEntryPoints->VRDEDisconnect(mhServer, u32ClientId, fReconnect);
    19651991    }
     1992}
     1993
     1994int ConsoleVRDPServer::MousePointer(BOOL alpha,
     1995                                    ULONG xHot,
     1996                                    ULONG yHot,
     1997                                    ULONG width,
     1998                                    ULONG height,
     1999                                    const uint8_t *pu8Shape)
     2000{
     2001    int rc = VINF_SUCCESS;
     2002
     2003    if (mhServer && mpEntryPoints && m_interfaceMousePtr.VRDEMousePtr)
     2004    {
     2005        size_t cbMask = (((width + 7) / 8) * height + 3) & ~3;
     2006        size_t cbData = width * height * 4;
     2007
     2008        size_t cbDstMask = alpha? 0: cbMask;
     2009
     2010        size_t cbPointer = sizeof(VRDEMOUSEPTRDATA) + cbDstMask + cbData;
     2011        uint8_t *pu8Pointer = (uint8_t *)RTMemAlloc(cbPointer);
     2012        if (pu8Pointer != NULL)
     2013        {
     2014            VRDEMOUSEPTRDATA *pPointer = (VRDEMOUSEPTRDATA *)pu8Pointer;
     2015
     2016            pPointer->u16HotX    = (uint16_t)xHot;
     2017            pPointer->u16HotY    = (uint16_t)yHot;
     2018            pPointer->u16Width   = (uint16_t)width;
     2019            pPointer->u16Height  = (uint16_t)height;
     2020            pPointer->u16MaskLen = (uint16_t)cbDstMask;
     2021            pPointer->u32DataLen = (uint32_t)cbData;
     2022
     2023            /* AND mask. */
     2024            uint8_t *pu8Mask = pu8Pointer + sizeof(VRDEMOUSEPTRDATA);
     2025            if (cbDstMask)
     2026            {
     2027                memcpy(pu8Mask, pu8Shape, cbDstMask);
     2028            }
     2029
     2030            /* XOR mask */
     2031            uint8_t *pu8Data = pu8Mask + pPointer->u16MaskLen;
     2032            memcpy(pu8Data, pu8Shape + cbMask, cbData);
     2033
     2034            m_interfaceMousePtr.VRDEMousePtr(mhServer, pPointer);
     2035
     2036            RTMemFree(pu8Pointer);
     2037        }
     2038        else
     2039        {
     2040            rc = VERR_NO_MEMORY;
     2041        }
     2042    }
     2043    else
     2044    {
     2045        rc = VERR_NOT_SUPPORTED;
     2046    }
     2047
     2048    return rc;
    19662049}
    19672050
Note: See TracChangeset for help on using the changeset viewer.

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