- Timestamp:
- May 8, 2009 4:29:42 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard.h
r19152 r19536 45 45 46 46 /** Opaque data structure for the X11/VBox backend code. */ 47 struct _ VBOXCLIPBOARDCONTEXTX11;48 typedef struct _ VBOXCLIPBOARDCONTEXTX11 VBOXCLIPBOARDCONTEXTX11;47 struct _CLIPBACKEND; 48 typedef struct _CLIPBACKEND CLIPBACKEND; 49 49 50 50 /** A structure containing information about where to store a request … … 68 68 RTSEMEVENT finished; 69 69 /** The clipboard context this request is associated with */ 70 VBOXCLIPBOARDCONTEXTX11*pCtx;70 CLIPBACKEND *pCtx; 71 71 }; 72 72 … … 74 74 75 75 /* APIs exported by the X11 backend */ 76 extern VBOXCLIPBOARDCONTEXTX11*VBoxX11ClipboardConstructX1176 extern CLIPBACKEND *VBoxX11ClipboardConstructX11 77 77 (VBOXCLIPBOARDCONTEXT *pFrontend); 78 extern void VBoxX11ClipboardDestructX11( VBOXCLIPBOARDCONTEXTX11*pBackend);79 extern int VBoxX11ClipboardStartX11( VBOXCLIPBOARDCONTEXTX11*pBackend);80 extern int VBoxX11ClipboardStopX11( VBOXCLIPBOARDCONTEXTX11*pBackend);81 extern void VBoxX11ClipboardAnnounceVBoxFormat( VBOXCLIPBOARDCONTEXTX1178 extern void VBoxX11ClipboardDestructX11(CLIPBACKEND *pBackend); 79 extern int VBoxX11ClipboardStartX11(CLIPBACKEND *pBackend); 80 extern int VBoxX11ClipboardStopX11(CLIPBACKEND *pBackend); 81 extern void VBoxX11ClipboardAnnounceVBoxFormat(CLIPBACKEND 82 82 *pBackend, uint32_t u32Formats); 83 extern int VBoxX11ClipboardReadX11Data( VBOXCLIPBOARDCONTEXTX11*pBackend,83 extern int VBoxX11ClipboardReadX11Data(CLIPBACKEND *pBackend, 84 84 uint32_t u32Format, 85 85 void *pv, uint32_t cb, -
trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
r19535 r19536 89 89 90 90 /** Global context information used by the X11 clipboard backend */ 91 struct _ VBOXCLIPBOARDCONTEXTX1191 struct _CLIPBACKEND 92 92 { 93 93 /** Opaque data structure describing the front-end. */ … … 145 145 Widget widget; 146 146 /** The context associated with the widget */ 147 VBOXCLIPBOARDCONTEXTX11*pCtx;147 CLIPBACKEND *pCtx; 148 148 } g_contexts[CLIPBOARD_NUM_CONTEXTS]; 149 149 150 150 /** Register a new X11 clipboard context. */ 151 static int vboxClipboardAddContext( VBOXCLIPBOARDCONTEXTX11*pCtx)151 static int vboxClipboardAddContext(CLIPBACKEND *pCtx) 152 152 { 153 153 bool found = false; … … 171 171 172 172 /** Unregister an X11 clipboard context. */ 173 static void vboxClipboardRemoveContext( VBOXCLIPBOARDCONTEXTX11*pCtx)173 static void vboxClipboardRemoveContext(CLIPBACKEND *pCtx) 174 174 { 175 175 bool found = false; … … 191 191 192 192 /** Find an X11 clipboard context. */ 193 static VBOXCLIPBOARDCONTEXTX11*vboxClipboardFindContext(Widget widget)193 static CLIPBACKEND *vboxClipboardFindContext(Widget widget) 194 194 { 195 195 AssertReturn(widget != NULL, NULL); … … 223 223 static bool g_fHaveX11; 224 224 225 static int vboxClipboardWriteUtf16LE( VBOXCLIPBOARDCONTEXTX11*pCtx,225 static int vboxClipboardWriteUtf16LE(CLIPBACKEND *pCtx, 226 226 PRTUTF16 pu16SrcText, 227 227 size_t cwSrcLen, … … 267 267 * the X11 clipboard. 268 268 */ 269 static int vboxClipboardGetUtf8FromX11( VBOXCLIPBOARDCONTEXTX11*pCtx,269 static int vboxClipboardGetUtf8FromX11(CLIPBACKEND *pCtx, 270 270 XtPointer pValue, unsigned cbSrcLen, 271 271 void *pv, unsigned cb, … … 304 304 * the X11 clipboard. 305 305 */ 306 static int vboxClipboardGetCTextFromX11( VBOXCLIPBOARDCONTEXTX11*pCtx,306 static int vboxClipboardGetCTextFromX11(CLIPBACKEND *pCtx, 307 307 XtPointer pValue, unsigned cbSrcLen, 308 308 void *pv, unsigned cb, … … 382 382 * the X11 clipboard. 383 383 */ 384 static int vboxClipboardGetLatin1FromX11( VBOXCLIPBOARDCONTEXTX11*pCtx,384 static int vboxClipboardGetLatin1FromX11(CLIPBACKEND *pCtx, 385 385 XtPointer pValue, 386 386 unsigned cbSourceLen, void *pv, … … 445 445 VBOXCLIPBOARDREQUEST *pRequest 446 446 = reinterpret_cast<VBOXCLIPBOARDREQUEST *>(pClientData); 447 VBOXCLIPBOARDCONTEXTX11*pCtx = pRequest->pCtx;447 CLIPBACKEND *pCtx = pRequest->pCtx; 448 448 if (pCtx->fOwnsClipboard == true) 449 449 { … … 536 536 int *piFormat) 537 537 { 538 VBOXCLIPBOARDCONTEXTX11*pCtx =539 reinterpret_cast< VBOXCLIPBOARDCONTEXTX11*>(pClientData);538 CLIPBACKEND *pCtx = 539 reinterpret_cast<CLIPBACKEND *>(pClientData); 540 540 Atom *atomTargets = reinterpret_cast<Atom *>(pValue); 541 541 unsigned cAtoms = *pcLen; … … 588 588 static void vboxClipboardPollX11ForTargets(XtPointer pUserData, 589 589 XtIntervalId * /* hTimerId */); 590 static void clipSchedulePoller( VBOXCLIPBOARDCONTEXTX11*pCtx,590 static void clipSchedulePoller(CLIPBACKEND *pCtx, 591 591 XtTimerCallbackProc proc); 592 592 593 593 #ifndef TESTCASE 594 void clipSchedulePoller( VBOXCLIPBOARDCONTEXTX11*pCtx,594 void clipSchedulePoller(CLIPBACKEND *pCtx, 595 595 XtTimerCallbackProc proc) 596 596 { … … 610 610 XtIntervalId * /* hTimerId */) 611 611 { 612 VBOXCLIPBOARDCONTEXTX11*pCtx =613 reinterpret_cast< VBOXCLIPBOARDCONTEXTX11*>(pUserData);612 CLIPBACKEND *pCtx = 613 reinterpret_cast<CLIPBACKEND *>(pUserData); 614 614 Log3 (("%s: called\n", __PRETTY_FUNCTION__)); 615 615 /* Get the current clipboard contents if we don't own it ourselves */ … … 636 636 LogRel(("Shared clipboard: starting host clipboard thread\n")); 637 637 638 VBOXCLIPBOARDCONTEXTX11*pCtx =639 reinterpret_cast< VBOXCLIPBOARDCONTEXTX11*>(pvUser);638 CLIPBACKEND *pCtx = 639 reinterpret_cast<CLIPBACKEND *>(pvUser); 640 640 while (XtAppGetExitFlag(pCtx->appContext) == FALSE) 641 641 XtAppProcessEvent(pCtx->appContext, XtIMAll); … … 648 648 * @note X11 backend code. 649 649 */ 650 static void vboxClipboardUninitX11( VBOXCLIPBOARDCONTEXTX11*pCtx)650 static void vboxClipboardUninitX11(CLIPBACKEND *pCtx) 651 651 { 652 652 AssertPtrReturnVoid(pCtx); … … 676 676 { 677 677 678 VBOXCLIPBOARDCONTEXTX11 *pCtx = (VBOXCLIPBOARDCONTEXTX11*)pUserData;678 CLIPBACKEND *pCtx = (CLIPBACKEND *)pUserData; 679 679 680 680 /* This might mean that we are getting stopped twice. */ … … 693 693 * @note X11 backend code. 694 694 */ 695 static int vboxClipboardInitX11 ( VBOXCLIPBOARDCONTEXTX11*pCtx)695 static int vboxClipboardInitX11 (CLIPBACKEND *pCtx) 696 696 { 697 697 /* Create a window and make it a clipboard viewer. */ … … 755 755 * @note X11 backend code 756 756 */ 757 VBOXCLIPBOARDCONTEXTX11*VBoxX11ClipboardConstructX11757 CLIPBACKEND *VBoxX11ClipboardConstructX11 758 758 (VBOXCLIPBOARDCONTEXT *pFrontend) 759 759 { 760 760 int rc; 761 761 762 VBOXCLIPBOARDCONTEXTX11 *pCtx = (VBOXCLIPBOARDCONTEXTX11*)763 RTMemAllocZ(sizeof( VBOXCLIPBOARDCONTEXTX11));762 CLIPBACKEND *pCtx = (CLIPBACKEND *) 763 RTMemAllocZ(sizeof(CLIPBACKEND)); 764 764 if (pCtx && !RTEnvGet("DISPLAY")) 765 765 { … … 787 787 * @note X11 backend code 788 788 */ 789 void VBoxX11ClipboardDestructX11( VBOXCLIPBOARDCONTEXTX11*pCtx)789 void VBoxX11ClipboardDestructX11(CLIPBACKEND *pCtx) 790 790 { 791 791 /* … … 804 804 * Announce to the X11 backend that we are ready to start. 805 805 */ 806 int VBoxX11ClipboardStartX11( VBOXCLIPBOARDCONTEXTX11*pCtx)806 int VBoxX11ClipboardStartX11(CLIPBACKEND *pCtx) 807 807 { 808 808 int rc = VINF_SUCCESS; … … 845 845 * to return and will not be able to terminate. 846 846 */ 847 int VBoxX11ClipboardStopX11( VBOXCLIPBOARDCONTEXTX11*pCtx)847 int VBoxX11ClipboardStopX11(CLIPBACKEND *pCtx) 848 848 { 849 849 int rc, rcThread; … … 888 888 * @note X11 backend code, called by the XtOwnSelection callback. 889 889 */ 890 static Boolean vboxClipboardConvertTargetsForX11( VBOXCLIPBOARDCONTEXTX11890 static Boolean vboxClipboardConvertTargetsForX11(CLIPBACKEND 891 891 *pCtx, 892 892 Atom *atomTypeReturn, … … 930 930 * @todo any ideas about how to do this better are welcome. 931 931 */ 932 static int vboxClipboardReadVBoxData ( VBOXCLIPBOARDCONTEXTX11*pCtx,932 static int vboxClipboardReadVBoxData (CLIPBACKEND *pCtx, 933 933 uint32_t u32Format, void **ppv, 934 934 uint32_t *pcb) … … 981 981 * @note X11 backend code, called by the callback for XtOwnSelection. 982 982 */ 983 static Boolean vboxClipboardConvertToUtf8ForX11( VBOXCLIPBOARDCONTEXTX11983 static Boolean vboxClipboardConvertToUtf8ForX11(CLIPBACKEND 984 984 *pCtx, 985 985 Atom *atomTarget, … … 1092 1092 * @note X11 backend code, called by the callback for XtOwnSelection. 1093 1093 */ 1094 static Boolean vboxClipboardConvertToCTextForX11( VBOXCLIPBOARDCONTEXTX111094 static Boolean vboxClipboardConvertToCTextForX11(CLIPBACKEND 1095 1095 *pCtx, 1096 1096 Atom *atomTypeReturn, … … 1213 1213 { 1214 1214 CLIPFORMAT enmFormat = INVALID; 1215 VBOXCLIPBOARDCONTEXTX11*pCtx = vboxClipboardFindContext(widget);1215 CLIPBACKEND *pCtx = vboxClipboardFindContext(widget); 1216 1216 1217 1217 LogFlowFunc(("\n")); … … 1271 1271 static void vboxClipboardReturnToX11(Widget widget, Atom *) 1272 1272 { 1273 VBOXCLIPBOARDCONTEXTX11*pCtx = vboxClipboardFindContext(widget);1273 CLIPBACKEND *pCtx = vboxClipboardFindContext(widget); 1274 1274 LogFlowFunc (("called, giving X11 clipboard ownership\n")); 1275 1275 /* These should be set to the right values as soon as we start polling */ … … 1294 1294 { 1295 1295 /** Context information for the X11 clipboard */ 1296 VBOXCLIPBOARDCONTEXTX11*pCtx;1296 CLIPBACKEND *pCtx; 1297 1297 /** Formats supported by VBox */ 1298 1298 uint32_t formats; … … 1306 1306 /* Extract and free the user data */ 1307 1307 VBOXCLIPBOARDFORMATS *pFormats = (VBOXCLIPBOARDFORMATS *)pUserData; 1308 VBOXCLIPBOARDCONTEXTX11*pCtx = pFormats->pCtx;1308 CLIPBACKEND *pCtx = pFormats->pCtx; 1309 1309 uint32_t u32Formats = pFormats->formats; 1310 1310 RTMemFree(pFormats); … … 1355 1355 * @note X11 backend code 1356 1356 */ 1357 void VBoxX11ClipboardAnnounceVBoxFormat( VBOXCLIPBOARDCONTEXTX11*pCtx,1357 void VBoxX11ClipboardAnnounceVBoxFormat(CLIPBACKEND *pCtx, 1358 1358 uint32_t u32Formats) 1359 1359 { … … 1381 1381 { 1382 1382 VBOXCLIPBOARDREQUEST *pRequest = (VBOXCLIPBOARDREQUEST *)pUserData; 1383 VBOXCLIPBOARDCONTEXTX11*pCtx = pRequest->pCtx;1383 CLIPBACKEND *pCtx = pRequest->pCtx; 1384 1384 LogFlowFunc (("u32Format = %d, cb = %d\n", pRequest->format, 1385 1385 pRequest->cb)); … … 1433 1433 * @note X11 backend code 1434 1434 */ 1435 int VBoxX11ClipboardReadX11Data( VBOXCLIPBOARDCONTEXTX11*pCtx,1435 int VBoxX11ClipboardReadX11Data(CLIPBACKEND *pCtx, 1436 1436 uint32_t u32Format, void *pv, uint32_t cb, 1437 1437 uint32_t *pcbActual) … … 1485 1485 /* For the testcase, we install the poller function in a global variable 1486 1486 * which is called when the testcase updates the X11 targets. */ 1487 void clipSchedulePoller( VBOXCLIPBOARDCONTEXTX11*pCtx,1487 void clipSchedulePoller(CLIPBACKEND *pCtx, 1488 1488 XtTimerCallbackProc proc) 1489 1489 { … … 1517 1517 1518 1518 /* Set empty data in the simulated VBox clipboard. */ 1519 static void clipEmptyVBox( VBOXCLIPBOARDCONTEXTX11*pCtx, int retval)1519 static void clipEmptyVBox(CLIPBACKEND *pCtx, int retval) 1520 1520 { 1521 1521 g_vboxDataRC = retval; … … 1526 1526 1527 1527 /* Set the data in the simulated VBox clipboard. */ 1528 static int clipSetVBoxUtf16( VBOXCLIPBOARDCONTEXTX11*pCtx, int retval,1528 static int clipSetVBoxUtf16(CLIPBACKEND *pCtx, int retval, 1529 1529 const char *pcszData, size_t cb) 1530 1530 { … … 1885 1885 #define MAX_BUF_SIZE 256 1886 1886 1887 static bool testStringFromX11( VBOXCLIPBOARDCONTEXTX11*pCtx, uint32_t cbBuf,1887 static bool testStringFromX11(CLIPBACKEND *pCtx, uint32_t cbBuf, 1888 1888 const char *pcszExp, int rcExp) 1889 1889 { … … 1941 1941 } 1942 1942 1943 static bool testLatin1FromX11( VBOXCLIPBOARDCONTEXTX11*pCtx, uint32_t cbBuf,1943 static bool testLatin1FromX11(CLIPBACKEND *pCtx, uint32_t cbBuf, 1944 1944 const char *pcszExp, int rcExp) 1945 1945 { … … 1993 1993 } 1994 1994 1995 static bool testStringFromVBox( VBOXCLIPBOARDCONTEXTX11*pCtx,1995 static bool testStringFromVBox(CLIPBACKEND *pCtx, 1996 1996 const char *pcszTarget, Atom typeExp, 1997 1997 const void *valueExp, unsigned long lenExp, … … 2027 2027 } 2028 2028 2029 static bool testStringFromVBoxFailed( VBOXCLIPBOARDCONTEXTX11*pCtx,2029 static bool testStringFromVBoxFailed(CLIPBACKEND *pCtx, 2030 2030 const char *pcszTarget) 2031 2031 { … … 2051 2051 { 2052 2052 RTR3Init(); 2053 VBOXCLIPBOARDCONTEXTX11*pCtx = VBoxX11ClipboardConstructX11(NULL);2053 CLIPBACKEND *pCtx = VBoxX11ClipboardConstructX11(NULL); 2054 2054 unsigned cErrs = 0; 2055 2055 char pc[MAX_BUF_SIZE]; … … 2320 2320 } 2321 2321 RTPrintf(TEST_NAME ": TESTING\n"); 2322 VBOXCLIPBOARDCONTEXTX11*pCtx = VBoxX11ClipboardConstructX11(NULL);2322 CLIPBACKEND *pCtx = VBoxX11ClipboardConstructX11(NULL); 2323 2323 AssertReturn(pCtx, 1); 2324 2324 rc = VBoxX11ClipboardStartX11(pCtx); -
trunk/src/VBox/HostServices/SharedClipboard/x11-clipboard.cpp
r19152 r19536 65 65 66 66 /** Pointer to the opaque X11 backend structure */ 67 VBOXCLIPBOARDCONTEXTX11*pBackend;67 CLIPBACKEND *pBackend; 68 68 /** Pointer to the VBox host client data structure. */ 69 69 VBOXCLIPBOARDCLIENTDATA *pClient; … … 215 215 { 216 216 int rc = VINF_SUCCESS; 217 VBOXCLIPBOARDCONTEXTX11*pBackend = NULL;217 CLIPBACKEND *pBackend = NULL; 218 218 219 219 LogRel(("Starting host clipboard service\n"));
Note:
See TracChangeset
for help on using the changeset viewer.