Changeset 81699 in vbox for trunk/src/VBox
- Timestamp:
- Nov 6, 2019 10:54:35 AM (5 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp
r81460 r81699 2203 2203 AssertPtrReturn(pTransfer, 0); 2204 2204 2205 LogFlowFunc(("[Transfer %RU16] cRoots=%RU64\n", pTransfer->State.uID, pTransfer->cRoots)); 2205 2206 return (uint32_t)pTransfer->cRoots; 2206 2207 } … … 2498 2499 AssertPtrReturn(pTransfer, SHCLTRANSFERDIR_UNKNOWN); 2499 2500 2501 LogFlowFunc(("[Transfer %RU16] enmDir=%RU32\n", pTransfer->State.uID, pTransfer->State.enmDir)); 2500 2502 return pTransfer->State.enmDir; 2501 2503 } … … 2511 2513 AssertPtrReturn(pTransfer, SHCLSOURCE_INVALID); 2512 2514 2515 LogFlowFunc(("[Transfer %RU16] enmSource=%RU32\n", pTransfer->State.uID, pTransfer->State.enmSource)); 2513 2516 return pTransfer->State.enmSource; 2514 2517 } … … 2524 2527 AssertPtrReturn(pTransfer, SHCLTRANSFERSTATUS_NONE); 2525 2528 2529 LogFlowFunc(("[Transfer %RU16] enmStatus=%RU32\n", pTransfer->State.uID, pTransfer->State.enmStatus)); 2526 2530 return pTransfer->State.enmStatus; 2527 2531 } -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp
r81656 r81699 83 83 UTF8, 84 84 BMP, 85 HTML 85 HTML, 86 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 87 URI_LIST, 88 #endif 86 89 }; 87 90 … … 126 129 { "image/bmp", BMP, VBOX_SHCL_FMT_BITMAP }, 127 130 { "image/x-bmp", BMP, VBOX_SHCL_FMT_BITMAP }, 128 { "image/x-MS-bmp", BMP, VBOX_SHCL_FMT_BITMAP } 129 131 { "image/x-MS-bmp", BMP, VBOX_SHCL_FMT_BITMAP }, 130 132 /** @todo Inkscape exports image/png but not bmp... */ 133 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 134 { "text/uri-list", URI_LIST, VBOX_SHCL_FMT_URI_LIST }, 135 { "x-special/gnome-copied-files", URI_LIST, VBOX_SHCL_FMT_URI_LIST }, 136 { "x-special/nautilus-clipboard", URI_LIST, VBOX_SHCL_FMT_URI_LIST }, 137 { "application/x-kde-cutselection", URI_LIST, VBOX_SHCL_FMT_URI_LIST }, 138 /** @todo Anything else we need to add here? */ 139 /** @todo Add Wayland / Weston support. */ 140 #endif 131 141 }; 132 142 … … 236 246 * table */ 237 247 CLIPX11FORMAT X11HTMLFormat; 248 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 249 /** The best HTML format X11 has to offer, as an index into the formats 250 * table */ 251 CLIPX11FORMAT X11URIListFormat; 252 #endif 238 253 /** What formats does VBox have on offer? */ 239 254 uint32_t vboxFormats; … … 262 277 }; 263 278 264 /** The number of simultaneous instances we support. For all normal purposes 279 /** 280 * The number of simultaneous instances we support. For all normal purposes 265 281 * we should never need more than one. For the testcase it is convenient to 266 282 * have a second instance that the first can interact with in order to have 267 * a more controlled environment. */ 283 * a more controlled environment. 284 */ 268 285 enum { CLIP_MAX_CONTEXTS = 20 }; 269 286 270 /** Array of structures for mapping Xt widgets to context pointers. We 271 * need this because the widget clipboard callbacks do not pass user data. */ 287 /** 288 * Array of structures for mapping Xt widgets to context pointers. We 289 * need this because the widget clipboard callbacks do not pass user data. 290 */ 272 291 static struct 273 292 { … … 278 297 } g_contexts[CLIP_MAX_CONTEXTS]; 279 298 280 /** Registers a new X11 clipboard context. */ 299 /** 300 * Registers a new X11 clipboard context. 301 * 302 * @param pCtx The clipboard backend context to use. 303 */ 281 304 static int clipRegisterContext(CLIPBACKEND *pCtx) 282 305 { … … 302 325 } 303 326 304 /** Unregister an X11 clipboard context. */ 327 /** 328 * Unregister an X11 clipboard context. 329 * 330 * @param pCtx The clipboard backend context to use. 331 */ 305 332 static void clipUnregisterContext(CLIPBACKEND *pCtx) 306 333 { … … 340 367 } 341 368 342 /** Converts an atom name string to an X11 atom, looking it up in a cache 343 * before asking the server. */ 369 /** 370 * Converts an atom name string to an X11 atom, looking it up in a cache 371 * before asking the server. 372 */ 344 373 static Atom clipGetAtom(CLIPBACKEND *pCtx, const char *pszName) 345 374 { … … 358 387 #define WAKE_UP_STRING_LEN ( sizeof(WAKE_UP_STRING) - 1 ) 359 388 360 /** Schedule a function call to run on the Xt event thread by passing it to 389 /** 390 * Schedules a function call to run on the Xt event thread by passing it to 361 391 * the application context as a 0ms timeout and waking up the event loop by 362 * writing to the wakeup pipe which it monitors. */ 392 * writing to the wakeup pipe which it monitors. 393 */ 363 394 static int clipQueueToEventThread(CLIPBACKEND *pCtx, 364 395 void (*proc)(void *, void *), … … 385 416 /** 386 417 * Reports the formats currently supported by the X11 clipboard to VBox. 418 * 419 * @param pCtx The clipboard backend context to use. 387 420 */ 388 421 static void clipReportFormatsToVBox(CLIPBACKEND *pCtx) 389 422 { 390 uint32_t u32VBoxFormats = clipVBoxFormatForX11Format(pCtx->X11TextFormat); 391 u32VBoxFormats |= clipVBoxFormatForX11Format(pCtx->X11BitmapFormat); 392 u32VBoxFormats |= clipVBoxFormatForX11Format(pCtx->X11HTMLFormat); 393 LogFlowFunc(("clipReportFormatsToVBox format: %d\n", u32VBoxFormats)); 394 LogFlowFunc(("clipReportFormatsToVBox txt: %d, bitm: %d, html:%d, u32VBoxFormats: %d\n", 395 pCtx->X11TextFormat, pCtx->X11BitmapFormat, pCtx->X11HTMLFormat, 396 u32VBoxFormats )); 397 ClipReportX11FormatsCallback(pCtx->pFrontend, u32VBoxFormats); 423 uint32_t fFormats = clipVBoxFormatForX11Format(pCtx->X11TextFormat); 424 fFormats |= clipVBoxFormatForX11Format(pCtx->X11BitmapFormat); 425 fFormats |= clipVBoxFormatForX11Format(pCtx->X11HTMLFormat); 426 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 427 fFormats |= clipVBoxFormatForX11Format(pCtx->X11URIListFormat); 428 #endif 429 430 LogFlowFunc(("fFormats=0x%x\n", fFormats)); 431 LogFlowFunc(("txt: %u, bmp: %u, html: %u\n", 432 pCtx->X11TextFormat, pCtx->X11BitmapFormat, pCtx->X11HTMLFormat)); 433 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 434 LogFlowFunc(("uri list: %u\n", pCtx->X11URIListFormat)); 435 #endif 436 437 ClipReportX11FormatsCallback(pCtx->pFrontend, fFormats); 398 438 } 399 439 400 440 /** 401 441 * Forgets which formats were previously in the X11 clipboard. Called when we 402 * grab the clipboard. */ 442 * grab the clipboard. 443 * 444 * @param pCtx The clipboard backend context to use. 445 */ 403 446 static void clipResetX11Formats(CLIPBACKEND *pCtx) 404 447 { 405 pCtx->X11TextFormat = INVALID; 406 pCtx->X11BitmapFormat = INVALID; 407 pCtx->X11HTMLFormat = INVALID; 448 LogFlowFuncEnter(); 449 450 pCtx->X11TextFormat = INVALID; 451 pCtx->X11BitmapFormat = INVALID; 452 pCtx->X11HTMLFormat = INVALID; 453 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 454 pCtx->X11URIListFormat = INVALID; 455 #endif 408 456 } 409 457 … … 421 469 * 422 470 * @return Supported X clipboard format. 423 * @param pCtx The clipboard backend context structure.471 * @param pCtx The clipboard backend context to use. 424 472 * @param pTargets The list of targets. 425 473 * @param cTargets The size of the list in @a pTargets. … … 439 487 if (format != NIL_CLIPX11FORMAT) 440 488 { 441 if ( (clipVBoxFormatForX11Format(format) 442 == VBOX_SHCL_FMT_UNICODETEXT) 443 && enmBestTextTarget < clipRealFormatForX11Format(format)) 489 if ( (clipVBoxFormatForX11Format(format) == VBOX_SHCL_FMT_UNICODETEXT) 490 && enmBestTextTarget < clipRealFormatForX11Format(format)) 444 491 { 445 492 enmBestTextTarget = clipRealFormatForX11Format(format); … … 477 524 * 478 525 * @return Supported X clipboard format. 479 * @param pCtx The clipboard backend context structure.526 * @param pCtx The clipboard backend context to use. 480 527 * @param pTargets The list of targets. 481 528 * @param cTargets The size of the list in @a pTargets. … … 495 542 if (format != NIL_CLIPX11FORMAT) 496 543 { 497 if ( (clipVBoxFormatForX11Format(format) 498 == VBOX_SHCL_FMT_BITMAP) 499 && enmBestBitmapTarget < clipRealFormatForX11Format(format)) 544 if ( (clipVBoxFormatForX11Format(format) == VBOX_SHCL_FMT_BITMAP) 545 && enmBestBitmapTarget < clipRealFormatForX11Format(format)) 500 546 { 501 547 enmBestBitmapTarget = clipRealFormatForX11Format(format); … … 512 558 * 513 559 * @return Supported X clipboard format. 514 * @param pCtx The clipboard backend context structure.560 * @param pCtx The clipboard backend context to use. 515 561 * @param pTargets The list of targets. 516 562 * @param cTargets The size of the list in @a pTargets. … … 541 587 } 542 588 589 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 590 /** 591 * Goes through an array of X11 clipboard targets to see if they contain an URI list 592 * format we can support, and if so choose the ones we prefer. 593 * 594 * @return Supported X clipboard format. 595 * @param pCtx The clipboard backend context to use. 596 * @param pTargets The list of targets. 597 * @param cTargets The size of the list in @a pTargets. 598 */ 599 static CLIPX11FORMAT clipGetURIListFormatFromTargets(CLIPBACKEND *pCtx, 600 CLIPX11FORMAT *pTargets, 601 size_t cTargets) 602 { 603 AssertPtrReturn(pCtx, NIL_CLIPX11FORMAT); 604 AssertReturn(VALID_PTR(pTargets) || cTargets == 0, NIL_CLIPX11FORMAT); 605 606 CLIPX11FORMAT bestURIListFormat = NIL_CLIPX11FORMAT; 607 CLIPFORMAT enmBestURIListTarget = INVALID; 608 for (unsigned i = 0; i < cTargets; ++i) 609 { 610 CLIPX11FORMAT format = pTargets[i]; 611 if (format != NIL_CLIPX11FORMAT) 612 { 613 if ( (clipVBoxFormatForX11Format(format) == VBOX_SHCL_FMT_URI_LIST) 614 && enmBestURIListTarget < clipRealFormatForX11Format(format)) 615 { 616 enmBestURIListTarget = clipRealFormatForX11Format(format); 617 bestURIListFormat = format; 618 } 619 } 620 } 621 return bestURIListFormat; 622 } 623 #endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 543 624 544 625 /** … … 547 628 * better than plain text). 548 629 * 549 * @param pCtx The clipboard backend context structure.630 * @param pCtx The clipboard backend context to use. 550 631 * @param pTargets The list of targets. 551 632 * @param cTargets The size of the list in @a pTargets. … … 556 637 AssertPtrReturnVoid(pCtx); 557 638 AssertPtrReturnVoid(pTargets); 558 CLIPX11FORMAT bestTextFormat; 559 CLIPX11FORMAT bestBitmapFormat; 560 CLIPX11FORMAT bestHtmlFormat; 561 bestTextFormat = clipGetTextFormatFromTargets(pCtx, pTargets, cTargets); 639 640 CLIPX11FORMAT bestTextFormat = clipGetTextFormatFromTargets(pCtx, pTargets, cTargets); 562 641 if (pCtx->X11TextFormat != bestTextFormat) 563 {564 642 pCtx->X11TextFormat = bestTextFormat; 565 } 566 pCtx->X11BitmapFormat = INVALID; 567 bestBitmapFormat = clipGetBitmapFormatFromTargets(pCtx, pTargets, cTargets);643 644 pCtx->X11BitmapFormat = INVALID; /* not yet supported */ 645 CLIPX11FORMAT bestBitmapFormat = clipGetBitmapFormatFromTargets(pCtx, pTargets, cTargets); 568 646 if (pCtx->X11BitmapFormat != bestBitmapFormat) 569 {570 647 pCtx->X11BitmapFormat = bestBitmapFormat; 571 } 572 bestHtmlFormat = clipGetHtmlFormatFromTargets(pCtx, pTargets, cTargets); 573 if(pCtx->X11HTMLFormat != bestHtmlFormat) 574 { 648 649 CLIPX11FORMAT bestHtmlFormat = clipGetHtmlFormatFromTargets(pCtx, pTargets, cTargets); 650 if (pCtx->X11HTMLFormat != bestHtmlFormat) 575 651 pCtx->X11HTMLFormat = bestHtmlFormat; 576 } 652 653 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 654 CLIPX11FORMAT bestURIListFormat = clipGetURIListFormatFromTargets(pCtx, pTargets, cTargets); 655 if (pCtx->X11URIListFormat != bestURIListFormat) 656 pCtx->X11URIListFormat = bestURIListFormat; 657 #endif 577 658 } 578 659 … … 583 664 * based on an array of X11 atoms. 584 665 * 585 * @param pCtx The context to be updated.666 * @param pCtx The clipboard backend context to use. 586 667 * @param pTargets The array of atoms describing the targets supported. 587 668 * @param cTargets The size of the array @a pTargets. … … 614 695 * "targets" information obtained from the X11 clipboard. 615 696 * 616 * @note Callback for XtGetSelectionValue 697 * @note Callback for XtGetSelectionValue. 617 698 * @note This function is treated as API glue, and as such is not part of any 618 699 * unit test. So keep it simple, be paranoid and log everything. … … 626 707 627 708 CLIPBACKEND *pCtx = reinterpret_cast<CLIPBACKEND *>(pClient); 709 628 710 Atom *pAtoms = (Atom *)pValue; 629 711 unsigned i, j; … … 639 721 pFormats = (CLIPX11FORMAT *)RTMemAllocZ(*pcLen * sizeof(CLIPX11FORMAT)); 640 722 } 723 641 724 #if defined(DEBUG) && !defined(TESTCASE) 642 725 if (pValue) … … 653 736 } 654 737 #endif 738 655 739 if (pFormats) 656 740 { … … 685 769 /** 686 770 * Callback to notify us when the contents of the X11 clipboard change. 771 * 772 * @param pCtx The clipboard backend context to use. 687 773 */ 688 774 static void clipQueryX11CBFormats(CLIPBACKEND *pCtx) … … 729 815 * Waits until an event arrives and handle it if it is an XFIXES selection 730 816 * event, which Xt doesn't know about. 817 * 818 * @param pCtx The clipboard backend context to use. 731 819 */ 732 820 void clipPeekEventAndDoXFixesHandling(CLIPBACKEND *pCtx) … … 754 842 /** 755 843 * The main loop of our clipboard reader. 844 * 756 845 * @note X11 backend code. 757 846 */ … … 775 864 #endif 776 865 777 /** X11 specific uninitialisation for the shared clipboard. 866 /** 867 * X11 specific uninitialisation for the shared clipboard. 868 * 778 869 * @note X11 backend code. 870 * 871 * @param pCtx The clipboard backend context to use. 779 872 */ 780 873 static void clipUninit(CLIPBACKEND *pCtx) … … 817 910 818 911 #ifndef TESTCASE 819 /** Setup the XFixes library and load the XFixesSelectSelectionInput symbol */ 912 /** 913 * Sets up the XFixes library and load the XFixesSelectSelectionInput symbol. 914 */ 820 915 static int clipLoadXFixes(Display *pDisplay, CLIPBACKEND *pCtx) 821 916 { … … 841 936 { 842 937 if (pCtx->fixesEventBase >= 0) 938 { 843 939 rc = VINF_SUCCESS; 940 } 844 941 else 845 942 { 846 LogRel((" clipLoadXFixes: fixesEventBase is less than zero: %d\n", pCtx->fixesEventBase));943 LogRel(("Shared Clipboard: fixesEventBase is less than zero: %d\n", pCtx->fixesEventBase)); 847 944 rc = VERR_NOT_SUPPORTED; 848 945 } … … 850 947 else 851 948 { 852 LogRel((" clipLoadXFixes: XQueryExtension failed\n"));949 LogRel(("Shared Clipboard: XQueryExtension failed\n")); 853 950 rc = VERR_NOT_SUPPORTED; 854 951 } … … 856 953 else 857 954 { 858 LogRel((" clipLoadXFixes: Symbol XFixesSelectSelectionInput not found!\n"));955 LogRel(("Shared Clipboard: Symbol XFixesSelectSelectionInput not found!\n")); 859 956 rc = VERR_NOT_SUPPORTED; 860 957 } … … 862 959 else 863 960 { 864 LogRel((" clipLoadXFixes: libxFixes.so.* not found!\n"));961 LogRel(("Shared Clipboard: libxFixes.so.* not found!\n")); 865 962 rc = VERR_NOT_SUPPORTED; 866 963 } … … 869 966 #endif 870 967 871 /** This is the callback which is scheduled when data is available on the 872 * wakeup pipe. It simply reads all data from the pipe. */ 968 /** 969 * This is the callback which is scheduled when data is available on the 970 * wakeup pipe. It simply reads all data from the pipe. 971 */ 873 972 static void clipDrainWakeupPipe(XtPointer pUserData, int *, XtInputId *) 874 973 { … … 881 980 } 882 981 883 /** X11 specific initialisation for the shared clipboard. 982 /** 983 * X11 specific initialisation for the shared clipboard. 984 * 884 985 * @note X11 backend code. 986 * 987 * @returns VBox status code. 988 * @param pCtx The clipboard backend context to use. 885 989 */ 886 990 static int clipInit(CLIPBACKEND *pCtx) … … 892 996 Display *pDisplay; 893 997 894 /* Make sure we are thread safe */998 /* Make sure we are thread safe. */ 895 999 XtToolkitThreadInitialize(); 896 /* Set up the Clipboard application context and main window. We call all 1000 1001 /* 1002 * Set up the Clipboard application context and main window. We call all 897 1003 * these functions directly instead of calling XtOpenApplication() so 898 * that we can fail gracefully if we can't get an X11 display. */ 1004 * that we can fail gracefully if we can't get an X11 display. 1005 */ 899 1006 XtToolkitInitialize(); 900 1007 pCtx->appContext = XtCreateApplicationContext(); … … 932 1039 XtRealizeWidget(pCtx->widget); 933 1040 #ifndef TESTCASE 934 /* Enable clipboard update notification */1041 /* Enable clipboard update notification. */ 935 1042 pCtx->fixesSelectInput(pDisplay, XtWindow(pCtx->widget), 936 1043 clipGetAtom(pCtx, "CLIPBOARD"), … … 938 1045 #endif 939 1046 } 940 /* Create the pipes */ 1047 1048 /* 1049 * Create the pipes. 1050 */ 941 1051 int pipes[2]; 942 1052 if (!pipe(pipes)) … … 979 1089 * This is important for VBoxHeadless. 980 1090 */ 981 LogRel(("Shared Clipboard: X11 DISPLAY variable not set -- disabling shared clipboard\n"));1091 LogRel(("Shared Clipboard: X11 DISPLAY variable not set -- disabling clipboard sharing\n")); 982 1092 pCtx->fHaveX11 = false; 983 1093 return pCtx; … … 987 1097 988 1098 LogRel(("Shared Clipboard: Initializing X11 clipboard backend\n")); 1099 989 1100 if (pCtx) 990 1101 pCtx->pFrontend = pFrontend; … … 995 1106 * Destructs the shared clipboard X11 backend. 996 1107 * 997 * @note X11 backend code 1108 * @note X11 backend code. 1109 * 1110 * @param pCtx The clipboard backend context to use. 998 1111 */ 999 1112 void ClipDestructX11(CLIPBACKEND *pCtx) … … 1008 1121 1009 1122 /** 1010 * Announce to the X11 backend that we are ready to start. 1011 * @param grab whether we should try to grab the shared clipboard at once 1012 */ 1013 int ClipStartX11(CLIPBACKEND *pCtx, bool grab) 1123 * Announces to the X11 backend that we are ready to start. 1124 * 1125 * @returns VBox status code. 1126 * @param pCtx The clipboard backend context to use. 1127 * @param fGrab Whether we should try to grab the shared clipboard at once. 1128 */ 1129 int ClipStartX11(CLIPBACKEND *pCtx, bool fGrab) 1014 1130 { 1015 1131 int rc = VINF_SUCCESS; … … 1025 1141 { 1026 1142 clipResetX11Formats(pCtx); 1027 pCtx->fGrabClipboardOnStart = grab;1143 pCtx->fGrabClipboardOnStart = fGrab; 1028 1144 } 1029 1145 #ifndef TESTCASE … … 1043 1159 1044 1160 /** 1045 * Shut down the shared clipboard X11 backend. 1046 * @note X11 backend code 1161 * Shuts down the shared clipboard X11 backend. 1162 * 1163 * @note X11 backend code. 1047 1164 * @note Any requests from this object to get clipboard data from VBox 1048 1165 * *must* have completed or aborted before we are called, as 1049 1166 * otherwise the X11 event loop will still be waiting for the request 1050 1167 * to return and will not be able to terminate. 1168 * 1169 * @returns VBox status code. 1170 * @param pCtx The clipboard backend context to use. 1051 1171 */ 1052 1172 int ClipStopX11(CLIPBACKEND *pCtx) … … 1093 1213 * 1094 1214 * @returns VBox status code. 1215 * @param pCtx The clipboard backend context to use. 1095 1216 * @param atomTypeReturn The type of the data we are returning. 1096 1217 * @param pValReturn A pointer to the data we are returning. This … … 1142 1263 */ 1143 1264 static int clipReadVBoxShCl(CLIPBACKEND *pCtx, uint32_t u32Format, 1144 1265 void **ppv, uint32_t *pcb) 1145 1266 { 1146 1267 int rc = VINF_SUCCESS; … … 1336 1457 * Does this atom correspond to one of the two selection types we support? 1337 1458 * 1338 * @param widget A valid Xt widget.1459 * @param pCtx The clipboard backend context to use. 1339 1460 * @param selType The atom in question. 1340 1461 */ … … 1380 1501 void *pv = NULL; 1381 1502 uint32_t cb = 0; 1382 rc = clipReadVBoxShCl(pCtx, 1383 VBOX_SHCL_FMT_UNICODETEXT, 1384 &pv, &cb); 1503 rc = clipReadVBoxShCl(pCtx, VBOX_SHCL_FMT_UNICODETEXT, &pv, &cb); 1385 1504 if (RT_SUCCESS(rc) && (cb == 0)) 1386 1505 rc = VERR_NO_DATA; … … 1845 1964 /** The HTML format we requested from X11 if we requested HTML */ 1846 1965 CLIPX11FORMAT mHtmlFormat; 1966 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 1967 /** The URI list format we requested from X11 if we requested URI lists. */ 1968 CLIPX11FORMAT mURIListFormat; 1969 #endif 1847 1970 /** The clipboard context this request is associated with */ 1848 1971 CLIPBACKEND *mCtx; … … 2032 2155 #endif 2033 2156 2034 static voidgetSelectionValue(CLIPBACKEND *pCtx, CLIPX11FORMAT format,2035 2157 static int getSelectionValue(CLIPBACKEND *pCtx, CLIPX11FORMAT format, 2158 CLIPREADX11CBREQ *pReq) 2036 2159 { 2037 2160 #ifndef TESTCASE … … 2044 2167 testRequestData(pCtx, format, (void *)pReq); 2045 2168 #endif 2046 } 2047 2048 /** Worker function for ClipRequestDataFromX11 which runs on the event 2049 * thread. */ 2169 2170 return VINF_SUCCESS; /** @todo Return real rc. */ 2171 } 2172 2173 /** 2174 * Worker function for ClipRequestDataFromX11 which runs on the event thread. 2175 */ 2050 2176 static void vboxClipboardReadX11Worker(void *pUserData, 2051 2177 void * /* interval */) 2052 2178 { 2179 AssertPtrReturnVoid(pUserData); 2180 2053 2181 CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *)pUserData; 2054 CLIPBACKEND *pCtx = pReq->mCtx;2182 CLIPBACKEND *pCtx = pReq->mCtx; 2055 2183 2056 2184 LogFlowFunc(("pReq->mFormat = %02X\n", pReq->mFormat)); 2057 2185 2058 int rc = VINF_SUCCESS; 2186 int rc = VERR_NO_DATA; /* VBox thinks we have data and we don't. */ 2187 2059 2188 #ifndef VBOX_AFTER_5_2 2060 2189 bool fBusy = pCtx->fBusy; 2061 2190 pCtx->fBusy = true; 2062 2191 if (fBusy) 2192 { 2063 2193 /* If the clipboard is busy just fend off the request. */ 2064 2194 rc = VERR_TRY_AGAIN; 2195 } 2065 2196 else 2066 2197 #endif 2067 2198 if (pReq->mFormat == VBOX_SHCL_FMT_UNICODETEXT) 2068 2199 { 2069 /*2070 * VBox wants to read data in the given format.2071 */2072 2200 pReq->mTextFormat = pCtx->X11TextFormat; 2073 if (pReq->mTextFormat == INVALID) 2074 /* VBox thinks we have data and we don't */ 2075 rc = VERR_NO_DATA; 2076 else 2077 /* Send out a request for the data to the current clipboard 2078 * owner */ 2079 getSelectionValue(pCtx, pCtx->X11TextFormat, pReq); 2201 if (pReq->mTextFormat != INVALID) 2202 { 2203 /* Send out a request for the data to the current clipboard owner. */ 2204 rc = getSelectionValue(pCtx, pCtx->X11TextFormat, pReq); 2205 } 2080 2206 } 2081 2207 else if (pReq->mFormat == VBOX_SHCL_FMT_BITMAP) 2082 2208 { 2083 2209 pReq->mBitmapFormat = pCtx->X11BitmapFormat; 2084 if (pReq->mBitmapFormat == INVALID) 2085 /* VBox thinks we have data and we don't */ 2086 rc = VERR_NO_DATA; 2087 else 2088 /* Send out a request for the data to the current clipboard 2089 * owner */ 2090 getSelectionValue(pCtx, pCtx->X11BitmapFormat, pReq); 2210 if (pReq->mBitmapFormat != INVALID) 2211 { 2212 /* Send out a request for the data to the current clipboard owner. */ 2213 rc = getSelectionValue(pCtx, pCtx->X11BitmapFormat, pReq); 2214 } 2091 2215 } 2092 2216 else if (pReq->mFormat == VBOX_SHCL_FMT_HTML) 2093 2217 { 2094 /* Send out a request for the data to the current clipboard2095 * owner */2096 2218 pReq->mHtmlFormat = pCtx->X11HTMLFormat; 2097 if(pReq->mHtmlFormat == INVALID) 2098 /* VBox thinks we have data and we don't */ 2099 rc = VERR_NO_DATA; 2100 else 2101 /* Send out a request for the data to the current clipboard 2102 * owner */ 2103 getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq); 2104 } 2219 if (pReq->mHtmlFormat != INVALID) 2220 { 2221 /* Send out a request for the data to the current clipboard owner. */ 2222 rc = getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq); 2223 } 2224 } 2225 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 2226 else if (pReq->mFormat == VBOX_SHCL_FMT_URI_LIST) 2227 { 2228 pReq->mURIListFormat = pCtx->X11URIListFormat; 2229 if (pReq->mURIListFormat != INVALID) 2230 { 2231 /* Send out a request for the data to the current clipboard owner. */ 2232 rc = getSelectionValue(pCtx, pCtx->X11HTMLFormat, pReq); 2233 } 2234 } 2235 #endif 2105 2236 else 2106 2237 { -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp
r81451 r81699 74 74 formatData.uFormats = u32Formats; 75 75 76 int rc2 = shClSvcFormatsReport(pCtx->pClient, &formatData); 77 AssertRC(rc2); 76 int rc = shClSvcFormatsReport(pCtx->pClient, &formatData); 77 RT_NOREF(rc); 78 79 LogFlowFuncLeaveRC(rc); 78 80 } 79 81 … … 182 184 RT_NOREF(pCmdCtx); 183 185 184 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 185 if (pFormats->uFormats & VBOX_SHCL_FMT_URI_LIST) /* No transfer support yet. */ 186 return VINF_SUCCESS; 187 #endif 188 189 ClipAnnounceFormatToX11(pClient->State.pCtx->pBackend, pFormats->uFormats); 190 191 return VINF_SUCCESS; 186 int rc = ClipAnnounceFormatToX11(pClient->State.pCtx->pBackend, pFormats->uFormats); 187 188 LogFlowFuncLeaveRC(rc); 189 return rc; 192 190 } 193 191 … … 356 354 { 357 355 RT_NOREF(pClient, pTransfer); 358 return VINF_SUCCESS; 356 357 int rc = VINF_SUCCESS; 358 359 LogFlowFuncLeaveRC(rc); 360 return rc; 359 361 } 360 362 … … 362 364 { 363 365 RT_NOREF(pClient, pTransfer); 364 return VINF_SUCCESS; 366 367 int rc = VINF_SUCCESS; 368 369 LogFlowFuncLeaveRC(rc); 370 return rc; 365 371 } 366 372 … … 368 374 { 369 375 RT_NOREF(pClient, pTransfer); 370 return VINF_SUCCESS; 376 377 int rc = VINF_SUCCESS; 378 379 LogFlowFuncLeaveRC(rc); 380 return rc; 371 381 } 372 382 #endif -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r81559 r81699 1732 1732 } 1733 1733 else 1734 { 1735 LogRel2(("Shared Clipboard: File transfers are disabled for this VM\n")); 1734 1736 rc = VERR_ACCESS_DENIED; 1737 } 1735 1738 #else 1736 rc = VERR_NOT_ IMPLEMENTED;1739 rc = VERR_NOT_SUPPORTED; 1737 1740 #endif 1738 1741 break;
Note:
See TracChangeset
for help on using the changeset viewer.