Changeset 37434 in vbox
- Timestamp:
- Jun 14, 2011 1:14:57 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard.h
r36536 r37434 54 54 55 55 /* APIs exported by the X11 backend */ 56 extern CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend );56 extern CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend, bool fHeadless); 57 57 extern void ClipDestructX11(CLIPBACKEND *pBackend); 58 58 #ifdef __cplusplus -
trunk/include/VBox/HostServices/VBoxClipboardSvc.h
r28800 r37434 51 51 * The service functions which are callable by host. 52 52 */ 53 #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE 1 53 #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_MODE 1 54 /** Run headless on the host, i.e. do not touch the host clipboard. */ 55 #define VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS 2 54 56 55 57 /* -
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r33595 r37434 186 186 /* Sanity */ 187 187 AssertReturn(g_ctx.client == 0, VERR_WRONG_ORDER); 188 g_ctx.pBackend = ClipConstructX11(&g_ctx );188 g_ctx.pBackend = ClipConstructX11(&g_ctx, false); 189 189 if (!g_ctx.pBackend) 190 190 rc = VERR_NO_MEMORY; -
trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
r33995 r37434 44 44 45 45 #include <iprt/types.h> 46 #include <iprt/env.h>47 46 #include <iprt/mem.h> 48 47 #include <iprt/semaphore.h> … … 698 697 * @note X11 backend code 699 698 */ 700 CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend )699 CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend, bool fHeadless) 701 700 { 702 701 int rc; … … 704 703 CLIPBACKEND *pCtx = (CLIPBACKEND *) 705 704 RTMemAllocZ(sizeof(CLIPBACKEND)); 706 if (pCtx && !RTEnvExist("DISPLAY"))705 if (pCtx && fHeadless) 707 706 { 708 707 /* … … 2241 2240 } 2242 2241 2242 static void testNoX11(CLIPBACKEND *pCtx, const char *pcszTestCtx) 2243 { 2244 CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)&pReq, *pReqRet = NULL; 2245 int rc = ClipRequestDataFromX11(pCtx, 2246 VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT, 2247 pReq); 2248 RTTESTI_CHECK_MSG(rc == VERR_NO_DATA, ("context: %s\n", pcszTestCtx)); 2249 } 2250 2243 2251 static void testStringFromVBoxFailed(RTTEST hTest, CLIPBACKEND *pCtx, 2244 2252 const char *pcszTarget) … … 2257 2265 } 2258 2266 2267 static void testNoSelectionOwnership(CLIPBACKEND *pCtx, 2268 const char *pcszTestCtx) 2269 { 2270 RTTESTI_CHECK_MSG(!g_ownsSel, ("context: %s\n", pcszTestCtx)); 2271 } 2272 2259 2273 int main() 2260 2274 { … … 2271 2285 * Run the test. 2272 2286 */ 2273 CLIPBACKEND *pCtx = ClipConstructX11(NULL );2287 CLIPBACKEND *pCtx = ClipConstructX11(NULL, false); 2274 2288 char *pc; 2275 2289 uint32_t cbActual; … … 2524 2538 ClipDestructX11(pCtx); 2525 2539 2540 /*** Headless clipboard tests ***/ 2541 2542 pCtx = ClipConstructX11(NULL, true); 2543 rc = ClipStartX11(pCtx); 2544 AssertRCReturn(rc, 1); 2545 2546 /*** Read from X11 ***/ 2547 RTTestSub(hTest, "reading from X11, headless clipboard"); 2548 /* Simple test */ 2549 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "", 2550 sizeof("") * 2); 2551 clipSetSelectionValues("UTF8_STRING", XA_STRING, "hello world", 2552 sizeof("hello world"), 8); 2553 testNoX11(pCtx, "reading from X11, headless clipboard"); 2554 2555 /*** Read from VBox ***/ 2556 RTTestSub(hTest, "reading from VBox, headless clipboard"); 2557 /* Simple test */ 2558 clipEmptyVBox(pCtx, VERR_WRONG_ORDER); 2559 clipSetSelectionValues("TEXT", XA_STRING, "", sizeof(""), 8); 2560 clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world", 2561 sizeof("hello world") * 2); 2562 testNoSelectionOwnership(pCtx, "reading from VBox, headless clipboard"); 2563 2564 rc = ClipStopX11(pCtx); 2565 AssertRCReturn(rc, 1); 2566 ClipDestructX11(pCtx); 2567 2526 2568 return RTTestSummaryAndDestroy(hTest); 2527 2569 } … … 2536 2578 * the command line. */ 2537 2579 2580 #include <iprt/env.h> 2538 2581 #include <iprt/test.h> 2539 2582 … … 2577 2620 return RTTestSummaryAndDestroy(hTest); 2578 2621 } 2579 CLIPBACKEND *pCtx = ClipConstructX11(NULL );2622 CLIPBACKEND *pCtx = ClipConstructX11(NULL, false); 2580 2623 AssertReturn(pCtx, 1); 2581 2624 rc = ClipStartX11(pCtx); -
trunk/src/VBox/HostServices/SharedClipboard/Makefile.kmk
r35380 r37434 18 18 SUB_DEPTH = ../../../.. 19 19 include $(KBUILD_PATH)/subheader.kmk 20 21 # Include sub-makefile(s). 22 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk 20 23 21 24 # -
trunk/src/VBox/HostServices/SharedClipboard/VBoxClipboard.h
r28800 r37434 20 20 21 21 #define LOG_GROUP LOG_GROUP_SHARED_CLIPBOARD 22 #include <VBox/hgcmsvc.h> 22 23 #include <VBox/log.h> 23 24 -
trunk/src/VBox/HostServices/SharedClipboard/x11-clipboard.cpp
r33540 r37434 23 23 #include <iprt/assert.h> 24 24 #include <iprt/critsect.h> 25 #include <iprt/env.h> 25 26 #include <iprt/mem.h> 26 27 #include <iprt/semaphore.h> … … 111 112 { 112 113 RTCritSectInit(&pCtx->clipboardMutex); 113 pBackend = ClipConstructX11(pCtx );114 pBackend = ClipConstructX11(pCtx, !RTEnvGet("DISPLAY")); 114 115 if (pBackend == NULL) 115 116 rc = VERR_NO_MEMORY; … … 470 471 } 471 472 472 CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend )473 CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend, bool) 473 474 { 474 475 return (CLIPBACKEND *)RTMemAllocZ(sizeof(CLIPBACKEND));
Note:
See TracChangeset
for help on using the changeset viewer.