VirtualBox

Changeset 90054 in vbox for trunk


Ignore:
Timestamp:
Jul 6, 2021 10:55:23 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145548
Message:

VBoxSharedClipboard/win: Replaced SharedClipboardWinAnnounceFormats with SharedClipboardWinClearAndAnnounceFormats that does all the necessary work. Documented hWndClipboardOwnerUs more accurately. bugref:9998

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/SharedClipboard-win.h

    r85121 r90054  
    111111    /** Window handle which is next to us in the clipboard chain. */
    112112    HWND               hWndNextInChain;
    113     /** Window handle of the clipboard owner *if* we are the owner. */
     113    /** Window handle of the clipboard owner *if* we are the owner.
     114     * @todo r=bird: Ignore the misleading statement above.  This is only set to
     115     * NULL by the initialization code and then it's set to the clipboard owner
     116     * after we announce data to the clipboard.  So, essentially this will be our
     117     * windows handle or NULL.  End of story. */
    114118    HWND               hWndClipboardOwnerUs;
    115119    /** Structure for maintaining the new clipboard API. */
     
    152156int SharedClipboardWinHandleWMTimer(PSHCLWINCTX pWinCtx);
    153157
    154 int SharedClipboardWinAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats);
     158int SharedClipboardWinClearAndAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats, HWND hWnd);
    155159#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    156160int SharedClipboardWinTransferCreate(PSHCLWINCTX pWinCtx, PSHCLTRANSFER pTransfer);
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r87611 r90054  
    519519                {
    520520#endif
    521                     int rc = SharedClipboardWinOpen(hwnd);
    522                     if (RT_SUCCESS(rc))
    523                     {
    524                         SharedClipboardWinClear();
    525 
    526                         rc = SharedClipboardWinAnnounceFormats(pWinCtx, fFormats);
    527                     }
    528 
    529                     SharedClipboardWinClose();
    530 
     521                    SharedClipboardWinClearAndAnnounceFormats(pWinCtx, fFormats, hwnd);
    531522#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    532523                }
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp

    r85121 r90054  
    819819 * @param   fFormats            Clipboard format(s) to announce.
    820820 */
    821 int SharedClipboardWinAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats)
     821static int sharedClipboardWinAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats)
    822822{
    823823    LogFunc(("fFormats=0x%x\n", fFormats));
     
    893893}
    894894
     895/**
     896 * Opens the clipboard, clears it, announces @a fFormats and closes it.
     897 *
     898 * The actual rendering (setting) of the clipboard data will be done later with
     899 * a separate WM_RENDERFORMAT message.
     900 *
     901 * @returns VBox status code. VERR_NOT_SUPPORTED if the format is not supported / handled.
     902 * @param   pWinCtx     Windows context to use.
     903 * @param   fFormats    Clipboard format(s) to announce.
     904 * @param   hWnd        The window handle to use as owner.
     905 */
     906int SharedClipboardWinClearAndAnnounceFormats(PSHCLWINCTX pWinCtx, SHCLFORMATS fFormats, HWND hWnd)
     907{
     908    int rc = SharedClipboardWinOpen(hWnd);
     909    if (RT_SUCCESS(rc))
     910    {
     911        SharedClipboardWinClear();
     912
     913        rc = sharedClipboardWinAnnounceFormats(pWinCtx, fFormats);
     914        Assert(pWinCtx->hWndClipboardOwnerUs == hWnd || pWinCtx->hWndClipboardOwnerUs == NULL);
     915
     916        SharedClipboardWinClose();
     917    }
     918    return rc;
     919}
     920
    895921#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     922
    896923/**
    897924 * Creates an Shared Clipboard transfer by announcing transfer data  (via IDataObject) to Windows.
     
    12081235    return rc;
    12091236}
     1237
    12101238#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    12111239
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp

    r90050 r90054  
    383383            {
    384384#endif
    385                 int rc = SharedClipboardWinOpen(hWnd);
    386                 if (RT_SUCCESS(rc))
    387                 {
    388                     SharedClipboardWinClear();
    389 
    390                     rc = SharedClipboardWinAnnounceFormats(pWinCtx, fFormats);
    391 
    392                     SharedClipboardWinClose();
    393                 }
    394 
     385                int rc = SharedClipboardWinClearAndAnnounceFormats(pWinCtx, fFormats, hWnd);
    395386                if (RT_FAILURE(rc))
    396387                    LogRel(("Shared Clipboard: Reporting clipboard formats %#x to Windows host failed with %Rrc\n", fFormats, rc));
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