VirtualBox

Ignore:
Timestamp:
Feb 19, 2014 3:45:58 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
92350
Message:

DnD: Update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.cpp

    r50460 r50508  
    5353    HRESULT hr;
    5454
    55     ULONG cAllFormats = lstFormats.size();
     55    ULONG cMaxFormats = 16; /* Maximum number of registered formats. */
    5656    ULONG cRegisteredFormats = 0;
    5757
    5858    try
    5959    {
    60         mpFormatEtc = new FORMATETC[cAllFormats];
    61         RT_BZERO(mpFormatEtc, sizeof(FORMATETC) * cAllFormats);
    62         mpStgMedium = new STGMEDIUM[cAllFormats];
    63         RT_BZERO(mpStgMedium, sizeof(STGMEDIUM) * cAllFormats);
     60        mpFormatEtc = new FORMATETC[cMaxFormats];
     61        RT_BZERO(mpFormatEtc, sizeof(FORMATETC) * cMaxFormats);
     62        mpStgMedium = new STGMEDIUM[cMaxFormats];
     63        RT_BZERO(mpStgMedium, sizeof(STGMEDIUM) * cMaxFormats);
    6464
    6565        for (int i = 0; i < lstFormats.size(); i++)
     
    6969                continue;
    7070
     71            /* URI data ("text/uri-list"). */
    7172            if (strFormat.contains("text/uri-list", Qt::CaseInsensitive))
    7273            {
    73                 /* URI data ("text/uri-list"). */
     74                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_TEXT);
     75                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
     76                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_UNICODETEXT);
     77                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
    7478                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_HDROP);
    7579                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
     
    7781                mlstFormats << strFormat;
    7882            }
     83            /* Plain text ("text/plain"). */
    7984            else if (strFormat.contains("text/plain", Qt::CaseInsensitive))
    8085            {
    81                 /* Plain text ("text/plain"). */
    8286                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_TEXT);
    8387                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
     88                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_UNICODETEXT);
     89                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
    8490
    8591                mlstFormats << strFormat;
     
    8995        LogFlowFunc(("Total registered formats: %RU32 (of %d total)\n",
    9096                     cRegisteredFormats, lstFormats.size()));
    91 #ifdef VBOX_STRICT
    92         AssertMsg(cRegisteredFormats == cAllFormats,
    93                   ("Registered formats count is not matching all formats count\n"));
    94 #endif
    9597        hr = S_OK;
    9698    }
     
    201203    AssertPtrReturn(pMedium, DV_E_FORMATETC);
    202204
     205#ifdef VBOX_DND_DEBUG_FORMATS
    203206    LogFlowFunc(("pFormatEtc=%p, pMedium=%p\n", pFormatEtc, pMedium));
     207#endif
    204208
    205209    ULONG lIndex;
     
    227231    if (mStatus == Dropped)
    228232    {
    229 #if 0
    230         LogFlowFunc(("Starting to transfer content from the guest ...\n"));
    231 
    232         /*
    233          * This is the right time starting to transfer the actual data
    234          * from the guest:
    235          * - The user just triggered an action that tells us to start, e.g. at
    236          *   the moment we only "listen" for releasing the left mouse button.
    237          * - We're still in OLE's (modal) drag'n drop context so that all data
    238          *   from the guest (hopefully) will be available on the host when the
    239          *   drag'n drop operation is about to finish through OLE.
    240          *
    241          * Note that in the URI case the guest files/dirs must be somewhere
    242          * on the host before OLE's drag'n drop operation is finished, otherwise
    243          * the whole operation will fail.
    244          */
    245 #endif
     233#ifdef VBOX_DND_DEBUG_FORMATS
    246234        LogFlowFunc(("cfFormat=%RI16, sFormat=%s, tyMed=%RU32, dwAspect=%RU32\n",
    247235                     pThisFormat->cfFormat, UIDnDDataObject::ClipboardFormatToString(pFormatEtc->cfFormat),
     
    249237        LogFlowFunc(("Got strFormat=%s, pvData=%p, cbData=%RU32\n",
    250238                     mstrFormat.toAscii().constData(), mpvData, mcbData));
    251 
     239#endif
    252240        QVariant::Type vaType;
    253241        QString strMIMEType;
     
    495483STDMETHODIMP UIDnDDataObject::QueryGetData(FORMATETC *pFormatEtc)
    496484{
    497     LogFlowFunc(("\n"));
    498485    return (LookupFormatEtc(pFormatEtc, NULL /* puIndex */)) ? S_OK : DV_E_FORMATETC;
    499486}
     
    648635            && pFormatEtc->dwAspect == mpFormatEtc[i].dwAspect)
    649636        {
     637#ifdef VBOX_DND_DEBUG_FORMATS
    650638            LogFlowFunc(("Format found: tyMed=%RI32, cfFormat=%RI16, sFormats=%s, dwAspect=%RI32, ulIndex=%RU32\n",
    651639                         pFormatEtc->tymed, pFormatEtc->cfFormat, UIDnDDataObject::ClipboardFormatToString(mpFormatEtc[i].cfFormat),
    652640                         pFormatEtc->dwAspect, i));
     641#endif
    653642            if (puIndex)
    654643                *puIndex = i;
     
    657646    }
    658647
     648#ifdef VBOX_DND_DEBUG_FORMATS
    659649    LogFlowFunc(("Format NOT found: tyMed=%RI32, cfFormat=%RI16, sFormats=%s, dwAspect=%RI32\n",
    660650                 pFormatEtc->tymed, pFormatEtc->cfFormat, UIDnDDataObject::ClipboardFormatToString(pFormatEtc->cfFormat),
    661651                 pFormatEtc->dwAspect));
    662 
     652#endif
    663653    return false;
    664654}
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