VirtualBox

Changeset 97822 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Dec 16, 2022 9:29:14 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154902
Message:

DnD/Main: Don't set (and return) an error for GuestDnDSource::dragIsPending() when old(er) X11-based Guest Additions return with no supported host formats, but only specific X11-formats (TARGETS, MULTIPLE). Needs to be fixed for newer Guest Additions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp

    r97802 r97822  
    317317                 * which are not supported by the host.
    318318                 */
    319                 GuestDnDMIMEList lstFiltered  = GuestDnD::toFilteredFormatList(m_lstFmtSupported, pState->formats());
     319                GuestDnDMIMEList const &lstGuest     = pState->formats();
     320                GuestDnDMIMEList const  lstFiltered  = GuestDnD::toFilteredFormatList(m_lstFmtSupported, lstGuest);
    320321                if (lstFiltered.size())
    321322                {
     
    333334                }
    334335                else
    335                     hrc = i_setErrorAndReset(tr("Negotiation of formats between guest and host failed!\n\nHost offers: %s\n\nGuest offers: %s"),
    336                                              GuestDnD::toFormatString(m_lstFmtSupported , ",").c_str(),
    337                                              GuestDnD::toFormatString(pState->formats() , ",").c_str());
     336                {
     337                    bool fSetError = true; /* Whether to set an error and reset or not. */
     338
     339                    /*
     340                     * HACK ALERT: As we now expose an error (via i_setErrorAndReset(), see below) back to the API client, we
     341                     *             have to add a kludge here. Older X11-based Guest Additions report "TARGETS, MULTIPLE" back
     342                     *             to us, even if they don't offer any other *supported* formats of the host. This then in turn
     343                     *             would lead to exposing an error, whereas we just should ignore those specific X11-based
     344                     *             formats. For anything other we really want to be notified by setting an error though.
     345                     */
     346                    if (   lstGuest.size() == 2
     347                        && GuestDnD::isFormatInFormatList("TARGETS",  lstGuest)
     348                        && GuestDnD::isFormatInFormatList("MULTIPLE", lstGuest))
     349                    {
     350                        fSetError = false;
     351                    }
     352                    /* HACK ALERT END */
     353
     354                    if (fSetError)
     355                        hrc = i_setErrorAndReset(tr("Negotiation of formats between guest and host failed!\n\nHost offers: %s\n\nGuest offers: %s"),
     356                                                 GuestDnD::toFormatString(m_lstFmtSupported , ",").c_str(),
     357                                                 GuestDnD::toFormatString(pState->formats() , ",").c_str());
     358                    else /* Just silently reset. */
     359                        i_reset();
     360                }
    338361            }
    339362            /* Note: Don't report an error here when the action is "ignore" -- that only means that the current window on the guest
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