Changeset 81747 in vbox
- Timestamp:
- Nov 8, 2019 8:31:57 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134534
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard.h
r81444 r81747 119 119 /** Defines a pointer to a session ID. */ 120 120 typedef SHCLSESSIONID *PSHCLSESSIONID; 121 /** Defines a NIL session ID. */ 122 #define NIL_SHCLSESSIONID UINT16_MAX 123 124 /** Defines a transfer ID. */ 125 typedef uint16_t SHCLTRANSFERID; 126 /** Defines a pointer to a transfer ID. */ 127 typedef SHCLTRANSFERID *PSHCLTRANSFERID; 128 /** Defines a NIL transfer ID. */ 129 #define NIL_SHCLTRANSFERID UINT16_MAX 130 121 131 /** Defines an event ID. */ 122 132 typedef uint32_t SHCLEVENTID; 123 133 /** Defines a pointer to a event source ID. */ 124 134 typedef SHCLEVENTID *PSHCLEVENTID; 135 /** Defines a NIL event ID. */ 136 #define NIL_SHCLEVENTID UINT32_MAX 125 137 126 138 /** Maximum number of concurrent Shared Clipboard client sessions a VM can have. */ 127 #define VBOX_SHCL_MAX_SESSIONS UINT16_MAX 139 #define VBOX_SHCL_MAX_SESSIONS UINT16_MAX - 1 128 140 /** Maximum number of concurrent Shared Clipboard transfers a single 129 141 * client can have. */ 130 #define VBOX_SHCL_MAX_TRANSFERS UINT16_MAX 142 #define VBOX_SHCL_MAX_TRANSFERS UINT16_MAX - 1 131 143 /** Maximum number of events a single Shared Clipboard transfer can have. */ 132 #define VBOX_SHCL_MAX_EVENTS UINT32_MAX 144 #define VBOX_SHCL_MAX_EVENTS UINT32_MAX - 1 133 145 134 146 /** -
trunk/include/VBox/HostServices/VBoxClipboardSvc.h
r81559 r81747 1168 1168 } SHCLERRORDATA, *PSHCLERRORDATA; 1169 1169 1170 /** Opaque client structure for API access. */ 1171 struct _SHCLCLIENT; 1172 typedef struct _SHCLCLIENT SHCLCLIENT, *PSHCLCLIENT; 1173 1174 /** Opaque client structure for API access. */ 1175 struct _SHCLCLIENTCMDCTX; 1176 typedef struct _SHCLCLIENTCMDCTX SHCLCLIENTCMDCTX, *PSHCLCLIENTCMDCTX; 1177 1178 /** @name Public service functions, accessible by the backends. 1179 * Locking is between the (host) service thread and the platform-dependent (window) thread. 1180 * @{ 1181 */ 1182 int ShClSvcDataReadRequest(PSHCLCLIENT pClient, PSHCLDATAREQ pDataReq, PSHCLEVENTID puEvent); 1183 int ShClSvcDataReadSignal(PSHCLCLIENT pClient, PSHCLCLIENTCMDCTX pCmdCtx, PSHCLDATABLOCK pData); 1184 int ShClSvcFormatsReport(PSHCLCLIENT pClient, PSHCLFORMATDATA pFormats); 1185 /** @} */ 1186 1170 1187 uint32_t ShClSvcGetMode(void); 1171 1188 bool ShClSvcGetHeadless(void); -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp
r81701 r81747 53 53 #include <iprt/utf16.h> 54 54 55 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 56 # include <iprt/cpp/list.h> 57 # include <iprt/cpp/ministring.h> 58 #endif 59 55 60 #include <VBox/log.h> 56 61 #include <VBox/version.h> … … 74 79 INVALID = 0, 75 80 TARGETS, 76 TEXT, /* Treat this as U tf8, but it may really be ascii */81 TEXT, /* Treat this as UTF-8, but it may really be ascii */ 77 82 UTF8, 78 83 BMP, … … 364 369 365 370 #ifdef TESTCASE 366 static void t estQueueToEventThread(void (*proc)(void *, void *),367 void *client_data);371 static void tstClipQueueToEventThread(void (*proc)(void *, void *), 372 void *client_data); 368 373 #endif 369 374 … … 393 398 #else 394 399 RT_NOREF(pCtx); 395 t estQueueToEventThread(proc, client_data);400 tstClipQueueToEventThread(proc, client_data); 396 401 #endif 397 402 … … 402 407 /** 403 408 * Reports the formats currently supported by the X11 clipboard to VBox. 409 * 410 * @note Runs in Xt event thread. 404 411 * 405 412 * @param pCtx The clipboard backend context to use. … … 442 449 } 443 450 444 /** Tells VBox that X11 currently has nothing in its clipboard. */ 451 /** 452 * Tells VBox that X11 currently has nothing in its clipboard. 453 * 454 * @param pCtx The clipboard backend context to use. 455 */ 445 456 static void clipReportEmptyX11CB(CLIPBACKEND *pCtx) 446 457 { … … 452 463 * Go through an array of X11 clipboard targets to see if they contain a text 453 464 * format we can support, and if so choose the ones we prefer (e.g. we like 454 * U tf8 better than plain text).465 * UTF-8 better than plain text). 455 466 * 456 467 * @return Supported X clipboard format. … … 485 496 486 497 #ifdef TESTCASE 487 static bool clipTestTextFormatConversion(CLIPBACKEND *pCtx)498 static bool tstClipTextFormatConversion(CLIPBACKEND *pCtx) 488 499 { 489 500 bool fSuccess = true; … … 644 655 } 645 656 646 static void clipQueryX11 CBFormats(CLIPBACKEND *pCtx);657 static void clipQueryX11FormatsCallback(CLIPBACKEND *pCtx); 647 658 648 659 /** … … 673 684 * "targets" information obtained from the X11 clipboard. 674 685 * 675 * @note Callback for XtGetSelectionValue .686 * @note Callback for XtGetSelectionValue(). 676 687 * @note This function is treated as API glue, and as such is not part of any 677 688 * unit test. So keep it simple, be paranoid and log everything. 678 689 */ 679 static void clipConvertX11Targets(Widget widget, XtPointer pClient,680 Atom * /* selection */, Atom *atomType,681 XtPointer pValue, long unsigned int *pcLen,682 int *piFormat)690 static DECLCALLBACK(void) clipConvertX11TargetsCallback(Widget widget, XtPointer pClient, 691 Atom * /* selection */, Atom *atomType, 692 XtPointer pValue, long unsigned int *pcLen, 693 int *piFormat) 683 694 { 684 695 RT_NOREF(piFormat); … … 742 753 743 754 #ifdef TESTCASE 744 void t estRequestTargets(CLIPBACKEND *pCtx);755 void tstRequestTargets(CLIPBACKEND *pCtx); 745 756 #endif 746 757 … … 750 761 * @param pCtx The clipboard backend context to use. 751 762 */ 752 static void clipQueryX11CBFormats(CLIPBACKEND *pCtx)763 static DECLCALLBACK(void) clipQueryX11FormatsCallback(CLIPBACKEND *pCtx) 753 764 { 754 765 LogFlowFuncEnter(); … … 758 769 clipGetAtom(pCtx, "CLIPBOARD"), 759 770 clipGetAtom(pCtx, "TARGETS"), 760 clipConvertX11Targets , pCtx,771 clipConvertX11TargetsCallback, pCtx, 761 772 CurrentTime); 762 773 #else 763 t estRequestTargets(pCtx);774 tstRequestTargets(pCtx); 764 775 #endif 765 776 } … … 802 813 if ( (event.fixes.subtype == 0 /* XFixesSetSelectionOwnerNotify */) 803 814 && (event.fixes.owner != 0)) 804 clipQueryX11 CBFormats(pCtx);815 clipQueryX11FormatsCallback(pCtx); 805 816 else 806 817 clipReportEmptyX11CB(pCtx); … … 810 821 811 822 /** 812 * The main loop of our clipboard reader.823 * The main loop of our X11 event thread. 813 824 * 814 825 * @note X11 backend code. … … 817 828 { 818 829 RT_NOREF(hThreadSelf); 819 LogRel(("Shared Clipboard: Starting event thread\n")); 830 831 LogRel(("Shared Clipboard: Starting X11 event thread\n")); 820 832 821 833 CLIPBACKEND *pCtx = (CLIPBACKEND *)pvUser; 822 834 823 835 if (pCtx->fGrabClipboardOnStart) 824 clipQueryX11CBFormats(pCtx); 836 clipQueryX11FormatsCallback(pCtx); 837 825 838 while (XtAppGetExitFlag(pCtx->appContext) == FALSE) 826 839 { … … 828 841 XtAppProcessEvent(pCtx->appContext, XtIMAll); 829 842 } 830 LogRel(("Shared Clipboard: Event thread terminated successfully\n")); 843 844 LogRel(("Shared Clipboard: X11 event thread terminated successfully\n")); 831 845 return VINF_SUCCESS; 832 846 } 833 #endif 847 #endif /* !TESTCASE */ 834 848 835 849 /** … … 933 947 return rc; 934 948 } 935 #endif 949 #endif /* !TESTCASE */ 936 950 937 951 /** … … 1116 1130 { 1117 1131 rc = RTThreadCreate(&pCtx->thread, clipEventThread, pCtx, 0, 1118 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCL IP");1132 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLX11"); 1119 1133 if (RT_FAILURE(rc)) 1120 1134 { 1121 LogRel(("Shared Clipboard: Failed to start the shared clipboard thread\n"));1135 LogRel(("Shared Clipboard: Failed to start the X11 event thread with %Rrc\n", rc)); 1122 1136 clipUninit(pCtx); 1123 1137 } … … 1153 1167 /* Write to the "stop" pipe */ 1154 1168 clipQueueToEventThread(pCtx, clipStopEventThreadWorker, (XtPointer) pCtx); 1169 1155 1170 #ifndef TESTCASE 1156 1171 do … … 1282 1297 1283 1298 /** 1284 * Converts text from Windows format (UCS-2 with CRLF line endings) to standard U tf-8.1299 * Converts text from Windows format (UCS-2 with CRLF line endings) to standard UTF-8. 1285 1300 * 1286 1301 * @returns VBox status code. … … 1314 1329 rc = ShClUtf16WinToLin(pwszSrc, cwSrc, pwszTmp, cwTmp); 1315 1330 if (RT_SUCCESS(rc)) 1316 /* Convert the Utf16 string to Utf8. */ 1331 { 1332 /* Convert the UTF-16 string to Utf8. */ 1317 1333 rc = RTUtf16ToUtf8Ex(pwszTmp + 1, cwTmp - 1, &pszBuf, cbBuf, 1318 1334 &cbDest); 1335 } 1319 1336 RTMemFree(reinterpret_cast<void *>(pwszTmp)); 1320 1337 if (pcbActual) … … 1329 1346 1330 1347 /** 1331 * Satisfies a request from X11 to convert the clipboard text to U tf-8. We1348 * Satisfies a request from X11 to convert the clipboard text to UTF-8. We 1332 1349 * return null-terminated text, but can cope with non-null-terminated input. 1333 1350 * … … 1362 1379 if (RT_SUCCESS(rc)) 1363 1380 { 1364 char *pszDest= (char *)XtMalloc(cbDest);1381 char *pszDest = (char *)XtMalloc(cbDest); 1365 1382 size_t cbActual = 0; 1366 1383 if (pszDest) 1367 rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszDest, cbDest, 1368 &cbActual); 1384 { 1385 rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszDest, cbDest, &cbActual); 1386 } 1387 else 1388 rc = VERR_NO_MEMORY; 1389 1369 1390 if (RT_SUCCESS(rc)) 1370 1391 { … … 1379 1400 1380 1401 /** 1381 * Satisfies a request from X11 to convert the clipboard HTML fragment to U tf-8. We1402 * Satisfies a request from X11 to convert the clipboard HTML fragment to UTF-8. We 1382 1403 * return null-terminated text, but can cope with non-null-terminated input. 1383 1404 * … … 1406 1427 1407 1428 /* This may slightly overestimate the space needed. */ 1408 LogFlowFunc((" source: %s", pszSrc));1429 LogFlowFunc(("Source: %s", pszSrc)); 1409 1430 1410 1431 char *pszDest = (char *)XtMalloc(cbSrc); 1411 if (pszDest == NULL)1432 if (pszDest == NULL) 1412 1433 return VERR_NO_MEMORY; 1413 1434 … … 1468 1489 && (pCtx->vboxFormats & VBOX_SHCL_FMT_UNICODETEXT)) 1469 1490 { 1470 void *pv = NULL;1491 void *pv = NULL; 1471 1492 uint32_t cb = 0; 1472 1493 rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_UNICODETEXT, &pv, &cb); … … 1480 1501 if (RT_SUCCESS(rc)) 1481 1502 clipTrimTrailingNul(*(XtPointer *)pValReturn, pcLenReturn, format); 1503 1482 1504 RTMemFree(pv); 1483 1505 } … … 1485 1507 && (pCtx->vboxFormats & VBOX_SHCL_FMT_BITMAP)) 1486 1508 { 1487 void *pv = NULL;1509 void *pv = NULL; 1488 1510 uint32_t cb = 0; 1489 rc = clipReadVBoxShCl(pCtx, 1490 VBOX_SHCL_FMT_BITMAP, 1491 &pv, &cb); 1511 rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_BITMAP, &pv, &cb); 1492 1512 if (RT_SUCCESS(rc) && (cb == 0)) 1493 1513 rc = VERR_NO_DATA; … … 1506 1526 *piFormatReturn = 8; 1507 1527 } 1528 1508 1529 RTMemFree(pv); 1509 1530 } 1510 else if ( (format == HTML)1531 else if ( (format == HTML) 1511 1532 && (pCtx->vboxFormats & VBOX_SHCL_FMT_HTML)) 1512 1533 { 1513 void *pv = NULL;1534 void *pv = NULL; 1514 1535 uint32_t cb = 0; 1515 rc = clipReadVBoxShCl(pCtx, 1516 VBOX_SHCL_FMT_HTML, 1517 &pv, &cb); 1536 rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_HTML, &pv, &cb); 1518 1537 if (RT_SUCCESS(rc) && (cb == 0)) 1519 1538 rc = VERR_NO_DATA; … … 1521 1540 { 1522 1541 /* 1523 * The common VBox HTML encoding will be - Utf81524 * becuase it more general for HTML formats then UTF161525 * X11 clipboard returns UTF16, so before sending it we should1526 * convert it to UTF81527 * It's very strange but here we get utf16 from x11 clipboard1528 * in same time we send utf8 to x11 clipboard and it's work1529 */1542 * The common VBox HTML encoding will be - Utf8 1543 * because it more general for HTML formats then UTF16 1544 * X11 clipboard returns UTF-16, so before sending it we should 1545 * convert it to UTF8. 1546 * It's very strange but here we get UTF-16 from x11 clipboard 1547 * in same time we send UTF-8 to x11 clipboard and it's work. 1548 */ 1530 1549 rc = clipWinHTMLToUtf8ForX11CB(XtDisplay(pCtx->widget), 1531 (const char*)pv, cb, atomTarget, 1532 atomTypeReturn, pValReturn, 1533 pcLenReturn, piFormatReturn); 1534 1535 1550 (const char*)pv, cb, atomTarget, 1551 atomTypeReturn, pValReturn, 1552 pcLenReturn, piFormatReturn); 1536 1553 if (RT_SUCCESS(rc)) 1537 1554 clipTrimTrailingNul(*(XtPointer *)pValReturn, pcLenReturn, format); 1555 1538 1556 RTMemFree(pv); 1539 1557 } … … 1580 1598 } 1581 1599 1582 /** Structure used to pass information about formats that VBox supports */ 1600 /** 1601 * Structure used to pass information about formats that VBox supports. 1602 */ 1583 1603 typedef struct _CLIPNEWVBOXFORMATS 1584 1604 { 1585 /** Context information for the X11 clipboard */1605 /** Context information for the X11 clipboard. */ 1586 1606 CLIPBACKEND *pCtx; 1587 /** Formats supported by VBox */1588 uint32_tformats;1607 /** Formats supported by VBox. */ 1608 SHCLFORMATS formats; 1589 1609 } CLIPNEWVBOXFORMATS, *PCLIPNEWVBOXFORMATS; 1590 1610 … … 1652 1672 1653 1673 /** 1654 * VBox is taking possession of the shared clipboard.1655 * 1656 * @param u32Formats Clipboard formats that VBox is offering.1674 * VBox is taking possession of the Shared Clipboard. 1675 * 1676 * @param u32Formats clipboard formats that VBox is offering. 1657 1677 * @note X11 backend code 1658 1678 */ … … 1685 1705 1686 1706 /** 1687 * Massages generic U tf16 with CR end-of-lines into the format Windows expects1707 * Massages generic UTF-16 with CR end-of-lines into the format Windows expects 1688 1708 * and return the result in a RTMemAlloc allocated buffer. 1689 1709 * 1690 1710 * @returns VBox status code. 1691 * @param pwcSrc The source as U tf16.1711 * @param pwcSrc The source as UTF-16. 1692 1712 * @param cwcSrc The number of 16bit elements in @a pwcSrc, not counting 1693 1713 * the terminating zero. … … 1708 1728 1709 1729 PRTUTF16 pwszDest = NULL; 1710 size_t cwcDest;1730 size_t cwcDest; 1711 1731 int rc = ShClUtf16GetWinSize(pwcSrc, cwcSrc + 1, &cwcDest); 1712 1732 if (RT_SUCCESS(rc)) … … 1737 1757 1738 1758 /** 1739 * Converts U tf-8 text with CR end-of-lines into Utf-16 as Windows expects it1759 * Converts UTF-8 text with CR end-of-lines into UTF-16 as Windows expects it 1740 1760 * and return the result in a RTMemAlloc allocated buffer. 1741 1761 * 1742 1762 * @returns VBox status code. 1743 * @param pcSrc The source U tf-8.1763 * @param pcSrc The source UTF-8. 1744 1764 * @param cbSrc The size of the source in bytes, not counting the 1745 1765 * terminating zero. … … 1759 1779 *pcbDest = 0; 1760 1780 1761 /* Intermediate conversion to UTF 16. */1762 size_t cwcTmp;1781 /* Intermediate conversion to UTF-16. */ 1782 size_t cwcTmp; 1763 1783 PRTUTF16 pwcTmp = NULL; 1764 1784 int rc = RTStrToUtf16Ex(pcSrc, cbSrc, &pwcTmp, 0, &cwcTmp); … … 1773 1793 1774 1794 /** 1775 * Converts Latin-1 text with CR end-of-lines into U tf-16 as Windows expects1795 * Converts Latin-1 text with CR end-of-lines into UTF-16 as Windows expects 1776 1796 * it and return the result in a RTMemAlloc allocated buffer. 1777 1797 * … … 1815 1835 1816 1836 /* And do the conversion, bearing in mind that Latin-1 expands "naturally" 1817 * to U tf-16. */1837 * to UTF-16. */ 1818 1838 if (RT_SUCCESS(rc)) 1819 1839 { … … 1847 1867 1848 1868 /** 1849 * Converts U tf16 text into UTF8 as Windows expects1869 * Converts UTF-16 text into UTF-8 as Windows expects 1850 1870 * it and return the result in a RTMemAlloc allocated buffer. 1851 1871 * … … 1893 1913 1894 1914 /* append new substring */ 1895 char *pchNew = (char *)RTMemRealloc(pchRes, cRes + cch + 1);1915 char *pchNew = (char *)RTMemRealloc(pchRes, cRes + cch + 1); 1896 1916 if (!pchNew) 1897 1917 { … … 1926 1946 { 1927 1947 /** The format VBox would like the data in */ 1928 uint32_t mFormat; 1948 SHCLFORMAT mFormat; 1949 /** @todo Put the following variables in an union or just use one for all formats? */ 1929 1950 /** The text format we requested from X11 if we requested text */ 1930 CLIPX11FORMAT mTextFormat;1951 CLIPX11FORMAT mTextFormat; 1931 1952 /** The bitmap format we requested from X11 if we requested bitmap */ 1932 CLIPX11FORMAT mBitmapFormat;1953 CLIPX11FORMAT mBitmapFormat; 1933 1954 /** The HTML format we requested from X11 if we requested HTML */ 1934 CLIPX11FORMAT mHtmlFormat;1955 CLIPX11FORMAT mHtmlFormat; 1935 1956 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 1936 1957 /** The URI list format we requested from X11 if we requested URI lists. */ 1937 CLIPX11FORMAT mURIListFormat;1958 CLIPX11FORMAT mURIListFormat; 1938 1959 #endif 1939 1960 /** The clipboard context this request is associated with */ 1940 CLIPBACKEND *mCtx;1961 CLIPBACKEND *mpCtx; 1941 1962 /** The request structure passed in from the backend. */ 1942 CLIPREADCBREQ *mReq;1963 CLIPREADCBREQ *mpReq; 1943 1964 }; 1944 1965 … … 1955 1976 * the X11 clipboard contains a format we understand. 1956 1977 */ 1957 static void clipConvertX11CB(void *pClient, void *pvSrc, unsigned cbSrc) 1958 { 1959 CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *) pClient; 1960 1961 LogFlowFunc(("pReq->mFormat=%02X, pReq->mTextFormat=%u, " 1962 "pReq->mBitmapFormat=%u, pReq->mHtmlFormat=%u, pReq->mCtx=%p\n", 1963 pReq->mFormat, pReq->mTextFormat, pReq->mBitmapFormat, 1964 pReq->mHtmlFormat, pReq->mCtx)); 1965 1966 AssertPtr(pReq->mCtx); 1967 Assert(pReq->mFormat != 0); /* sanity */ 1978 static void clipConvertDataFromX11CallbackWorker(void *pClient, void *pvSrc, unsigned cbSrc) 1979 { 1980 CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pClient; 1981 1982 LogFlowFunc(("pReq->mFormat=%02X, pReq->mTextFormat=%u, pReq->mBitmapFormat=%u, pReq->mHtmlFormat=%u, pReq->mCtx=%p\n", 1983 pReq->mFormat, pReq->mTextFormat, pReq->mBitmapFormat, pReq->mHtmlFormat, pReq->mpCtx)); 1984 1985 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 1986 LogFlowFunc(("pReq->mURIListFormat=%u\n", pReq->mURIListFormat)); 1987 #endif 1988 1989 AssertPtr(pReq->mpCtx); 1990 Assert(pReq->mFormat != VBOX_SHCL_FMT_NONE); /* Sanity. */ 1968 1991 1969 1992 int rc = VINF_SUCCESS; 1970 1993 1971 void *pvDest = NULL;1972 uint32_t cbD est = 0;1994 void *pvDst = NULL; 1995 uint32_t cbDst = 0; 1973 1996 1974 1997 if (pvSrc == NULL) … … 1983 2006 { 1984 2007 case UTF8: 2008 RT_FALL_THROUGH(); 1985 2009 case TEXT: 1986 2010 { 1987 /* If we are given broken Utf-8, we treat it as Latin1. Is 1988 * this acceptable? */ 1989 if (RT_SUCCESS(RTStrValidateEncodingEx((char *)pvSrc, cbSrc, 1990 0))) 2011 /* If we are given broken UTF-8, we treat it as Latin1. */ /** @todo Is this acceptable? */ 2012 if (RT_SUCCESS(RTStrValidateEncodingEx((char *)pvSrc, cbSrc, 0))) 2013 { 1991 2014 rc = clipUtf8ToWinTxt((const char *)pvSrc, cbSrc, 1992 (PRTUTF16 *) &pvDest, &cbDest); 2015 (PRTUTF16 *)&pvDst, &cbDst); 2016 } 1993 2017 else 1994 rc = clipLatin1ToWinTxt((char *) pvSrc, cbSrc, 1995 (PRTUTF16 *) &pvDest, &cbDest); 2018 { 2019 rc = clipLatin1ToWinTxt((char *)pvSrc, cbSrc, 2020 (PRTUTF16 *)&pvDst, &cbDst); 2021 } 1996 2022 break; 1997 2023 } 2024 1998 2025 default: 2026 { 1999 2027 rc = VERR_INVALID_PARAMETER; 2028 break; 2029 } 2000 2030 } 2001 2031 } … … 2013 2043 if (RT_SUCCESS(rc)) 2014 2044 { 2015 pvD est = RTMemAlloc(cbDibSize);2016 if (!pvD est)2045 pvDst = RTMemAlloc(cbDibSize); 2046 if (!pvDst) 2017 2047 rc = VERR_NO_MEMORY; 2018 2048 else 2019 2049 { 2020 memcpy(pvD est, pDib, cbDibSize);2021 cbD est = cbDibSize;2050 memcpy(pvDst, pDib, cbDibSize); 2051 cbDst = cbDibSize; 2022 2052 } 2023 2053 } 2024 2054 break; 2025 2055 } 2056 2026 2057 default: 2058 { 2027 2059 rc = VERR_INVALID_PARAMETER; 2028 } 2029 } 2030 else if(pReq->mFormat == VBOX_SHCL_FMT_HTML) 2060 break; 2061 } 2062 } 2063 } 2064 else if (pReq->mFormat == VBOX_SHCL_FMT_HTML) 2031 2065 { 2032 2066 /* In which format is the clipboard data? */ … … 2035 2069 case HTML: 2036 2070 { 2037 /* The common VBox HTML encoding will be - Utf8 2038 * becuase it more general for HTML formats then UTF16 2039 * X11 clipboard returns UTF16, so before sending it we should 2040 * convert it to UTF8 2041 */ 2042 pvDest = NULL; 2043 cbDest = 0; 2044 /* Some applications sends data in utf16, some in itf8, 2071 /* 2072 * The common VBox HTML encoding will be - UTF-8 2073 * because it more general for HTML formats then UTF-16 2074 * X11 clipboard returns UTF-16, so before sending it we should 2075 * convert it to UTF-8. 2076 */ 2077 pvDst = NULL; 2078 cbDst = 0; 2079 2080 /* 2081 * Some applications sends data in UTF-16, some in UTF-8, 2045 2082 * without indication it in MIME. 2046 * But in case of utf16, at least an OpenOffice adds Byte Order Mark - 0xfeff2047 * at start of clipboard data 2083 * But in case of UTF-16, at least an OpenOffice adds Byte Order Mark - 0xfeff 2084 * at start of clipboard data. 2048 2085 */ 2049 2086 if ( cbSrc >= sizeof(RTUTF16) … … 2051 2088 { 2052 2089 LogFlowFunc((" \n")); 2053 rc = clipUTF16ToWinHTML((RTUTF16 *)pvSrc, cbSrc,2054 (char**)&pvDest, &cbDest);2090 rc = clipUTF16ToWinHTML((RTUTF16 *)pvSrc, cbSrc, 2091 (char**)&pvDst, &cbDst); 2055 2092 } 2056 2093 else 2057 2094 { 2058 pvD est = RTMemAlloc(cbSrc);2059 if(pvD est)2095 pvDst = RTMemAlloc(cbSrc); 2096 if(pvDst) 2060 2097 { 2061 memcpy(pvD est, pvSrc, cbSrc);2062 cbD est = cbSrc;2098 memcpy(pvDst, pvSrc, cbSrc); 2099 cbDst = cbSrc; 2063 2100 } 2064 2101 else … … 2070 2107 2071 2108 LogFlowFunc(("Source unicode %ls, cbSrc = %d\n, Byte Order Mark = %hx", pvSrc, cbSrc, ((PRTUTF16)pvSrc)[0])); 2072 LogFlowFunc(("converted to win unicode %s, cbDest = %d, rc = %Rrc\n", pvD est, cbDest, rc));2109 LogFlowFunc(("converted to win unicode %s, cbDest = %d, rc = %Rrc\n", pvDst, cbDst, rc)); 2073 2110 rc = VINF_SUCCESS; 2074 2111 break; 2075 2112 } 2113 2076 2114 default: 2077 2115 { 2078 2116 rc = VERR_INVALID_PARAMETER; 2117 break; 2079 2118 } 2080 2119 } 2081 2120 } 2121 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 2122 else if (pReq->mFormat == VBOX_SHCL_FMT_URI_LIST) 2123 { 2124 /* In which format is the clipboard data? */ 2125 switch (clipRealFormatForX11Format(pReq->mURIListFormat)) 2126 { 2127 case URI_LIST: 2128 { 2129 /* For URI lists we only accept valid UTF-8 encodings. */ 2130 if (RT_SUCCESS(RTStrValidateEncodingEx((char *)pvSrc, cbSrc, 0))) 2131 { 2132 /* URI lists on X are string separated with "\r\n". */ 2133 RTCList<RTCString> lstRootEntries = RTCString((char *)pvSrc, cbSrc - 1).split("\r\n"); 2134 for (size_t i = 0; i < lstRootEntries.size(); ++i) 2135 { 2136 const char *pcszEntry = lstRootEntries.at(i).c_str(); 2137 AssertPtrBreakStmt(pcszEntry, VERR_INVALID_POINTER); 2138 2139 rc = RTStrAAppend((char **)&pvDst, pcszEntry); 2140 AssertRCBreakStmt(rc, VERR_NO_MEMORY); 2141 cbDst += (uint32_t)strlen(pcszEntry); 2142 2143 rc = RTStrAAppend((char **)&pvDst, "\r\n"); 2144 AssertRCBreakStmt(rc, VERR_NO_MEMORY); 2145 cbDst += (uint32_t)strlen("\r\n"); 2146 } 2147 2148 if (cbDst) 2149 cbDst++; /* Include final (zero) termination. */ 2150 2151 LogFlowFunc(("URI list: cbDst=%RU32\n", cbDst)); 2152 } 2153 else 2154 rc = VERR_INVALID_PARAMETER; 2155 break; 2156 } 2157 2158 default: 2159 { 2160 rc = VERR_INVALID_PARAMETER; 2161 break; 2162 } 2163 } 2164 } 2165 #endif 2082 2166 else 2083 rc = VERR_NOT_ IMPLEMENTED;2084 2085 ClipRequestFromX11CompleteCallback(pReq->m Ctx->pFrontend, rc, pReq->mReq,2086 pvD est, cbDest);2087 RTMemFree(pvD est);2167 rc = VERR_NOT_SUPPORTED; 2168 2169 ClipRequestFromX11CompleteCallback(pReq->mpCtx->pFrontend, rc, pReq->mpReq, 2170 pvDst, cbDst); 2171 RTMemFree(pvDst); 2088 2172 RTMemFree(pReq); 2089 2173 … … 2099 2183 * Converts full BMP data to DIB format. 2100 2184 * 2101 * @note X11 backend code, callback for XtGetSelectionValue , for use when2185 * @note X11 backend code, callback for XtGetSelectionValue(), for use when 2102 2186 * the X11 clipboard contains a format we understand. 2103 2187 */ 2104 static void c bConvertX11CB(Widget widget, XtPointer pClient,2105 Atom * /* selection */, Atom *atomType,2106 XtPointer pvSrc, long unsigned int *pcLen,2107 int *piFormat)2188 static void clipConvertDataFromX11Callback(Widget widget, XtPointer pClient, 2189 Atom * /* selection */, Atom *atomType, 2190 XtPointer pvSrc, long unsigned int *pcLen, 2191 int *piFormat) 2108 2192 { 2109 2193 RT_NOREF(widget); 2110 2194 if (*atomType == XT_CONVERT_FAIL) /* Xt timeout */ 2111 clipConvert X11CB(pClient, NULL, 0);2195 clipConvertDataFromX11CallbackWorker(pClient, NULL, 0); 2112 2196 else 2113 clipConvert X11CB(pClient, pvSrc, (*pcLen) * (*piFormat) / 8);2197 clipConvertDataFromX11CallbackWorker(pClient, pvSrc, (*pcLen) * (*piFormat) / 8); 2114 2198 2115 2199 XtFree((char *)pvSrc); … … 2118 2202 2119 2203 #ifdef TESTCASE 2120 static void t estRequestData(CLIPBACKEND* pCtx, CLIPX11FORMAT target,2121 void *closure);2204 static void tstClipRequestData(CLIPBACKEND* pCtx, CLIPX11FORMAT target, 2205 void *closure); 2122 2206 #endif 2123 2207 2124 static int getSelectionValue(CLIPBACKEND *pCtx, CLIPX11FORMAT format,2125 CLIPREADX11CBREQ *pReq)2208 static int clipGetSelectionValue(CLIPBACKEND *pCtx, CLIPX11FORMAT format, 2209 CLIPREADX11CBREQ *pReq) 2126 2210 { 2127 2211 #ifndef TESTCASE 2128 2212 XtGetSelectionValue(pCtx->widget, clipGetAtom(pCtx, "CLIPBOARD"), 2129 2213 clipAtomForX11Format(pCtx, format), 2130 c bConvertX11CB,2214 clipConvertDataFromX11Callback, 2131 2215 reinterpret_cast<XtPointer>(pReq), 2132 2216 CurrentTime); 2133 2217 #else 2134 t estRequestData(pCtx, format, (void *)pReq);2218 tstClipRequestData(pCtx, format, (void *)pReq); 2135 2219 #endif 2136 2220 … … 2141 2225 * Worker function for ClipRequestDataFromX11 which runs on the event thread. 2142 2226 */ 2143 static void vboxClipboardReadX11Worker(void *pUserData, 2144 void * /* interval */) 2145 { 2146 AssertPtrReturnVoid(pUserData); 2147 2148 CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pUserData; 2149 CLIPBACKEND *pCtx = pReq->mCtx; 2227 static void clipReadX11Worker(void *pvUserData, void * /* interval */) 2228 { 2229 AssertPtrReturnVoid(pvUserData); 2230 2231 CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pvUserData; 2232 CLIPBACKEND *pCtx = pReq->mpCtx; 2150 2233 2151 2234 LogFlowFunc(("pReq->mFormat = %02X\n", pReq->mFormat)); … … 2159 2242 { 2160 2243 /* Send out a request for the data to the current clipboard owner. */ 2161 rc = getSelectionValue(pCtx, pCtx->X11TextFormat, pReq);2244 rc = clipGetSelectionValue(pCtx, pCtx->X11TextFormat, pReq); 2162 2245 } 2163 2246 } … … 2168 2251 { 2169 2252 /* Send out a request for the data to the current clipboard owner. */ 2170 rc = getSelectionValue(pCtx, pCtx->X11BitmapFormat, pReq);2253 rc = clipGetSelectionValue(pCtx, pCtx->X11BitmapFormat, pReq); 2171 2254 } 2172 2255 } … … 2177 2260 { 2178 2261 /* Send out a request for the data to the current clipboard owner. */ 2179 rc = getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq);2262 rc = clipGetSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq); 2180 2263 } 2181 2264 } … … 2187 2270 { 2188 2271 /* Send out a request for the data to the current clipboard owner. */ 2189 rc = getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq);2272 rc = clipGetSelectionValue(pCtx, pCtx->X11URIListFormat, pReq); 2190 2273 } 2191 2274 } … … 2200 2283 /* The clipboard callback was never scheduled, so we must signal 2201 2284 * that the request processing is finished and clean up ourselves. */ 2202 ClipRequestFromX11CompleteCallback(pReq->m Ctx->pFrontend, rc, pReq->mReq,2203 NULL , 0);2285 ClipRequestFromX11CompleteCallback(pReq->mpCtx->pFrontend, rc, pReq->mpReq, 2286 NULL /* pv */ ,0 /* cb */); 2204 2287 RTMemFree(pReq); 2205 2288 } … … 2234 2317 { 2235 2318 pX11Req->mFormat = u32Format; 2236 pX11Req->m Ctx= pCtx;2237 pX11Req->m Req= pReq;2319 pX11Req->mpCtx = pCtx; 2320 pX11Req->mpReq = pReq; 2238 2321 2239 2322 /* We use this to schedule a worker function on the event thread. */ 2240 clipQueueToEventThread(pCtx, vboxClipboardReadX11Worker, (XtPointer)pX11Req);2323 rc = clipQueueToEventThread(pCtx, clipReadX11Worker, (XtPointer)pX11Req); 2241 2324 } 2242 2325 else 2243 2326 rc = VERR_NO_MEMORY; 2244 2327 2328 LogFlowFuncLeaveRC(rc); 2245 2329 return rc; 2246 2330 } … … 2261 2345 /* For the purpose of the test case, we just execute the procedure to be 2262 2346 * scheduled, as we are running single threaded. */ 2263 void t estQueueToEventThread(void (*proc)(void *, void *),2264 void *client_data)2347 void tstClipQueueToEventThread(void (*proc)(void *, void *), 2348 void *client_data) 2265 2349 { 2266 2350 proc(client_data, NULL); … … 2268 2352 2269 2353 void XtFree(char *ptr) 2270 { RTMemFree((void *) ptr); } 2271 2272 /* The data in the simulated VBox clipboard */ 2273 static int g_vboxDataRC = VINF_SUCCESS; 2274 static void *g_vboxDatapv = NULL; 2275 static uint32_t g_vboxDatacb = 0; 2354 { 2355 RTMemFree((void *)ptr); 2356 } 2357 2358 /* The data in the simulated VBox clipboard. */ 2359 static int g_tstVBoxDataRC = VINF_SUCCESS; 2360 static void *g_tstVBoxDataPv = NULL; 2361 static uint32_t g_tstVBoxDataCb = 0; 2276 2362 2277 2363 /* Set empty data in the simulated VBox clipboard. */ 2278 static void clipEmptyVBox(CLIPBACKEND *pCtx, int retval)2279 { 2280 g_ vboxDataRC = retval;2281 RTMemFree(g_ vboxDatapv);2282 g_ vboxDatapv = NULL;2283 g_ vboxDatacb = 0;2364 static void tstClipEmptyVBox(CLIPBACKEND *pCtx, int retval) 2365 { 2366 g_tstVBoxDataRC = retval; 2367 RTMemFree(g_tstVBoxDataPv); 2368 g_tstVBoxDataPv = NULL; 2369 g_tstVBoxDataCb = 0; 2284 2370 ClipAnnounceFormatToX11(pCtx, 0); 2285 2371 } 2286 2372 2287 2373 /* Set the data in the simulated VBox clipboard. */ 2288 static int clipSetVBoxUtf16(CLIPBACKEND *pCtx, int retval,2289 const char *pcszData, size_t cb)2374 static int tstClipSetVBoxUtf16(CLIPBACKEND *pCtx, int retval, 2375 const char *pcszData, size_t cb) 2290 2376 { 2291 2377 PRTUTF16 pwszData = NULL; … … 2299 2385 if (pv == NULL) 2300 2386 return VERR_NO_MEMORY; 2301 if (g_vboxDatapv) 2302 RTMemFree(g_vboxDatapv); 2303 g_vboxDataRC = retval; 2304 g_vboxDatapv = pv; 2305 g_vboxDatacb = cb; 2306 ClipAnnounceFormatToX11(pCtx, 2307 VBOX_SHCL_FMT_UNICODETEXT); 2387 if (g_tstVBoxDataPv) 2388 RTMemFree(g_tstVBoxDataPv); 2389 g_tstVBoxDataRC = retval; 2390 g_tstVBoxDataPv = pv; 2391 g_tstVBoxDataCb = cb; 2392 ClipAnnounceFormatToX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT); 2308 2393 return VINF_SUCCESS; 2309 2394 } … … 2313 2398 { 2314 2399 RT_NOREF(pCtx, u32Format); 2315 *pcb = g_ vboxDatacb;2316 if (g_ vboxDatapv != NULL)2317 { 2318 void *pv = RTMemDup(g_ vboxDatapv, g_vboxDatacb);2400 *pcb = g_tstVBoxDataCb; 2401 if (g_tstVBoxDataPv != NULL) 2402 { 2403 void *pv = RTMemDup(g_tstVBoxDataPv, g_tstVBoxDataCb); 2319 2404 *ppv = pv; 2320 return pv != NULL ? g_ vboxDataRC : VERR_NO_MEMORY;2405 return pv != NULL ? g_tstVBoxDataRC : VERR_NO_MEMORY; 2321 2406 } 2322 2407 *ppv = NULL; 2323 return g_vboxDataRC; 2324 } 2325 2326 Display *XtDisplay(Widget w) 2327 { NOREF(w); return (Display *) 0xffff; } 2408 return g_tstVBoxDataRC; 2409 } 2410 2411 Display *XtDisplay(Widget w) { NOREF(w); return (Display *) 0xffff; } 2328 2412 2329 2413 void XtAppSetExitFlag(XtAppContext app_context) { NOREF(app_context); } … … 2368 2452 2369 2453 /* Atoms we need other than the formats we support. */ 2370 static const char *g_ apszSupAtoms[] =2454 static const char *g_tstapszSupAtoms[] = 2371 2455 { 2372 2456 "PRIMARY", "CLIPBOARD", "TARGETS", "MULTIPLE", "TIMESTAMP" … … 2381 2465 if (!strcmp(pcsz, g_aFormats[i].pcszAtom)) 2382 2466 atom = (Atom) (i + 0x1000); 2383 for (unsigned i = 0; i < RT_ELEMENTS(g_ apszSupAtoms); ++i)2384 if (!strcmp(pcsz, g_ apszSupAtoms[i]))2467 for (unsigned i = 0; i < RT_ELEMENTS(g_tstapszSupAtoms); ++i) 2468 if (!strcmp(pcsz, g_tstapszSupAtoms[i])) 2385 2469 atom = (Atom) (i + 0x2000); 2386 2470 Assert(atom); /* Have we missed any atoms? */ … … 2392 2476 static size_t g_cTargets = 0; 2393 2477 2394 void t estRequestTargets(CLIPBACKEND* pCtx)2478 void tstRequestTargets(CLIPBACKEND* pCtx) 2395 2479 { 2396 2480 clipUpdateX11Targets(pCtx, g_selTargets, g_cTargets); … … 2404 2488 static int g_selFormat = 0; 2405 2489 2406 void t estRequestData(CLIPBACKEND *pCtx, CLIPX11FORMAT target, void *closure)2490 void tstClipRequestData(CLIPBACKEND *pCtx, CLIPX11FORMAT target, void *closure) 2407 2491 { 2408 2492 RT_NOREF(pCtx); … … 2411 2495 if (target != g_selTargets[0]) 2412 2496 { 2413 clipConvert X11CB(closure, NULL, 0); /* Could not convert to target. */2497 clipConvertDataFromX11CallbackWorker(closure, NULL, 0); /* Could not convert to target. */ 2414 2498 return; 2415 2499 } … … 2423 2507 format = 0; 2424 2508 } 2425 clipConvert X11CB(closure, pValue, count * format / 8);2509 clipConvertDataFromX11CallbackWorker(closure, pValue, count * format / 8); 2426 2510 if (pValue) 2427 2511 RTMemFree(pValue); … … 2437 2521 } 2438 2522 2439 static uint32_t clipQueryFormats()2523 static uint32_t tstClipQueryFormats(void) 2440 2524 { 2441 2525 return g_fX11Formats; 2442 2526 } 2443 2527 2444 static void clipInvalidateFormats()2528 static void tstClipInvalidateFormats(void) 2445 2529 { 2446 2530 g_fX11Formats = ~0; … … 2482 2566 2483 2567 /* Request the shared clipboard to convert its data to a given format. */ 2484 static bool clipConvertSelection(const char *pcszTarget, Atom *type,2485 XtPointer *value, unsigned long *length,2486 int *format)2568 static bool tstClipConvertSelection(const char *pcszTarget, Atom *type, 2569 XtPointer *value, unsigned long *length, 2570 int *format) 2487 2571 { 2488 2572 Atom target = XInternAtom(NULL, pcszTarget, 0); … … 2508 2592 2509 2593 /* Set the current X selection data */ 2510 static void clipSetSelectionValues(const char *pcszTarget, Atom type,2511 const void *data,2512 unsigned long count, int format)2594 static void tstClipSetSelectionValues(const char *pcszTarget, Atom type, 2595 const void *data, 2596 unsigned long count, int format) 2513 2597 { 2514 2598 Atom clipAtom = XInternAtom(NULL, "CLIPBOARD", 0); … … 2524 2608 } 2525 2609 2526 static void clipSendTargetUpdate(CLIPBACKEND *pCtx)2527 { 2528 clipQueryX11 CBFormats(pCtx);2529 } 2530 2531 /* Configure if and how the X11 TARGETS clipboard target will fail */2532 static void clipSetTargetsFailure(void)2610 static void tstClipSendTargetUpdate(CLIPBACKEND *pCtx) 2611 { 2612 clipQueryX11FormatsCallback(pCtx); 2613 } 2614 2615 /* Configure if and how the X11 TARGETS clipboard target will fail. */ 2616 static void tstClipSetTargetsFailure(void) 2533 2617 { 2534 2618 g_cTargets = 0; … … 2553 2637 { 2554 2638 unsigned index = atom - 0x2000; 2555 AssertReturn(index < RT_ELEMENTS(g_ apszSupAtoms), NULL);2556 pcszName = g_ apszSupAtoms[index];2639 AssertReturn(index < RT_ELEMENTS(g_tstapszSupAtoms), NULL); 2640 pcszName = g_tstapszSupAtoms[index]; 2557 2641 } 2558 2642 return (char *)RTMemDup(pcszName, sizeof(pcszName) + 1); … … 2594 2678 } 2595 2679 2596 static void clipGetCompletedRequest(int *prc, char ** ppc, uint32_t *pcb, CLIPREADCBREQ **ppReq)2680 static void tstClipGetCompletedRequest(int *prc, char ** ppc, uint32_t *pcb, CLIPREADCBREQ **ppReq) 2597 2681 { 2598 2682 *prc = g_completedRC; … … 2620 2704 #endif 2621 2705 2622 static void t estStringFromX11(RTTEST hTest, CLIPBACKEND *pCtx,2623 2706 static void tstStringFromX11(RTTEST hTest, CLIPBACKEND *pCtx, 2707 const char *pcszExp, int rcExp) 2624 2708 { 2625 2709 bool retval = true; 2626 clipSendTargetUpdate(pCtx);2627 if ( clipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)2710 tstClipSendTargetUpdate(pCtx); 2711 if (tstClipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT) 2628 2712 RTTestFailed(hTest, "Wrong targets reported: %02X\n", 2629 clipQueryFormats());2713 tstClipQueryFormats()); 2630 2714 else 2631 2715 { … … 2635 2719 int rc = VINF_SUCCESS; 2636 2720 uint32_t cbActual = 0; 2637 clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);2721 tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet); 2638 2722 if (rc != rcExp) 2639 2723 RTTestFailed(hTest, "Wrong return code, expected %Rrc, got %Rrc\n", … … 2677 2761 } 2678 2762 2679 static void t estLatin1FromX11(RTTEST hTest, CLIPBACKEND *pCtx,2680 2763 static void tstLatin1FromX11(RTTEST hTest, CLIPBACKEND *pCtx, 2764 const char *pcszExp, int rcExp) 2681 2765 { 2682 2766 bool retval = false; 2683 clipSendTargetUpdate(pCtx);2684 if ( clipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)2767 tstClipSendTargetUpdate(pCtx); 2768 if (tstClipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT) 2685 2769 RTTestFailed(hTest, "Wrong targets reported: %02X\n", 2686 clipQueryFormats());2770 tstClipQueryFormats()); 2687 2771 else 2688 2772 { … … 2692 2776 int rc = VINF_SUCCESS; 2693 2777 uint32_t cbActual = 0; 2694 clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);2778 tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet); 2695 2779 if (rc != rcExp) 2696 2780 RTTestFailed(hTest, "Wrong return code, expected %Rrc, got %Rrc\n", … … 2730 2814 } 2731 2815 2732 static void t estStringFromVBox(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget, Atom typeExp, const char *valueExp)2816 static void tstStringFromVBox(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget, Atom typeExp, const char *valueExp) 2733 2817 { 2734 2818 RT_NOREF(pCtx); … … 2739 2823 int format; 2740 2824 size_t lenExp = strlen(valueExp); 2741 if ( clipConvertSelection(pcszTarget, &type, &value, &length, &format))2825 if (tstClipConvertSelection(pcszTarget, &type, &value, &length, &format)) 2742 2826 { 2743 2827 if ( type != typeExp … … 2762 2846 } 2763 2847 2764 static void t estNoX11(CLIPBACKEND *pCtx, const char *pcszTestCtx)2848 static void tstNoX11(CLIPBACKEND *pCtx, const char *pcszTestCtx) 2765 2849 { 2766 2850 CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq; … … 2769 2853 } 2770 2854 2771 static void t estStringFromVBoxFailed(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget)2855 static void tstStringFromVBoxFailed(RTTEST hTest, CLIPBACKEND *pCtx, const char *pcszTarget) 2772 2856 { 2773 2857 RT_NOREF(pCtx); … … 2776 2860 unsigned long length; 2777 2861 int format; 2778 RTTEST_CHECK_MSG(hTest, ! clipConvertSelection(pcszTarget, &type, &value,2779 &length, &format),2862 RTTEST_CHECK_MSG(hTest, !tstClipConvertSelection(pcszTarget, &type, &value, 2863 &length, &format), 2780 2864 (hTest, "Conversion to target %s, should have failed but didn't, returned type %d, length %u, format %d, value \"%.*s\"\n", 2781 2865 pcszTarget, type, length, format, RT_MIN(length, 20), … … 2784 2868 } 2785 2869 2786 static void t estNoSelectionOwnership(CLIPBACKEND *pCtx, const char *pcszTestCtx)2870 static void tstNoSelectionOwnership(CLIPBACKEND *pCtx, const char *pcszTestCtx) 2787 2871 { 2788 2872 RT_NOREF(pCtx); … … 2790 2874 } 2791 2875 2792 static void t estBadFormatRequestFromHost(RTTEST hTest, CLIPBACKEND *pCtx)2793 { 2794 clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",2876 static void tstBadFormatRequestFromHost(RTTEST hTest, CLIPBACKEND *pCtx) 2877 { 2878 tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", 2795 2879 sizeof("hello world"), 8); 2796 clipSendTargetUpdate(pCtx);2797 if ( clipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT)2880 tstClipSendTargetUpdate(pCtx); 2881 if (tstClipQueryFormats() != VBOX_SHCL_FMT_UNICODETEXT) 2798 2882 RTTestFailed(hTest, "Wrong targets reported: %02X\n", 2799 clipQueryFormats());2883 tstClipQueryFormats()); 2800 2884 else 2801 2885 { … … 2805 2889 int rc = VINF_SUCCESS; 2806 2890 uint32_t cbActual = 0; 2807 clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);2891 tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet); 2808 2892 if (rc != VERR_NOT_IMPLEMENTED) 2809 2893 RTTestFailed(hTest, "Wrong return code, expected VERR_NOT_IMPLEMENTED, got %Rrc\n", 2810 2894 rc); 2811 clipSetSelectionValues("", XA_STRING, "", sizeof(""), 8);2812 clipSendTargetUpdate(pCtx);2813 if ( clipQueryFormats() == VBOX_SHCL_FMT_UNICODETEXT)2895 tstClipSetSelectionValues("", XA_STRING, "", sizeof(""), 8); 2896 tstClipSendTargetUpdate(pCtx); 2897 if (tstClipQueryFormats() == VBOX_SHCL_FMT_UNICODETEXT) 2814 2898 RTTestFailed(hTest, "Failed to report targets after bad host request.\n"); 2815 2899 } … … 2837 2921 AssertRCReturn(rc, 1); 2838 2922 2839 /*** U tf-8 from X11 ***/2840 RTTestSub(hTest, "reading U tf-8 from X11");2923 /*** UTF-8 from X11 ***/ 2924 RTTestSub(hTest, "reading UTF-8 from X11"); 2841 2925 /* Simple test */ 2842 clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",2843 sizeof("hello world"), 8);2844 t estStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);2926 tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", 2927 sizeof("hello world"), 8); 2928 tstStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS); 2845 2929 /* With an embedded carriage return */ 2846 clipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,2847 "hello\nworld", sizeof("hello\nworld"), 8);2848 t estStringFromX11(hTest, pCtx, "hello\r\nworld", VINF_SUCCESS);2930 tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING, 2931 "hello\nworld", sizeof("hello\nworld"), 8); 2932 tstStringFromX11(hTest, pCtx, "hello\r\nworld", VINF_SUCCESS); 2849 2933 /* With an embedded CRLF */ 2850 clipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,2851 "hello\r\nworld", sizeof("hello\r\nworld"), 8);2852 t estStringFromX11(hTest, pCtx, "hello\r\r\nworld", VINF_SUCCESS);2934 tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING, 2935 "hello\r\nworld", sizeof("hello\r\nworld"), 8); 2936 tstStringFromX11(hTest, pCtx, "hello\r\r\nworld", VINF_SUCCESS); 2853 2937 /* With an embedded LFCR */ 2854 clipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING,2855 "hello\n\rworld", sizeof("hello\n\rworld"), 8);2856 t estStringFromX11(hTest, pCtx, "hello\r\n\rworld", VINF_SUCCESS);2938 tstClipSetSelectionValues("text/plain;charset=UTF-8", XA_STRING, 2939 "hello\n\rworld", sizeof("hello\n\rworld"), 8); 2940 tstStringFromX11(hTest, pCtx, "hello\r\n\rworld", VINF_SUCCESS); 2857 2941 /* An empty string */ 2858 clipSetSelectionValues("text/plain;charset=utf-8", XA_STRING, "",2859 sizeof(""), 8);2860 t estStringFromX11(hTest, pCtx, "", VINF_SUCCESS);2861 /* With an embedded U tf-8 character. */2862 clipSetSelectionValues("STRING", XA_STRING,2863 "100\xE2\x82\xAC" /* 100 Euro */,2864 sizeof("100\xE2\x82\xAC"), 8);2865 t estStringFromX11(hTest, pCtx, "100\xE2\x82\xAC", VINF_SUCCESS);2942 tstClipSetSelectionValues("text/plain;charset=utf-8", XA_STRING, "", 2943 sizeof(""), 8); 2944 tstStringFromX11(hTest, pCtx, "", VINF_SUCCESS); 2945 /* With an embedded UTF-8 character. */ 2946 tstClipSetSelectionValues("STRING", XA_STRING, 2947 "100\xE2\x82\xAC" /* 100 Euro */, 2948 sizeof("100\xE2\x82\xAC"), 8); 2949 tstStringFromX11(hTest, pCtx, "100\xE2\x82\xAC", VINF_SUCCESS); 2866 2950 /* A non-zero-terminated string */ 2867 clipSetSelectionValues("TEXT", XA_STRING,2868 "hello world", sizeof("hello world") - 1, 8);2869 t estStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS);2951 tstClipSetSelectionValues("TEXT", XA_STRING, 2952 "hello world", sizeof("hello world") - 1, 8); 2953 tstStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS); 2870 2954 2871 2955 /*** Latin1 from X11 ***/ 2872 2956 RTTestSub(hTest, "reading Latin1 from X11"); 2873 2957 /* Simple test */ 2874 clipSetSelectionValues("STRING", XA_STRING, "Georges Dupr\xEA",2875 sizeof("Georges Dupr\xEA"), 8);2876 t estLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA", VINF_SUCCESS);2958 tstClipSetSelectionValues("STRING", XA_STRING, "Georges Dupr\xEA", 2959 sizeof("Georges Dupr\xEA"), 8); 2960 tstLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA", VINF_SUCCESS); 2877 2961 /* With an embedded carriage return */ 2878 clipSetSelectionValues("TEXT", XA_STRING, "Georges\nDupr\xEA",2879 sizeof("Georges\nDupr\xEA"), 8);2880 t estLatin1FromX11(hTest, pCtx, "Georges\r\nDupr\xEA", VINF_SUCCESS);2962 tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\nDupr\xEA", 2963 sizeof("Georges\nDupr\xEA"), 8); 2964 tstLatin1FromX11(hTest, pCtx, "Georges\r\nDupr\xEA", VINF_SUCCESS); 2881 2965 /* With an embedded CRLF */ 2882 clipSetSelectionValues("TEXT", XA_STRING, "Georges\r\nDupr\xEA",2883 sizeof("Georges\r\nDupr\xEA"), 8);2884 t estLatin1FromX11(hTest, pCtx, "Georges\r\r\nDupr\xEA", VINF_SUCCESS);2966 tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\r\nDupr\xEA", 2967 sizeof("Georges\r\nDupr\xEA"), 8); 2968 tstLatin1FromX11(hTest, pCtx, "Georges\r\r\nDupr\xEA", VINF_SUCCESS); 2885 2969 /* With an embedded LFCR */ 2886 clipSetSelectionValues("TEXT", XA_STRING, "Georges\n\rDupr\xEA",2887 sizeof("Georges\n\rDupr\xEA"), 8);2888 t estLatin1FromX11(hTest, pCtx, "Georges\r\n\rDupr\xEA", VINF_SUCCESS);2970 tstClipSetSelectionValues("TEXT", XA_STRING, "Georges\n\rDupr\xEA", 2971 sizeof("Georges\n\rDupr\xEA"), 8); 2972 tstLatin1FromX11(hTest, pCtx, "Georges\r\n\rDupr\xEA", VINF_SUCCESS); 2889 2973 /* A non-zero-terminated string */ 2890 clipSetSelectionValues("text/plain", XA_STRING,2891 "Georges Dupr\xEA!",2892 sizeof("Georges Dupr\xEA!") - 1, 8);2893 t estLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS);2974 tstClipSetSelectionValues("text/plain", XA_STRING, 2975 "Georges Dupr\xEA!", 2976 sizeof("Georges Dupr\xEA!") - 1, 8); 2977 tstLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS); 2894 2978 2895 2979 /*** Unknown X11 format ***/ 2896 2980 RTTestSub(hTest, "handling of an unknown X11 format"); 2897 clipInvalidateFormats();2898 clipSetSelectionValues("CLIPBOARD", XA_STRING, "Test",2899 sizeof("Test"), 8);2900 clipSendTargetUpdate(pCtx);2901 RTTEST_CHECK_MSG(hTest, clipQueryFormats() == 0,2981 tstClipInvalidateFormats(); 2982 tstClipSetSelectionValues("CLIPBOARD", XA_STRING, "Test", 2983 sizeof("Test"), 8); 2984 tstClipSendTargetUpdate(pCtx); 2985 RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0, 2902 2986 (hTest, "Failed to send a format update notification\n")); 2903 2987 2904 2988 /*** Timeout from X11 ***/ 2905 2989 RTTestSub(hTest, "X11 timeout"); 2906 clipSetSelectionValues("UTF8_STRING", XT_CONVERT_FAIL, NULL,0, 8);2907 t estStringFromX11(hTest, pCtx, "", VERR_NO_DATA);2990 tstClipSetSelectionValues("UTF8_STRING", XT_CONVERT_FAIL, NULL,0, 8); 2991 tstStringFromX11(hTest, pCtx, "", VERR_NO_DATA); 2908 2992 2909 2993 /*** No data in X11 clipboard ***/ 2910 2994 RTTestSub(hTest, "a data request from an empty X11 clipboard"); 2911 clipSetSelectionValues("UTF8_STRING", XA_STRING, NULL,2912 0, 8);2995 tstClipSetSelectionValues("UTF8_STRING", XA_STRING, NULL, 2996 0, 8); 2913 2997 ClipRequestDataFromX11(pCtx, VBOX_SHCL_FMT_UNICODETEXT, pReq); 2914 clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);2998 tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet); 2915 2999 RTTEST_CHECK_MSG(hTest, rc == VERR_NO_DATA, 2916 3000 (hTest, "Returned %Rrc instead of VERR_NO_DATA\n", … … 2922 3006 /*** Ensure that VBox is notified when we return the CB to X11 ***/ 2923 3007 RTTestSub(hTest, "notification of switch to X11 clipboard"); 2924 clipInvalidateFormats();3008 tstClipInvalidateFormats(); 2925 3009 clipReportEmptyX11CB(pCtx); 2926 RTTEST_CHECK_MSG(hTest, clipQueryFormats() == 0,3010 RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0, 2927 3011 (hTest, "Failed to send a format update (release) notification\n")); 2928 3012 … … 2930 3014 RTTestSub(hTest, "a request for an invalid VBox format from X11"); 2931 3015 ClipRequestDataFromX11(pCtx, 0xffff, pReq); 2932 clipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet);3016 tstClipGetCompletedRequest(&rc, &pc, &cbActual, &pReqRet); 2933 3017 RTTEST_CHECK_MSG(hTest, rc == VERR_NOT_IMPLEMENTED, 2934 3018 (hTest, "Returned %Rrc instead of VERR_NOT_IMPLEMENTED\n", … … 2940 3024 /*** Targets failure from X11 ***/ 2941 3025 RTTestSub(hTest, "X11 targets conversion failure"); 2942 clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",2943 sizeof("hello world"), 8);2944 clipSetTargetsFailure();3026 tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", 3027 sizeof("hello world"), 8); 3028 tstClipSetTargetsFailure(); 2945 3029 Atom atom = XA_STRING; 2946 3030 long unsigned int cLen = 0; 2947 3031 int format = 8; 2948 clipConvertX11Targets (NULL, (XtPointer) pCtx, NULL, &atom, NULL, &cLen,3032 clipConvertX11TargetsCallback(NULL, (XtPointer) pCtx, NULL, &atom, NULL, &cLen, 2949 3033 &format); 2950 RTTEST_CHECK_MSG(hTest, clipQueryFormats() == 0,3034 RTTEST_CHECK_MSG(hTest, tstClipQueryFormats() == 0, 2951 3035 (hTest, "Wrong targets reported: %02X\n", 2952 clipQueryFormats()));3036 tstClipQueryFormats())); 2953 3037 2954 3038 /*** X11 text format conversion ***/ 2955 3039 RTTestSub(hTest, "handling of X11 selection targets"); 2956 RTTEST_CHECK_MSG(hTest, clipTestTextFormatConversion(pCtx),3040 RTTEST_CHECK_MSG(hTest, tstClipTextFormatConversion(pCtx), 2957 3041 (hTest, "failed to select the right X11 text formats\n")); 2958 3042 2959 /*** U tf-8 from VBox ***/2960 RTTestSub(hTest, "reading U tf-8 from VBox");3043 /*** UTF-8 from VBox ***/ 3044 RTTestSub(hTest, "reading UTF-8 from VBox"); 2961 3045 /* Simple test */ 2962 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",2963 sizeof("hello world") * 2);2964 t estStringFromVBox(hTest, pCtx, "UTF8_STRING",2965 3046 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world", 3047 sizeof("hello world") * 2); 3048 tstStringFromVBox(hTest, pCtx, "UTF8_STRING", 3049 clipGetAtom(pCtx, "UTF8_STRING"), "hello world"); 2966 3050 /* With an embedded carriage return */ 2967 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\nworld",2968 sizeof("hello\r\nworld") * 2);2969 t estStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",2970 2971 3051 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\nworld", 3052 sizeof("hello\r\nworld") * 2); 3053 tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8", 3054 clipGetAtom(pCtx, "text/plain;charset=UTF-8"), 3055 "hello\nworld"); 2972 3056 /* With an embedded CRCRLF */ 2973 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\r\nworld",2974 sizeof("hello\r\r\nworld") * 2);2975 t estStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",2976 2977 3057 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\r\nworld", 3058 sizeof("hello\r\r\nworld") * 2); 3059 tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8", 3060 clipGetAtom(pCtx, "text/plain;charset=UTF-8"), 3061 "hello\r\nworld"); 2978 3062 /* With an embedded CRLFCR */ 2979 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\n\rworld",2980 sizeof("hello\r\n\rworld") * 2);2981 t estStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8",2982 2983 3063 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello\r\n\rworld", 3064 sizeof("hello\r\n\rworld") * 2); 3065 tstStringFromVBox(hTest, pCtx, "text/plain;charset=UTF-8", 3066 clipGetAtom(pCtx, "text/plain;charset=UTF-8"), 3067 "hello\n\rworld"); 2984 3068 /* An empty string */ 2985 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);2986 t estStringFromVBox(hTest, pCtx, "text/plain;charset=utf-8",2987 2988 /* With an embedded U tf-8 character. */2989 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "100\xE2\x82\xAC" /* 100 Euro */,2990 10);2991 t estStringFromVBox(hTest, pCtx, "STRING",2992 3069 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2); 3070 tstStringFromVBox(hTest, pCtx, "text/plain;charset=utf-8", 3071 clipGetAtom(pCtx, "text/plain;charset=utf-8"), ""); 3072 /* With an embedded UTF-8 character. */ 3073 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "100\xE2\x82\xAC" /* 100 Euro */, 3074 10); 3075 tstStringFromVBox(hTest, pCtx, "STRING", 3076 clipGetAtom(pCtx, "STRING"), "100\xE2\x82\xAC"); 2993 3077 /* A non-zero-terminated string */ 2994 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",2995 sizeof("hello world") * 2 - 2);2996 t estStringFromVBox(hTest, pCtx, "TEXT", clipGetAtom(pCtx, "TEXT"),2997 3078 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world", 3079 sizeof("hello world") * 2 - 2); 3080 tstStringFromVBox(hTest, pCtx, "TEXT", clipGetAtom(pCtx, "TEXT"), 3081 "hello world"); 2998 3082 2999 3083 /*** Timeout from VBox ***/ 3000 3084 RTTestSub(hTest, "reading from VBox with timeout"); 3001 clipEmptyVBox(pCtx, VERR_TIMEOUT);3002 t estStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");3085 tstClipEmptyVBox(pCtx, VERR_TIMEOUT); 3086 tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING"); 3003 3087 3004 3088 /*** No data in VBox clipboard ***/ 3005 3089 RTTestSub(hTest, "an empty VBox clipboard"); 3006 clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);3007 clipEmptyVBox(pCtx, VINF_SUCCESS);3090 tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8); 3091 tstClipEmptyVBox(pCtx, VINF_SUCCESS); 3008 3092 RTTEST_CHECK_MSG(hTest, g_ownsSel, 3009 3093 (hTest, "VBox grabbed the clipboard with no data and we ignored it\n")); 3010 t estStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");3094 tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING"); 3011 3095 3012 3096 /*** An unknown VBox format ***/ 3013 3097 RTTestSub(hTest, "reading an unknown VBox format"); 3014 clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);3015 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2);3098 tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8); 3099 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2); 3016 3100 ClipAnnounceFormatToX11(pCtx, 0xa0000); 3017 3101 RTTEST_CHECK_MSG(hTest, g_ownsSel, 3018 3102 (hTest, "VBox grabbed the clipboard with unknown data and we ignored it\n")); 3019 t estStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING");3103 tstStringFromVBoxFailed(hTest, pCtx, "UTF8_STRING"); 3020 3104 3021 3105 /*** VBox requests a bad format ***/ 3022 3106 RTTestSub(hTest, "recovery from a bad format request"); 3023 t estBadFormatRequestFromHost(hTest, pCtx);3107 tstBadFormatRequestFromHost(hTest, pCtx); 3024 3108 3025 3109 rc = ClipStopX11(pCtx); … … 3036 3120 RTTestSub(hTest, "reading from X11, headless clipboard"); 3037 3121 /* Simple test */ 3038 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "",3039 sizeof("") * 2);3040 clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world",3041 sizeof("hello world"), 8);3042 t estNoX11(pCtx, "reading from X11, headless clipboard");3122 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 3123 sizeof("") * 2); 3124 tstClipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", 3125 sizeof("hello world"), 8); 3126 tstNoX11(pCtx, "reading from X11, headless clipboard"); 3043 3127 3044 3128 /*** Read from VBox ***/ 3045 3129 RTTestSub(hTest, "reading from VBox, headless clipboard"); 3046 3130 /* Simple test */ 3047 clipEmptyVBox(pCtx, VERR_WRONG_ORDER);3048 clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8);3049 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",3050 sizeof("hello world") * 2);3051 t estNoSelectionOwnership(pCtx, "reading from VBox, headless clipboard");3131 tstClipEmptyVBox(pCtx, VERR_WRONG_ORDER); 3132 tstClipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8); 3133 tstClipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world", 3134 sizeof("hello world") * 2); 3135 tstNoSelectionOwnership(pCtx, "reading from VBox, headless clipboard"); 3052 3136 3053 3137 rc = ClipStopX11(pCtx);
Note:
See TracChangeset
for help on using the changeset viewer.