Changeset 46301 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- May 28, 2013 7:02:18 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
r46288 r46301 193 193 /** The first XFixes event number */ 194 194 int fixesEventBase; 195 /** The Xt Intrinsics can only handle one outstanding clipboard operation 196 * at a time, so we keep track of whether one is in process. */ 197 bool fBusy; 198 /** We can't handle a clipboard update event while we are busy, so remember 199 * it for later. */ 200 bool fUpdateNeeded; 195 201 }; 196 202 … … 475 481 } 476 482 483 static void clipQueryX11CBFormats(CLIPBACKEND *pCtx); 484 477 485 /** 478 486 * Notify the VBox clipboard about available data formats, based on the … … 489 497 LogRel2(("clipConvertX11Targets: pValue=%p, *pcLen=%u, *atomType=%d, XT_CONVERT_FAIL=%d\n", 490 498 pValue, *pcLen, *atomType, XT_CONVERT_FAIL)); 491 if ( (*atomType == XT_CONVERT_FAIL) /* timeout */ 492 || (pValue == NULL)) /* No data available */ 493 { 494 clipReportEmptyX11CB(pCtx); 495 return; 496 } 497 clipUpdateX11Targets(pCtx, (Atom *)pValue, *pcLen); 499 pCtx->fBusy = false; 500 if (pCtx->fUpdateNeeded) 501 { 502 /* We may already be out of date. */ 503 pCtx->fUpdateNeeded = false; 504 clipQueryX11CBFormats(pCtx); 505 } 506 else 507 { 508 if ( (*atomType == XT_CONVERT_FAIL) /* timeout */ 509 || (pValue == NULL)) /* No data available */ 510 { 511 clipReportEmptyX11CB(pCtx); 512 return; 513 } 514 clipUpdateX11Targets(pCtx, (Atom *)pValue, *pcLen); 515 } 498 516 XtFree(reinterpret_cast<char *>(pValue)); 499 517 } … … 502 520 * Callback to notify us when the contents of the X11 clipboard change. 503 521 */ 504 void clipQueryX11CBFormats(CLIPBACKEND *pCtx)522 static void clipQueryX11CBFormats(CLIPBACKEND *pCtx) 505 523 { 506 524 LogRel2 (("%s: requesting the targets that the X11 clipboard offers\n", 507 525 __PRETTY_FUNCTION__)); 526 if (pCtx->fBusy) 527 { 528 pCtx->fUpdateNeeded = true; 529 return; 530 } 531 pCtx->fBusy = true; 508 532 XtGetSelectionValue(pCtx->widget, 509 533 clipGetAtom(pCtx->widget, "CLIPBOARD"), … … 1593 1617 uint32_t cbDest = 0; 1594 1618 1619 pCtx->fBusy = false; 1620 if (pCtx->fUpdateNeeded) 1621 clipQueryX11CBFormats(pCtx); 1595 1622 if (pvSrc == NULL) 1596 1623 /* The clipboard selection may have changed before we could get it. */ … … 1673 1700 1674 1701 int rc = VINF_SUCCESS; 1675 /* 1676 * VBox wants to read data in the given format. 1677 */ 1678 if (pReq->mFormat == VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) 1679 { 1702 bool fBusy = pCtx->fBusy; 1703 pCtx->fBusy = true; 1704 if (fBusy) 1705 /* If the clipboard is busy just fend off the request. */ 1706 rc = VERR_TRY_AGAIN; 1707 else if (pReq->mFormat == VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT) 1708 { 1709 /* 1710 * VBox wants to read data in the given format. 1711 */ 1680 1712 pReq->mTextFormat = pCtx->X11TextFormat; 1681 1713 if (pReq->mTextFormat == INVALID)
Note:
See TracChangeset
for help on using the changeset viewer.