VirtualBox

Changeset 47464 in vbox


Ignore:
Timestamp:
Jul 29, 2013 2:54:33 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
87625
Message:

Main: use VRDE input interface.

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

Legend:

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

    r47158 r47464  
    3030#define VRDE_VIDEOIN_WITH_VRDEINTERFACE /* Get the VRDE interface definitions. */
    3131#include <VBox/RemoteDesktop/VRDEVideoIn.h>
     32#include <VBox/RemoteDesktop/VRDEInput.h>
    3233
    3334#include <VBox/HostServices/VBoxClipboardExt.h>
     
    342343                                                       const VRDEVIDEOINPAYLOADHDR *pFrame,
    343344                                                       uint32_t cbFrame);
     345
     346    /* Input interface. */
     347    VRDEINPUTINTERFACE m_interfaceInput;
     348    VRDEINPUTCALLBACKS m_interfaceCallbacksInput;
     349    static DECLCALLBACK(void) VRDECallbackInputSetup(void *pvCallback,
     350                                                     int rcRequest,
     351                                                     uint32_t u32Method,
     352                                                     const void *pvResult,
     353                                                     uint32_t cbResult);
     354    static DECLCALLBACK(void) VRDECallbackInputEvent(void *pvCallback,
     355                                                     uint32_t u32Method,
     356                                                     const void *pvEvent,
     357                                                     uint32_t cbEvent);
    344358};
    345359
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r47251 r47464  
    14041404    RT_ZERO(m_interfaceVideoIn);
    14051405    RT_ZERO(m_interfaceCallbacksVideoIn);
     1406    RT_ZERO(m_interfaceInput);
     1407    RT_ZERO(m_interfaceCallbacksInput);
    14061408
    14071409    rc = RTCritSectInit(&mTSMFLock);
     
    17121714                    }
    17131715
     1716                    /* Input interface. */
     1717                    m_interfaceInput.header.u64Version = 1;
     1718                    m_interfaceInput.header.u64Size = sizeof(m_interfaceInput);
     1719
     1720                    m_interfaceCallbacksInput.header.u64Version = 1;
     1721                    m_interfaceCallbacksInput.header.u64Size = sizeof(m_interfaceCallbacksInput);
     1722                    m_interfaceCallbacksInput.VRDECallbackInputSetup = VRDECallbackInputSetup;
     1723                    m_interfaceCallbacksInput.VRDECallbackInputEvent = VRDECallbackInputEvent;
     1724
     1725                    vrc = mpEntryPoints->VRDEGetInterface(mhServer,
     1726                                                          VRDE_INPUT_INTERFACE_NAME,
     1727                                                          &m_interfaceInput.header,
     1728                                                          &m_interfaceCallbacksInput.header,
     1729                                                          this);
     1730                    if (RT_SUCCESS(vrc))
     1731                    {
     1732                        LogRel(("VRDE: [%s]\n", VRDE_INPUT_INTERFACE_NAME));
     1733                    }
     1734                    else
     1735                    {
     1736                        RT_ZERO(m_interfaceInput);
     1737                    }
     1738
    17141739                    /* Since these interfaces are optional, it is always a success here. */
    17151740                    vrc = VINF_SUCCESS;
     
    27602785    return rc;
    27612786}
     2787
     2788
     2789/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackInputSetup(void *pvCallback,
     2790                                                                          int rcRequest,
     2791                                                                          uint32_t u32Method,
     2792                                                                          const void *pvResult,
     2793                                                                          uint32_t cbResult)
     2794{
     2795    NOREF(pvCallback);
     2796    NOREF(rcRequest);
     2797    NOREF(u32Method);
     2798    NOREF(pvResult);
     2799    NOREF(cbResult);
     2800}
     2801
     2802/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackInputEvent(void *pvCallback,
     2803                                                                          uint32_t u32Method,
     2804                                                                          const void *pvEvent,
     2805                                                                          uint32_t cbEvent)
     2806{
     2807    ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback);
     2808
     2809    if (u32Method == VRDE_INPUT_METHOD_TOUCH)
     2810    {
     2811        if (cbEvent >= sizeof(VRDEINPUTHEADER))
     2812        {
     2813            VRDEINPUTHEADER *pHeader = (VRDEINPUTHEADER *)pvEvent;
     2814
     2815            if (pHeader->u16EventId == VRDEINPUT_EVENTID_TOUCH)
     2816            {
     2817                VRDEINPUT_TOUCH_EVENT_PDU *p = (VRDEINPUT_TOUCH_EVENT_PDU *)pHeader;
     2818
     2819                uint16_t iFrame;
     2820                for (iFrame = 0; iFrame < p->u16FrameCount; iFrame++)
     2821                {
     2822                    VRDEINPUT_TOUCH_FRAME *pFrame = &p->aFrames[iFrame];
     2823
     2824                    uint16_t iContact;
     2825                    for (iContact = 0; iContact < pFrame->u16ContactCount; iContact++)
     2826                    {
     2827                        VRDEINPUT_CONTACT_DATA *pContact = &pFrame->aContacts[iContact];
     2828
     2829                        LONG x = pContact->i32X;
     2830                        LONG y = pContact->i32Y;
     2831                        LONG cContact = pContact->u8ContactId;
     2832                        LONG contactState = TouchContactState_None;
     2833
     2834                        /* @todo */
     2835                        if (pContact->u32ContactFlags & VRDEINPUT_CONTACT_FLAG_INRANGE)
     2836                        {
     2837                            contactState |= TouchContactState_InRange;
     2838                        }
     2839                        if (pContact->u32ContactFlags & VRDEINPUT_CONTACT_FLAG_INCONTACT)
     2840                        {
     2841                            contactState |= TouchContactState_InContact;
     2842                        }
     2843       
     2844                        HRESULT hrc = pThis->mConsole->getMouse()->PutMouseEventMultiTouch(x, y, cContact, contactState);
     2845                    }
     2846                }
     2847            }
     2848            else if (pHeader->u16EventId == VRDEINPUT_EVENTID_DISMISS_HOVERING_CONTACT)
     2849            {
     2850                /* @todo */
     2851            }
     2852            else
     2853            {
     2854                AssertMsgFailed(("EventId %d\n", pHeader->u16EventId));
     2855            }
     2856        }
     2857    }
     2858}
     2859
    27622860
    27632861void ConsoleVRDPServer::EnableConnections(void)
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