- Timestamp:
- May 8, 2009 4:16:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
r19534 r19535 55 55 #include <VBox/HostServices/VBoxClipboardSvc.h> 56 56 57 /** Do we want to test Utf8 by disabling other text formats? */58 static bool g_testUtf8 = false;59 /** Do we want to test compount text by disabling other text formats? */60 static bool g_testCText = false;61 /** Are we currently debugging the clipboard code? */62 static bool g_debugClipboard = false;63 64 57 /** The different clipboard formats which we support. */ 65 58 enum CLIPFORMAT … … 79 72 const char *pcszAtom; 80 73 /** The format corresponding to the name */ 81 CLIPFORMAT enmFormat;74 CLIPFORMAT enmFormat; 82 75 /** The corresponding VBox clipboard format */ 83 uint32_t u32VBoxFormat;76 uint32_t u32VBoxFormat; 84 77 } g_aFormats[] = 85 78 { … … 548 541 unsigned cAtoms = *pcLen; 549 542 CLIPFORMAT enmBestTarget = INVALID; 550 CLIPFORMAT enmRequiredTarget = INVALID;551 543 Atom atomBestTarget = None; 552 544 … … 561 553 return; 562 554 } 563 564 /* Debugging stuff */565 if (g_testUtf8)566 enmRequiredTarget = UTF8;567 else if (g_testCText)568 enmRequiredTarget = CTEXT;569 555 570 556 for (unsigned i = 0; i < cAtoms; ++i) … … 576 562 if (atomTargets[i] == formatAtom) 577 563 { 578 if ( enmBestTarget < g_aFormats[j].enmFormat 579 /* debugging stuff */ 580 && ( enmRequiredTarget == INVALID 581 || enmRequiredTarget == g_aFormats[j].enmFormat)) 564 if ( enmBestTarget < g_aFormats[j].enmFormat) 582 565 { 583 566 enmBestTarget = g_aFormats[j].enmFormat; … … 587 570 } 588 571 } 589 if (g_debugClipboard)590 {591 char *szAtomName = XGetAtomName(XtDisplay(pCtx->widget),592 atomTargets[i]);593 if (szAtomName != 0)594 {595 Log2 (("%s: the host offers target %s\n", __PRETTY_FUNCTION__,596 szAtomName));597 XFree(szAtomName);598 }599 }600 572 } 601 573 pCtx->atomX11TextFormat = atomBestTarget; … … 603 575 { 604 576 uint32_t u32Formats = 0; 605 if (g_debugClipboard)606 {607 if (atomBestTarget != None)608 {609 char *szAtomName = XGetAtomName(XtDisplay(pCtx->widget),610 atomBestTarget);611 Log2 (("%s: switching to host text target %s. Available targets are:\n",612 __PRETTY_FUNCTION__, szAtomName));613 XFree(szAtomName);614 }615 else616 Log2(("%s: no supported host text target found. Available targets are:\n",617 __PRETTY_FUNCTION__));618 for (unsigned i = 0; i < cAtoms; ++i)619 {620 char *szAtomName = XGetAtomName(XtDisplay(pCtx->widget),621 atomTargets[i]);622 if (szAtomName != 0)623 {624 Log2 (("%s: %s\n", __PRETTY_FUNCTION__, szAtomName));625 XFree(szAtomName);626 }627 }628 }629 577 pCtx->X11TextFormat = enmBestTarget; 630 578 if (enmBestTarget != INVALID) … … 825 773 g_fHaveX11 = false; 826 774 return pCtx; 827 }828 829 if (RTEnvGet("VBOX_CBTEST_UTF8"))830 {831 g_testUtf8 = true;832 LogRel(("Host clipboard: testing Utf8\n"));833 }834 else if (RTEnvGet("VBOX_CBTEST_CTEXT"))835 {836 g_testCText = true;837 LogRel(("Host clipboard: testing compound text\n"));838 }839 else if (RTEnvGet("VBOX_CBDEBUG"))840 {841 g_debugClipboard = true;842 LogRel(("Host clipboard: enabling additional debugging output\n"));843 775 } 844 776 … … 982 914 atomTargets[cTargets + 1] = clipGetAtom(pCtx->widget, "MULTIPLE"); 983 915 atomTargets[cTargets + 2] = clipGetAtom(pCtx->widget, "TIMESTAMP"); 984 if (g_debugClipboard)985 {986 for (unsigned i = 0; i < cTargets + 3; i++)987 {988 char *szAtomName = XGetAtomName(XtDisplay(pCtx->widget), atomTargets[i]);989 if (szAtomName != 0)990 {991 Log2 (("%s: returning target %s\n", __PRETTY_FUNCTION__,992 szAtomName));993 XFree(szAtomName);994 }995 else996 {997 Log(("%s: invalid atom %d in the list!\n", __PRETTY_FUNCTION__,998 atomTargets[i]));999 }1000 }1001 }1002 916 *atomTypeReturn = XA_ATOM; 1003 917 *pValReturn = reinterpret_cast<XtPointer>(atomTargets); … … 1311 1225 LogFlowFunc(("rc = false\n")); 1312 1226 return false; 1313 }1314 if (g_debugClipboard)1315 {1316 char *szAtomName = XGetAtomName(XtDisplay(pCtx->widget), *atomTarget);1317 if (szAtomName != 0)1318 {1319 Log2 (("%s: request for format %s\n", __PRETTY_FUNCTION__, szAtomName));1320 XFree(szAtomName);1321 }1322 else1323 {1324 LogFunc (("request for invalid target atom %d!\n", *atomTarget));1325 }1326 1227 } 1327 1228 if (*atomTarget == clipGetAtom(pCtx->widget, "TARGETS"))
Note:
See TracChangeset
for help on using the changeset viewer.