Changeset 7249 in vbox
- Timestamp:
- Mar 3, 2008 5:50:55 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28585
- Location:
- trunk/src/VBox/HostServices/SharedClipboard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.cpp
r7242 r7249 32 32 /** 33 33 * Initialize the global pasteboard and return a reference to it. 34 * 34 * 35 35 * @param pPasteboardRef Reference to the global pasteboard. 36 36 * … … 49 49 /** 50 50 * Release the reference to the global pasteboard. 51 * 51 * 52 52 * @param pPasteboardRef Reference to the global pasteboard. 53 53 */ … … 61 61 * Inspect the global pasteboard for new content. Check if there is some type 62 62 * that is supported by vbox and return it. 63 * 63 * 64 64 * @param pPasteboardRef Reference to the global pasteboard. 65 65 * @param pfFormats Pointer for the bit combination of the … … 68 68 * last call. 69 69 * 70 * @returns IPRT status code. 71 */ 72 int queryNewPasteboardFormats (PasteboardRef pPasteboard, uint32_t *pfFormats, bool *p bChanged)70 * @returns IPRT status code. (Always VINF_SUCCESS atm.) 71 */ 72 int queryNewPasteboardFormats (PasteboardRef pPasteboard, uint32_t *pfFormats, bool *pfChanged) 73 73 { 74 74 Log (("queryNewPasteboardFormats\n")); 75 75 76 76 OSStatus err = noErr; 77 *p bChanged = true;77 *pfChanged = true; 78 78 79 79 PasteboardSyncFlags syncFlags; … … 83 83 if (!(syncFlags & kPasteboardModified)) 84 84 { 85 *p bChanged = false;85 *pfChanged = false; 86 86 return VINF_SUCCESS; 87 87 } … … 94 94 95 95 /* The id of the first element in the pasteboard */ 96 int rc = V ERR_NOT_SUPPORTED;96 int rc = VINF_SUCCESS; 97 97 PasteboardItemID itemID; 98 98 if (!(err = PasteboardGetItemIdentifier (pPasteboard, 1, &itemID))) … … 118 118 } 119 119 } 120 rc = VINF_SUCCESS;121 120 CFRelease (flavorTypeArray); 122 121 } … … 130 129 * Read content from the host clipboard and write it to the internal clipboard 131 130 * structure for further processing. 132 * 131 * 133 132 * @param pPasteboardRef Reference to the global pasteboard. 134 133 * @param fFormats The format type which should be read. … … 224 223 * Write clipboard content to the host clipboard from the internal clipboard 225 224 * structure. 226 * 225 * 227 226 * @param pPasteboardRef Reference to the global pasteboard. 228 227 * @param pv The source buffer. -
trunk/src/VBox/HostServices/SharedClipboard/darwin-pasteboard.h
r7242 r7249 25 25 void destroyPasteboard (PasteboardRef *pPasteboardRef); 26 26 27 int queryNewPasteboardFormats (PasteboardRef pPasteboard, uint32_t *pfFormats, bool *p bChanged);27 int queryNewPasteboardFormats (PasteboardRef pPasteboard, uint32_t *pfFormats, bool *pfChanged); 28 28 int readFromPasteboard (PasteboardRef pPasteboard, uint32_t fFormat, void *pv, uint32_t cb, uint32_t *pcbActual); 29 29 int writeToPasteboard (PasteboardRef pPasteboard, void *pv, uint32_t cb, uint32_t fFormat); -
trunk/src/VBox/HostServices/SharedClipboard/darwin.cpp
r7242 r7249 44 44 /** 45 45 * Checks if something is present on the clipboard and calls vboxSvcClipboardReportMsg. 46 * 46 * 47 47 * @returns IPRT status code (ignored). 48 48 * @param pCtx The context. … … 54 54 55 55 uint32_t fFormats = 0; 56 bool bChanged = false;56 bool fChanged = false; 57 57 /* Retrieve the formats currently in the clipboard and supported by vbox */ 58 int rc = queryNewPasteboardFormats (pCtx->pasteboard, &fFormats, &bChanged); 59 60 if (bChanged) 58 int rc = queryNewPasteboardFormats (pCtx->pasteboard, &fFormats, &fChanged); 59 if (RT_SUCCESS (rc) && fChanged) 61 60 { 62 61 vboxSvcClipboardReportMsg (pCtx->pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS, fFormats); … … 68 67 69 68 70 /** 69 /** 71 70 * The poller thread. 72 * 71 * 73 72 * This thread will check for the arrival of new data on the clipboard. 74 * 73 * 75 74 * @returns VINF_SUCCESS (not used). 76 75 * @param Thread Our thread handle. 77 76 * @param pvUser Pointer to the VBOXCLIPBOARDCONTEXT structure. 78 * 77 * 79 78 */ 80 79 static int vboxClipboardThread (RTTHREAD ThreadSelf, void *pvUser) … … 87 86 while (!pCtx->fTerminate) 88 87 { 88 /* call this behind the lock because we don't know if the api is 89 thread safe and in any case we're calling several methods. */ 90 vboxSvcClipboardLock(); 89 91 vboxClipboardChanged (pCtx); 92 vboxSvcClipboardUnlock(); 93 90 94 /* Sleep for 200 msecs before next poll */ 91 95 RTThreadUserWait (ThreadSelf, 200); … … 126 130 Log (("vboxClipboardDestroy\n")); 127 131 128 /* 132 /* 129 133 * Signal the termination of the polling thread and wait for it to respond. 130 134 */ … … 157 161 } 158 162 163 vboxSvcClipboardLock(); 164 159 165 pClient->pCtx = &g_ctx; 160 166 pClient->pCtx->pClient = pClient; … … 163 169 int rc = vboxClipboardSync (pClient); 164 170 171 vboxSvcClipboardUnlock(); 165 172 return rc; 166 173 } … … 173 180 { 174 181 /* Sync the host clipboard content with the client. */ 182 vboxSvcClipboardLock(); 175 183 int rc = vboxClipboardChanged (pClient->pCtx); 184 vboxSvcClipboardUnlock(); 176 185 177 186 return rc; … … 181 190 * Shut down the shared clipboard subsystem and "disconnect" the guest. 182 191 */ 183 void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA * /* pClient */)192 void vboxClipboardDisconnect (VBOXCLIPBOARDCLIENTDATA *pClient) 184 193 { 185 194 Log (("vboxClipboardDisconnect\n")); 186 195 187 g_ctx.pClient = NULL; 196 vboxSvcClipboardLock(); 197 pClient->pCtx->pClient = NULL; 198 vboxSvcClipboardUnlock(); 188 199 } 189 200 … … 195 206 * @param u32Formats Clipboard formats the the guest is offering 196 207 */ 197 void vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA * /* pClient */, 198 uint32_t u32Formats) 208 void vboxClipboardFormatAnnounce (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Formats) 199 209 { 200 210 Log (("vboxClipboardFormatAnnounce u32Formats %02X\n", u32Formats)); … … 205 215 } 206 216 207 vboxSvcClipboardReportMsg ( g_ctx.pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA,217 vboxSvcClipboardReportMsg (pClient, VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA, 208 218 u32Formats); 209 219 } … … 218 228 * @param pcbActual Where to write the actual size of the written data 219 229 */ 220 int vboxClipboardReadData (VBOXCLIPBOARDCLIENTDATA * /* pClient */, uint32_t u32Format,230 int vboxClipboardReadData (VBOXCLIPBOARDCLIENTDATA *pClient, uint32_t u32Format, 221 231 void *pv, uint32_t cb, uint32_t * pcbActual) 222 232 { 233 vboxSvcClipboardLock(); 234 223 235 /* Default to no data available. */ 224 236 *pcbActual = 0; 225 int rc = readFromPasteboard (g_ctx.pasteboard, u32Format, pv, cb, pcbActual); 226 237 int rc = readFromPasteboard (pClient->pCtx->pasteboard, u32Format, pv, cb, pcbActual); 238 239 vboxSvcClipboardUnlock(); 227 240 return rc; 228 241 } … … 236 249 * @param u32Format The format of the data written 237 250 */ 238 void vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA * /* pClient */, void *pv,251 void vboxClipboardWriteData (VBOXCLIPBOARDCLIENTDATA *pClient, void *pv, 239 252 uint32_t cb, uint32_t u32Format) 240 253 { 241 writeToPasteboard (g_ctx.pasteboard, pv, cb, u32Format); 242 } 254 vboxSvcClipboardLock(); 255 256 writeToPasteboard (pClient->pCtx->pasteboard, pv, cb, u32Format); 257 258 vboxSvcClipboardUnlock(); 259 }
Note:
See TracChangeset
for help on using the changeset viewer.