Changeset 7162 in vbox
- Timestamp:
- Feb 27, 2008 2:28:43 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28452
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/Makefile.kmk
r7117 r7162 37 37 clipboard-helper.cpp \ 38 38 darwin-pasteboard.cpp 39 if1of ($(BUILD_TARGET),linux solaris) 39 if1of ($(BUILD_TARGET),linux solaris) ## @todo X11 40 40 ifndef VBOX_HEADLESS 41 41 VBoxSharedClipboard_SOURCES += \ -
trunk/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp
r7131 r7162 34 34 //#define SHOW_CLIPBOARD_CONTENT 35 35 36 /** @todo r=bird: document these functions */ 37 36 38 int initPasteboard (PasteboardRef *pPasteboardRef) 37 39 { -
trunk/src/VBox/HostServices/SharedClipboard/darwin.cpp
r7123 r7162 43 43 static VBOXCLIPBOARDCONTEXT g_ctx; 44 44 45 int vboxClipboardChanged (VBOXCLIPBOARDCONTEXT *pCtx) 45 46 /** 47 * Checks if something is present on the clipboard and calls vboxSvcClipboardReportMsg. 48 * 49 * @returns IPRT status code (ignored). 50 * @param pCtx The context. 51 * 52 * @todo r=bird: This function does not check if something has _changed_ like indicated by 53 * the name. It will instead notify the client every 200ms as long as something 54 * is on the clipboard. When the clipboard is cleared it will do nothing. 55 * I somehow cannot think that this intentional behavior... 56 */ 57 static int vboxClipboardChanged (VBOXCLIPBOARDCONTEXT *pCtx) 46 58 { 47 59 if (pCtx->pClient == NULL) … … 61 73 } 62 74 63 static int vboxClipboardThread (RTTHREAD self, void *pvUser) 75 76 /** 77 * The poller thread. 78 * 79 * This thread will check for the arrival of new data on the clipboard. 80 * 81 * @returns VINF_SUCCESS (not used). 82 * @param Thread Our thread handle. 83 * @param pvUser Pointer to the VBOXCLIPBOARDCONTEXT structure. 84 * 85 */ 86 static int vboxClipboardThread (RTTHREAD ThreadSelf, void *pvUser) 64 87 { 65 88 Log (("vboxClipboardThread: starting clipboard thread\n")); 66 89 67 AssertReturn (VALID_PTR (pvUser), VERR_INVALID_PARAMETER); 68 69 VBOXCLIPBOARDCONTEXT *pCtx = static_cast <VBOXCLIPBOARDCONTEXT*> (pvUser); 90 AssertPtrReturn (pvUser, VERR_INVALID_PARAMETER); 91 VBOXCLIPBOARDCONTEXT *pCtx = (VBOXCLIPBOARDCONTEXT *) pvUser; 70 92 71 93 while (!pCtx->fTerminate) 72 94 { 73 vboxClipboardChanged (pCtx);74 /* Sleep for 200 msecs before next poll */75 RTThreadSleep (200);76 } 77 78 Log (("vboxClipboardThread: clipboard thread terminated successfully with return code % Vrc\n", VINF_SUCCESS));95 vboxClipboardChanged (pCtx); 96 /* Sleep for 200 msecs before next poll */ 97 RTThreadUserWait (self, 200); 98 } 99 100 Log (("vboxClipboardThread: clipboard thread terminated successfully with return code %Rrc\n", VINF_SUCCESS)); 79 101 return VINF_SUCCESS; 80 102 } … … 89 111 Log (("vboxClipboardInit\n")); 90 112 91 int rc = VINF_SUCCESS;92 93 113 g_ctx.fTerminate = false; 94 114 95 rc = initPasteboard (&g_ctx.pasteboard); 115 int rc = initPasteboard (&g_ctx.pasteboard); 116 AssertRCReturn (rc, rc); 96 117 97 118 rc = RTThreadCreate (&g_ctx.thread, vboxClipboardThread, &g_ctx, 0, 98 119 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLIP"); 120 if (RT_FAILURE (rc)) 121 { 122 g_ctx.thread = NIL_RTTHREAD; 123 destroyPasteboard (&g_ctx.pasteboard); 124 } 99 125 100 126 return rc; … … 106 132 Log (("vboxClipboardDestroy\n")); 107 133 108 g_ctx.fTerminate = true; 109 134 /* 135 * Signal the termination of the polling thread and wait for it to respond. 136 */ 137 ASMAtomicWriteBool (&g_ctx.fTerminate, true); 138 int rc = RTThreadUserSignal (g_ctx.thread); 139 AssertRC (rc); 140 rc = RTThreadWait (g_ctx.thread, RT_INDEFINITE_WAIT, NULL); 141 AssertRC (rc); 142 143 /* 144 * Destroy the pasteboard and uninitialize the global context record. 145 */ 110 146 destroyPasteboard (&g_ctx.pasteboard); 111 112 /* Wait for the clipboard thread to terminate. */113 RTThreadWait (g_ctx.thread, RT_INDEFINITE_WAIT, NULL);114 115 147 g_ctx.thread = NIL_RTTHREAD; 116 } 117 118 /** 119 * Enable the shared clipboard - called by the hgcm clipboard subsystem. 120 * 121 * @param pClient Structure containing context information about the guest system 122 * @returns RT status code 123 */ 148 g_ctx.pClient = NULL; 149 } 150 151 /** 152 * Enable the shared clipboard - called by the hgcm clipboard subsystem. 153 * 154 * @param pClient Structure containing context information about the guest system 155 * @returns RT status code 156 */ 124 157 int vboxClipboardConnect (VBOXCLIPBOARDCLIENTDATA *pClient) 125 158 {
Note:
See TracChangeset
for help on using the changeset viewer.