VirtualBox

Changeset 74380 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Sep 20, 2018 10:02:42 AM (6 years ago)
Author:
vboxsync
Message:

DnD: Added VBGLR3DNDEVENTTYPE to abstract the DnD protocol from the actual DnD events more; that way the client don't need to know exactly how the actual protocol works, but only react on events they care for.

File:
1 edited

Legend:

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

    r72627 r74380  
    848848} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
    849849
    850 typedef struct VBGLR3DNDHGCMEVENT
     850/**
     851 * Enumeration for specifying the DnD meta data type.
     852 */
     853typedef enum VBGLR3GUESTDNDMETADATATYPE
    851854{
    852     uint32_t uType;               /** The event type this struct contains. */
    853     uint32_t uScreenId;           /** Screen ID this request belongs to. */
    854     char    *pszFormats;          /** Format list (\r\n separated). */
    855     uint32_t cbFormats;           /** Size (in bytes) of pszFormats (\0 included). */
     855    /** Unknown meta data type; don't use. */
     856    VBGLR3GUESTDNDMETADATATYPE_UNKNOWN = 0,
     857    /** Raw meta data; can be everything. */
     858    VBGLR3GUESTDNDMETADATATYPE_RAW,
     859    /** Meta data is an URI list, specifying objects. */
     860    VBGLR3GUESTDNDMETADATATYPE_URI_LIST,
     861    /** Blow the type up to 32-bit. */
     862    VBGLR3GUESTDNDMETADATATYPE_32BIT_HACK = 0x7fffffff
     863} VBGLR3GUESTDNDMETADATATYPE;
     864
     865/**
     866 * Structure for keeping + handling DnD meta data.
     867 *
     868 * Note: Don't treat this struct as POD object, as the union has classes in it.
     869 */
     870typedef struct VBGLR3GUESTDNDMETADATA
     871{
     872    /** The meta data type the union contains. */
     873    VBGLR3GUESTDNDMETADATATYPE enmType;
     874    /** Pointer to actual meta data. */
     875    void    *pvMeta;
     876    /** Size (in bytes) of meta data. */
     877    uint32_t cbMeta;
     878} VBGLR3GUESTDNDMETADATA;
     879
     880/** Pointer to VBGLR3GUESTDNDMETADATA. */
     881typedef VBGLR3GUESTDNDMETADATA *PVBGLR3GUESTDNDMETADATA;
     882
     883/** Const pointer to VBGLR3GUESTDNDMETADATA. */
     884typedef const PVBGLR3GUESTDNDMETADATA CPVBGLR3GUESTDNDMETADATA;
     885
     886/**
     887 * Enumeration specifying a DnD event type.
     888 */
     889typedef enum VBGLR3DNDEVENTTYPE
     890{
     891    VBGLR3DNDEVENTTYPE_INVALID        = 0,
     892    VBGLR3DNDEVENTTYPE_HG_ERROR       = 1,
     893    VBGLR3DNDEVENTTYPE_HG_ENTER       = 2,
     894    VBGLR3DNDEVENTTYPE_HG_MOVE        = 3,
     895    VBGLR3DNDEVENTTYPE_HG_LEAVE       = 4,
     896    VBGLR3DNDEVENTTYPE_HG_DROP        = 5,
     897    VBGLR3DNDEVENTTYPE_HG_RECEIVE     = 6,
     898    VBGLR3DNDEVENTTYPE_HG_CANCEL      = 7,
     899# ifdef VBOX_WITH_DRAG_AND_DROP_GH
     900    VBGLR3DNDEVENTTYPE_GH_ERROR       = 100,
     901    VBGLR3DNDEVENTTYPE_GH_REQ_PENDING = 101,
     902    VBGLR3DNDEVENTTYPE_GH_DROP        = 102,
     903# endif
     904    /** Blow the type up to 32-bit. */
     905    VBGLR3DNDEVENTTYPE_32BIT_HACK = 0x7fffffff
     906} VBGLR3DNDEVENTTYPE;
     907
     908typedef struct VBGLR3DNDEVENT
     909{
     910    /** The event type the union contains. */
     911    VBGLR3DNDEVENTTYPE enmType;
    856912    union
    857913    {
    858914        struct
    859915        {
    860             uint32_t uXpos;       /** X position of guest screen. */
    861             uint32_t uYpos;       /** Y position of guest screen. */
    862             uint32_t uDefAction;  /** Proposed DnD action. */
    863             uint32_t uAllActions; /** Allowed DnD actions. */
    864         } a; /** Values used in init, move and drop event type. */
     916            /** Screen ID this request belongs to. */
     917            uint32_t uScreenID;
     918            /** Format list (UTF-8, \r\n separated). */
     919            char    *pszFormats;
     920            /** Size (in bytes) of pszFormats (\0 included). */
     921            uint32_t cbFormats;
     922            /** Allowed DnD actions. */
     923            uint32_t uAllActions;
     924        } HG_Enter;
    865925        struct
    866926        {
    867             void    *pvData;      /** Data request. */
    868             uint32_t cbData;      /** Size (in bytes) of pvData. */
    869         } b; /** Values used in drop data event type. */
     927            /** Absolute X position of guest screen. */
     928            uint32_t uXpos;
     929            /** Absolute Y position of guest screen. */
     930            uint32_t uYpos;
     931            /** Proposed DnD action. */
     932            uint32_t uDefAction;
     933        } HG_Move;
     934        struct
     935        {
     936            /* Nothing in here. */
     937        } HG_Leave;
     938        struct
     939        {
     940            /** Absolute X position of guest screen. */
     941            uint32_t uXpos;
     942            /** Absolute Y position of guest screen. */
     943            uint32_t uYpos;
     944            /** Proposed DnD action. */
     945            uint32_t uDefAction;
     946        } HG_Drop;
     947        struct
     948        {
     949            /** Meta data for the operation. */
     950            VBGLR3GUESTDNDMETADATA Meta;
     951        } HG_Received;
     952        struct
     953        {
     954            /** IPRT-style error code. */
     955            int rc;
     956        } HG_Error;
     957# ifdef VBOX_WITH_DRAG_AND_DROP_GH
     958        struct
     959        {
     960            /** Screen ID this request belongs to. */
     961            uint32_t uScreenID;
     962        } GH_IsPending;
     963        struct
     964        {
     965            /** Requested format by the host. */
     966            char    *pszFormat;
     967            /** Size (in bytes) of pszFormat (\0 included). */
     968            uint32_t cbFormat;
     969            /** Requested DnD action. */
     970            uint32_t uAction;
     971        } GH_Drop;
     972# endif
    870973    } u;
    871 } VBGLR3DNDHGCMEVENT;
    872 typedef VBGLR3DNDHGCMEVENT *PVBGLR3DNDHGCMEVENT;
    873 typedef const PVBGLR3DNDHGCMEVENT CPVBGLR3DNDHGCMEVENT;
     974} VBGLR3DNDEVENT;
     975typedef VBGLR3DNDEVENT *PVBGLR3DNDEVENT;
     976typedef const PVBGLR3DNDEVENT CPVBGLR3DNDEVENT;
     977
    874978VBGLR3DECL(int)     VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
    875979VBGLR3DECL(int)     VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
    876980
    877 VBGLR3DECL(int)     VbglR3DnDRecvNextMsg(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent);
     981VBGLR3DECL(int)     VbglR3DnDEventGetNext(PVBGLR3GUESTDNDCMDCTX pCtx, PVBGLR3DNDEVENT *ppEvent);
     982VBGLR3DECL(void)    VbglR3DnDEventFree(PVBGLR3DNDEVENT pEvent);
    878983
    879984VBGLR3DECL(int)     VbglR3DnDHGSendAckOp(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction);
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