Changeset 18582 in vbox for trunk/src/VBox/HostServices/SharedClipboard
- Timestamp:
- Mar 31, 2009 4:39:34 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 45479
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/x11-clipboard.cpp
r18578 r18582 118 118 struct _VBOXCLIPBOARDCONTEXTX11 119 119 { 120 /** Opaque data structure describing the front-end. */ 121 VBOXCLIPBOARDCONTEXT *pFrontend; 120 122 /** The X Toolkit application context structure */ 121 123 XtAppContext appContext; … … 200 202 static bool g_fHaveX11; 201 203 204 /** @todo this is a temporary declaration. */ 205 static void vboxClipboardFormatAnnounceBackend (uint32_t u32Formats); 202 206 203 207 /** … … 222 226 * data from X11. */ 223 227 LogFunc(("host requested guest clipboard data after guest had disconnected.\n")); 224 vboxClipboardFormatAnnounce (NULL,0);228 vboxClipboardFormatAnnounceBackend(0); 225 229 pCtx->waiter = NONE; 226 230 return VERR_TIMEOUT; … … 584 588 585 589 /** 590 * Report formats available in the X11 clipboard to VBox. 591 * @param pCtx Opaque context pointer for the glue code 592 * @param u32Formats The formats available 593 * @note Host glue code 594 */ 595 void VBoxX11ClipboardReportX11Formats(VBOXCLIPBOARDCONTEXT *pCtx, 596 uint32_t u32Formats) 597 { 598 vboxSvcClipboardReportMsg(pCtx->pClient, 599 VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS, 600 u32Formats); 601 } 602 603 604 /** 586 605 * Notify the host clipboard about the data formats we support, based on the 587 606 * "targets" (available data formats) information obtained from the X11 … … 589 608 * @note X11 backend code, callback for XtGetSelectionValue, called when we 590 609 * poll for available targets. 591 * @todo This function still references host-specific data and calls host592 * frontend APIs. Fix.593 610 */ 594 611 static void vboxClipboardGetTargetsFromX11(Widget, … … 664 681 if (eBestTarget != INVALID) 665 682 u32Formats |= VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT; 666 vboxSvcClipboardReportMsg (g_ctxHost.pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS, 667 u32Formats); 683 VBoxX11ClipboardReportX11Formats(g_ctxX11.pFrontend, u32Formats); 668 684 g_ctxX11.notifyVBox = false; 669 685 } … … 676 692 * @note X11 backend code, callback for XtAppAddTimeOut, recursively 677 693 * re-armed. 678 * @todo This function still references host-specific data. Fix.679 694 * @todo Use the XFIXES extension to check for new clipboard data when 680 695 * available. … … 684 699 Log3 (("%s: called\n", __PRETTY_FUNCTION__)); 685 700 /* Get the current clipboard contents */ 686 if (g_ctxX11.eOwner == X11 && g_ctxHost.pClient != 0)701 if (g_ctxX11.eOwner == X11) 687 702 { 688 703 Log3 (("%s: requesting the targets that the host clipboard offers\n", 689 704 __PRETTY_FUNCTION__)); 690 XtGetSelectionValue(g_ctxX11.widget, g_ctxX11.atomClipboard, g_ctxX11.atomTargets, 691 vboxClipboardGetTargetsFromX11, reinterpret_cast<XtPointer>(g_ctxHost.pClient), 705 XtGetSelectionValue(g_ctxX11.widget, g_ctxX11.atomClipboard, 706 g_ctxX11.atomTargets, 707 vboxClipboardGetTargetsFromX11, NULL, 692 708 CurrentTime); 693 709 } 694 710 /* Re-arm our timer */ 695 XtAppAddTimeOut(g_ctxX11.appContext, 200 /* ms */, vboxClipboardPollX11ForTargets, 0); 711 XtAppAddTimeOut(g_ctxX11.appContext, 200 /* ms */, 712 vboxClipboardPollX11ForTargets, 0); 696 713 } 697 714 … … 812 829 * @note X11 backend code 813 830 */ 814 int vboxClipboardInitBackend ( void)831 int vboxClipboardInitBackend (VBOXCLIPBOARDCONTEXT *pFrontend) 815 832 { 816 833 int rc; … … 852 869 853 870 LogRel(("Initializing X11 clipboard backend\n")); 871 g_ctxX11.pFrontend = pFrontend; 854 872 RTSemEventCreate(&g_ctxX11.waitForData); 855 873 rc = vboxClipboardInitX11(); … … 876 894 RTSemEventCreate(&g_ctxHost.waitForData); 877 895 RTSemMutexCreate(&g_ctxHost.clipboardMutex); 878 rc = vboxClipboardInitBackend( );896 rc = vboxClipboardInitBackend(&g_ctxHost); 879 897 if (RT_FAILURE(rc)) 880 898 { … … 962 980 * successfully and no other calls from the host code should be 963 981 * forthcoming. */ 964 /** @todo move these two into a frontend proxy object that the965 * backend can call. */966 982 /** @todo can the backend fail to exit successfully? What then? */ 967 983 RTSemEventDestroy(g_ctxHost.waitForData); … … 988 1004 else 989 1005 { 990 /** @todo take ownership of the X11 clipboard. */ 1006 /** @todo Check whether the guest gets a format announcement at 1007 * startup. */ 1008 vboxClipboardFormatAnnounceBackend(0); 991 1009 } 992 1010 return VINF_SUCCESS; … … 1050 1068 1051 1069 /** 1052 * Shut down the shared clipboard service and "disconnect" the guest. 1053 * @todo This mixes host glue and X11 backend code, separate into two 1054 * functions. 1070 * Shut down the shared clipboard X11 backend. 1071 * @note X11 backend code 1055 1072 */ 1056 1073 void vboxClipboardDisconnectBackend (void) … … 1069 1086 /** 1070 1087 * Shut down the shared clipboard service and "disconnect" the guest. 1071 * @todo This mixes host glue and X11 backend code, separate into two 1072 * functions. 1088 * @note Host glue code 1073 1089 */ 1074 1090 void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *) … … 1164 1180 * data we are returning 1165 1181 * @note X11 backend code, called by the callback for XtOwnSelection. 1166 * @todo this function uses host-specific data and APIs. Fix.1167 1182 */ 1168 1183 static Boolean vboxClipboardConvertUtf16(Atom *atomTypeReturn, … … 1178 1193 1179 1194 LogFlowFunc (("called\n")); 1180 rc = vboxClipboardReadDataFromVBox( &g_ctxHost, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, &pvVBox, &cbVBox);1195 rc = vboxClipboardReadDataFromVBox(g_ctxX11.pFrontend, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, &pvVBox, &cbVBox); 1181 1196 if ((RT_FAILURE(rc)) || (cbVBox == 0)) 1182 1197 { … … 1248 1263 * data we are returning 1249 1264 * @note X11 backend code, called by the callback for XtOwnSelection. 1250 * @todo this function uses host-specific data and APIs. Fix.1251 1265 */ 1252 1266 static Boolean vboxClipboardConvertToUtf8ForX11(Atom *atomTypeReturn, … … 1264 1278 LogFlowFunc (("called\n")); 1265 1279 /* Read the clipboard data from the guest. */ 1266 rc = vboxClipboardReadDataFromVBox( &g_ctxHost, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, &pvVBox, &cbVBox);1280 rc = vboxClipboardReadDataFromVBox(g_ctxX11.pFrontend, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, &pvVBox, &cbVBox); 1267 1281 if ((rc != VINF_SUCCESS) || (cbVBox == 0)) 1268 1282 { … … 1355 1369 * data we are returning 1356 1370 * @note X11 backend code, called by the callback for XtOwnSelection. 1357 * @todo this function uses host-specific data and APIs. Fix.1358 1371 */ 1359 1372 static Boolean vboxClipboardConvertToCTextForX11(Atom *atomTypeReturn, … … 1372 1385 LogFlowFunc (("called\n")); 1373 1386 /* Read the clipboard data from the guest. */ 1374 rc = vboxClipboardReadDataFromVBox( &g_ctxHost, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, &pvVBox, &cbVBox);1387 rc = vboxClipboardReadDataFromVBox(g_ctxX11.pFrontend, VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, &pvVBox, &cbVBox); 1375 1388 if ((rc != VINF_SUCCESS) || (cbVBox == 0)) 1376 1389 {
Note:
See TracChangeset
for help on using the changeset viewer.