VirtualBox

Changeset 3332 in vbox


Ignore:
Timestamp:
Jun 29, 2007 5:12:10 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
22474
Message:

Linux clipboard fix for X11 64bit weirdness

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/xclient/clipboard.cpp

    r3327 r3332  
    724724    Atom *atomTargets = reinterpret_cast<Atom *>(pValue);
    725725    /* The number of format atoms the clipboard holder is offering us */
    726     unsigned cAtoms = (*pcLen) * (*piFormat) / sizeof(Atom) / 8;
     726    unsigned cAtoms = *pcLen;
    727727    /* The best clipboard format we have found so far */
    728728    g_eClipboardFormats eBestTarget = INVALID;
     
    769769#endif
    770770    }
    771     XtFree(reinterpret_cast<char *>(pValue));
    772771    g_ctx.atomGuestTextFormat = atomBestTarget;
    773772    /* If the available formats as seen by the host have changed, or if we suspect that
     
    781780        {
    782781            char *szAtomName = XGetAtomName(XtDisplay(g_ctx.widget), atomBestTarget);
    783             Log2 (("vboxClipboardTargetsProc: switching to guest text target %s\n", szAtomName));
     782            Log2 (("vboxClipboardTargetsProc: switching to guest text target %s.  Available targets are:\n",
     783                   szAtomName));
    784784            XFree(szAtomName);
    785785        }
    786786        else
    787787        {
    788             Log2(("vboxClipboardTargetsProc: no supported host text target found.\n"));
     788            Log2(("vboxClipboardTargetsProc: no supported host text target found.  Available targets are:\n"));
     789        }
     790        for (unsigned i = 0; i < cAtoms; ++i)
     791        {
     792            char *szAtomName = XGetAtomName(XtDisplay(g_ctx.widget), atomTargets[i]);
     793            if (szAtomName != 0)
     794            {
     795                Log2 (("vboxClipboardTargetsProc:     %s\n", szAtomName));
     796                XFree(szAtomName);
     797            }
    789798        }
    790799#endif
    791800        g_ctx.guestTextFormat = eBestTarget;
    792         /* We fall back to compound text if no recognized formats are found.  This seems (?)
    793            to violate the ICCCM, but some applications seem to expect it. */
    794         // if (eBestTarget != INVALID)
     801        if (eBestTarget != INVALID)
    795802            u32Formats |= VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT;
    796         if (eBestTarget == INVALID)
    797         {
    798             g_ctx.atomGuestTextFormat = g_ctx.atomCText;
    799             g_ctx.guestTextFormat = CTEXT;
    800         }
    801803        vboxClipboardReportFormats(u32Formats);
    802804        g_ctx.notifyHost = false;
    803805    }
     806    XtFree(reinterpret_cast<char *>(pValue));
    804807    ++cCalls;
    805808}
     
    875878    *pValReturn = reinterpret_cast<XtPointer>(atomTargets);
    876879    *pcLenReturn = cTargets + 3;
    877     *piFormatReturn = sizeof(Atom) * 8;
     880    *piFormatReturn = 32;
    878881    LogFlowFunc(("returning true\n"));
    879882    return true;
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