VirtualBox

Changeset 21185 in vbox for trunk/src


Ignore:
Timestamp:
Jul 2, 2009 10:07:50 PM (16 years ago)
Author:
vboxsync
Message:

GuestHost/SharedClipboard fix the clipboard on Solaris 10 and remove the Xlib Xutf8* code altogether

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp

    r21184 r21185  
    905905                                         int *piFormatReturn)
    906906{
    907     char *pszTmp = NULL;
     907    char *pszTmp = NULL, *pszTmp2 = NULL;
    908908    size_t cbTmp = 0, cbActual = 0;
    909909    XTextProperty property;
     
    923923        rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszTmp, cbTmp + 1,
    924924                              &cbActual);
    925     /* And finally (!) convert the Utf8 text to compound text. */
    926 #ifdef X_HAVE_UTF8_STRING
     925    /* Convert the Utf8 text to the current encoding (usually a noop). */
    927926    if (RT_SUCCESS(rc))
    928         xrc = Xutf8TextListToTextProperty(pDisplay, &pszTmp, 1,
    929                                           XCompoundTextStyle, &property);
    930 #else
     927        rc = RTStrUtf8ToCurrentCP(&pszTmp2, pszTmp);
     928    /* And finally (!) convert the resulting text to compound text. */
    931929    if (RT_SUCCESS(rc))
    932         xrc = XmbTextListToTextProperty(pDisplay, &pszTmp, 1,
     930        xrc = XmbTextListToTextProperty(pDisplay, &pszTmp2, 1,
    933931                                        XCompoundTextStyle, &property);
    934 #endif
    935932    if (RT_SUCCESS(rc) && xrc < 0)
    936933        rc = (  xrc == XNoMemory           ? VERR_NO_MEMORY
     
    939936              :                              VERR_UNRESOLVED_ERROR);
    940937    RTMemFree(pszTmp);
     938    RTStrFree(pszTmp2);
    941939    *atomTypeReturn = property.encoding;
    942940    *pValReturn = reinterpret_cast<XtPointer>(property.value);
     
    12621260    int rc = VINF_SUCCESS;
    12631261    XTextProperty property;
    1264     char **ppcTmp = NULL;
     1262    char **ppcTmp = NULL, *pszTmp = NULL;
    12651263    int cProps;
    12661264
     
    12691267    property.format = 8;
    12701268    property.nitems = cbSrc;
    1271 #ifdef X_HAVE_UTF8_STRING
    1272     int xrc = Xutf8TextPropertyToTextList(XtDisplay(widget), &property,
    1273                                           &ppcTmp, &cProps);
    1274 #else
    12751269    int xrc = XmbTextPropertyToTextList(XtDisplay(widget), &property,
    12761270                                        &ppcTmp, &cProps);
    1277 #endif
    12781271    if (xrc < 0)
    12791272        rc = (  xrc == XNoMemory           ? VERR_NO_MEMORY
     
    12811274              : xrc == XConverterNotFound  ? VERR_NOT_SUPPORTED
    12821275              :                              VERR_UNRESOLVED_ERROR);
     1276    /* Convert the text returned to UTF8 */
     1277    if (RT_SUCCESS(rc))
     1278        rc = RTStrCurrentCPToUtf8(&pszTmp, *ppcTmp);
    12831279    /* Now convert the UTF8 to UTF16 */
    12841280    if (RT_SUCCESS(rc))
    1285         rc = clipUtf8ToWinTxt(*ppcTmp, strlen(*ppcTmp), ppwszDest, pcbDest);
     1281        rc = clipUtf8ToWinTxt(pszTmp, strlen(pszTmp), ppwszDest, pcbDest);
    12861282    if (ppcTmp != NULL)
    12871283        XFreeStringList(ppcTmp);
     1284    RTStrFree(pszTmp);
    12881285    LogFlowFunc(("Returning %Rrc\n", rc));
    12891286    if (pcbDest)
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