Changeset 80847 in vbox for trunk/src/VBox/Additions/haiku/VBoxTray/VBoxClipboard.cpp
- Timestamp:
- Sep 17, 2019 9:38:16 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/haiku/VBoxTray/VBoxClipboard.cpp
r80664 r80847 78 78 79 79 80 VBox ClipboardService::VBoxClipboardService()81 : BHandler("VBox ClipboardService"),80 VBoxShClService::VBoxShClService() 81 : BHandler("VBoxShClService"), 82 82 fClientId(-1), 83 83 fServiceThreadID(-1), … … 87 87 88 88 89 VBox ClipboardService::~VBoxClipboardService()90 { 91 } 92 93 94 status_t VBox ClipboardService::Connect()89 VBoxShClService::~VBoxShClService() 90 { 91 } 92 93 94 status_t VBoxShClService::Connect() 95 95 { 96 96 status_t err; … … 100 100 if (RT_SUCCESS(rc)) 101 101 { 102 err = fServiceThreadID = spawn_thread(_ServiceThreadNub, "VBox ClipboardService", B_NORMAL_PRIORITY, this);102 err = fServiceThreadID = spawn_thread(_ServiceThreadNub, "VBoxShClService", B_NORMAL_PRIORITY, this); 103 103 if (err >= B_OK) 104 104 { … … 109 109 return B_OK; 110 110 else 111 LogRel(("VBox ClipboardService: Error watching the system clipboard: %ld\n", err));111 LogRel(("VBoxShClService: Error watching the system clipboard: %ld\n", err)); 112 112 } 113 113 else 114 LogRel(("VBox ClipboardService: Error starting service thread: %ld\n", err));114 LogRel(("VBoxShClService: Error starting service thread: %ld\n", err)); 115 115 116 116 //rc = RTErrConvertFromErrno(err); … … 118 118 } 119 119 else 120 LogRel(("VBox ClipboardService: Error starting service thread: %d\n", rc));120 LogRel(("VBoxShClService: Error starting service thread: %d\n", rc)); 121 121 return B_ERROR; 122 122 } 123 123 124 124 125 status_t VBox ClipboardService::Disconnect()125 status_t VBoxShClService::Disconnect() 126 126 { 127 127 status_t status; … … 138 138 139 139 140 void VBox ClipboardService::MessageReceived(BMessage *message)140 void VBoxShClService::MessageReceived(BMessage *message) 141 141 { 142 142 uint32_t formats = 0; … … 168 168 } 169 169 170 if (formats & VBOX_SH ARED_CLIPBOARD_FMT_UNICODETEXT)171 { 172 pv = _VBoxReadHostClipboard(VBOX_SH ARED_CLIPBOARD_FMT_UNICODETEXT, &cb);170 if (formats & VBOX_SHCL_FMT_UNICODETEXT) 171 { 172 pv = _VBoxReadHostClipboard(VBOX_SHCL_FMT_UNICODETEXT, &cb); 173 173 if (pv) 174 174 { … … 190 190 } 191 191 192 if (formats & VBOX_SH ARED_CLIPBOARD_FMT_BITMAP)193 { 194 pv = _VBoxReadHostClipboard(VBOX_SH ARED_CLIPBOARD_FMT_BITMAP, &cb);192 if (formats & VBOX_SHCL_FMT_BITMAP) 193 { 194 pv = _VBoxReadHostClipboard(VBOX_SHCL_FMT_BITMAP, &cb); 195 195 if (pv) 196 196 { … … 253 253 clip->PrintToStream(); 254 254 255 if (formats & VBOX_SH ARED_CLIPBOARD_FMT_UNICODETEXT)255 if (formats & VBOX_SHCL_FMT_UNICODETEXT) 256 256 { 257 257 const char *text; … … 269 269 uint32_t cb = (RTUtf16Len(pwsz) + 1) * sizeof(RTUTF16); 270 270 271 rc = VbglR3ClipboardWriteData(fClientId, VBOX_SH ARED_CLIPBOARD_FMT_UNICODETEXT, pwsz, cb);271 rc = VbglR3ClipboardWriteData(fClientId, VBOX_SHCL_FMT_UNICODETEXT, pwsz, cb); 272 272 //printf("VbglR3ClipboardWriteData: %d\n", rc); 273 273 RTUtf16Free(pwsz); … … 275 275 } 276 276 } 277 else if (formats & VBOX_SH ARED_CLIPBOARD_FMT_BITMAP)277 else if (formats & VBOX_SHCL_FMT_BITMAP) 278 278 { 279 279 BMessage archivedBitmap; … … 298 298 if (RT_SUCCESS(rc)) 299 299 { 300 rc = VbglR3ClipboardWriteData(fClientId, VBOX_SH ARED_CLIPBOARD_FMT_BITMAP, (void *)pDib,300 rc = VbglR3ClipboardWriteData(fClientId, VBOX_SHCL_FMT_BITMAP, (void *)pDib, 301 301 cbDibSize); 302 302 } … … 335 335 336 336 if (clip->FindData("text/plain", B_MIME_TYPE, &data, &dataLen) == B_OK) 337 formats |= VBOX_SH ARED_CLIPBOARD_FMT_UNICODETEXT;337 formats |= VBOX_SHCL_FMT_UNICODETEXT; 338 338 339 339 if ( clip->HasMessage("image/bitmap") 340 340 || clip->HasMessage("image/x-be-bitmap")) 341 341 { 342 formats |= VBOX_SH ARED_CLIPBOARD_FMT_BITMAP;342 formats |= VBOX_SHCL_FMT_BITMAP; 343 343 } 344 344 … … 359 359 360 360 361 status_t VBox ClipboardService::_ServiceThreadNub(void *_this)362 { 363 VBox ClipboardService *service = (VBoxClipboardService *)_this;361 status_t VBoxShClService::_ServiceThreadNub(void *_this) 362 { 363 VBoxShClService *service = (VBoxShClService *)_this; 364 364 return service->_ServiceThread(); 365 365 } 366 366 367 367 368 status_t VBox ClipboardService::_ServiceThread()369 { 370 printf("VBox ClipboardService::%s()\n", __FUNCTION__);368 status_t VBoxShClService::_ServiceThread() 369 { 370 printf("VBoxShClService::%s()\n", __FUNCTION__); 371 371 372 372 /* The thread waits for incoming messages from the host. */ … … 380 380 switch (u32Msg) 381 381 { 382 case VBOX_SH ARED_CLIPBOARD_HOST_MSG_FORMATS_REPORT:382 case VBOX_SHCL_HOST_MSG_FORMATS_REPORT: 383 383 { 384 384 /* … … 386 386 * the information to the handler. 387 387 */ 388 LogRelFlowFunc(("VBOX_SH ARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS u32Formats=%x\n", u32Formats));388 LogRelFlowFunc(("VBOX_SHCL_HOST_MSG_REPORT_FORMATS u32Formats=%x\n", u32Formats)); 389 389 BMessage msg(VBOX_GUEST_CLIPBOARD_HOST_MSG_FORMATS); 390 390 msg.AddInt32("Formats", (uint32)u32Formats); … … 393 393 } 394 394 395 case VBOX_SH ARED_CLIPBOARD_HOST_MSG_READ_DATA:395 case VBOX_SHCL_HOST_MSG_READ_DATA: 396 396 { 397 397 /* The host needs data in the specified format. */ 398 LogRelFlowFunc(("VBOX_SH ARED_CLIPBOARD_HOST_MSG_READ_DATA u32Formats=%x\n", u32Formats));398 LogRelFlowFunc(("VBOX_SHCL_HOST_MSG_READ_DATA u32Formats=%x\n", u32Formats)); 399 399 BMessage msg(VBOX_GUEST_CLIPBOARD_HOST_MSG_READ_DATA); 400 400 msg.AddInt32("Formats", (uint32)u32Formats); … … 403 403 } 404 404 405 case VBOX_SH ARED_CLIPBOARD_HOST_MSG_QUIT:405 case VBOX_SHCL_HOST_MSG_QUIT: 406 406 { 407 407 /* The host is terminating. */ 408 LogRelFlowFunc(("VBOX_SH ARED_CLIPBOARD_HOST_MSG_QUIT\n"));408 LogRelFlowFunc(("VBOX_SHCL_HOST_MSG_QUIT\n")); 409 409 fExiting = true; 410 410 return VERR_INTERRUPTED; … … 412 412 413 413 default: 414 Log(("VBox ClipboardService::%s: Unsupported message from host! Message = %u\n", __FUNCTION__, u32Msg));414 Log(("VBoxShClService::%s: Unsupported message from host! Message = %u\n", __FUNCTION__, u32Msg)); 415 415 } 416 416 } … … 427 427 428 428 429 void* VBox ClipboardService::_VBoxReadHostClipboard(uint32_t format, uint32_t *pcb)429 void* VBoxShClService::_VBoxReadHostClipboard(uint32_t format, uint32_t *pcb) 430 430 { 431 431 uint32_t cb = 1024;
Note:
See TracChangeset
for help on using the changeset viewer.