Changeset 36808 in vbox
- Timestamp:
- Apr 21, 2011 10:42:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp
r28800 r36808 15 15 */ 16 16 17 #include <iostream>18 17 #include <stdlib.h> /* exit() */ 19 18 20 19 #include <iprt/initterm.h> 21 20 #include <iprt/semaphore.h> 21 #include <iprt/stream.h> 22 22 #include <VBox/VBoxGuestLib.h> 23 23 … … 28 28 int VbglR3SeamlessSendRects(uint32_t cRects, PRTRECT pRects) 29 29 { 30 std::cout << "Received rectangle update (" << cRects << " rectangles):" << std::endl;30 RTPrintf("Received rectangle update (%u rectangles):\n", cRects); 31 31 for (unsigned i = 0; i < cRects; ++i) 32 32 { 33 std::cout << " xLeft: " << pRects[i].xLeft << " yTop: " << pRects[i].yTop34 << " xRight: " << pRects[i].xRight << " yBottom: " << pRects[i].yBottom35 << std::endl;33 RTPrintf(" xLeft: %d yTop: %d xRight: %d yBottom: %d\n", 34 pRects[i].xLeft, pRects[i].yTop, pRects[i].xRight, 35 pRects[i].yBottom); 36 36 } 37 37 return true; … … 40 40 int VbglR3SeamlessSetCap(bool bState) 41 41 { 42 std::cout << (bState ? "Seamless capability set" : "Seamless capability unset")43 << std::endl;42 RTPrintf("%s\n", bState ? "Seamless capability set" 43 : "Seamless capability unset"); 44 44 return true; 45 45 } … … 47 47 int VbglR3CtlFilterMask(uint32_t u32OrMask, uint32_t u32NotMask) 48 48 { 49 std::cout << "IRQ filter mask changed. Or mask: 0x" << std::hex << u32OrMask 50 << ". Not mask: 0x" << u32NotMask << std::dec 51 << std::endl; 49 RTPrintf("IRQ filter mask changed. Or mask: 0x%x. Not mask: 0x%x\n", 50 u32OrMask, u32NotMask); 52 51 return true; 53 52 } … … 89 88 { 90 89 /* This can be triggered if a guest application destroys a window before we notice. */ 91 std::cout << "ignoring BadAtom error and returning" << std::endl;90 RTPrintf("ignoring BadAtom error and returning\n"); 92 91 return 0; 93 92 } 94 93 XGetErrorText(pDisplay, pError->error_code, errorText, sizeof(errorText)); 95 std::cout << "An X Window protocol error occurred: " << errorText << std::endl 96 << " Request code: " << int(pError->request_code) << std::endl 97 << " Minor code: " << int(pError->minor_code) << std::endl 98 << " Serial number of the failed request: " << int(pError->serial) 99 << std::endl; 100 std::cout << std::endl << "exiting." << std::endl; 94 RTPrintf("An X Window protocol error occurred: %s\n" 95 " Request code: %d\n" 96 " Minor code: %d\n" 97 " Serial number of the failed request: %d\n\n" 98 "exiting.\n", 99 errorText, (int)pError->request_code, (int)pError->minor_code, 100 (int)pError->serial); 101 101 exit(1); 102 102 } … … 105 105 { 106 106 int rc = VINF_SUCCESS; 107 std::string sTmp;107 char ach[2]; 108 108 109 109 RTR3Init(); 110 std::cout << "VirtualBox guest additions X11 seamless mode testcase" << std::endl;110 RTPrintf("VirtualBox guest additions X11 seamless mode testcase\n"); 111 111 if (0 == XInitThreads()) 112 112 { 113 std::cout << "Failed to initialise X11 threading, exiting." << std::endl;113 RTPrintf("Failed to initialise X11 threading, exiting.\n"); 114 114 exit(1); 115 115 } 116 116 /* Set an X11 error handler, so that we don't die when we get unavoidable errors. */ 117 117 XSetErrorHandler(vboxClientXLibErrorHandler); 118 std::cout << std::endl << "Press <Enter> to exit..." << std::endl;118 RTPrintf("\nPress <Enter> to exit...\n"); 119 119 RTSemEventCreate(&eventSem); 120 120 /** Our instance of the seamless class. */ 121 121 VBoxGuestSeamless seamless; 122 try 122 LogRel(("Starting seamless Guest Additions...\n")); 123 rc = seamless.init(); 124 if (rc != VINF_SUCCESS) 123 125 { 124 LogRel(("Starting seamless Guest Additions...\n")); 125 rc = seamless.init(); 126 if (rc != VINF_SUCCESS) 127 { 128 std::cout << "Failed to initialise seamless Additions, rc = " << rc << std::endl; 129 } 126 RTPrintf("Failed to initialise seamless Additions, rc = %d\n", rc); 130 127 } 131 catch (std::exception e) 132 { 133 std::cout << "Failed to initialise seamless Additions - caught exception: " << e.what() 134 << std::endl; 135 rc = VERR_UNRESOLVED_ERROR; 136 } 137 catch (...) 138 { 139 std::cout << "Failed to initialise seamless Additions - caught unknown exception.\n" 140 << std::endl; 141 rc = VERR_UNRESOLVED_ERROR; 142 } 143 std::getline(std::cin, sTmp); 144 try 145 { 146 seamless.uninit(); 147 } 148 catch (std::exception e) 149 { 150 std::cout << "Error shutting down seamless Additions - caught exception: " << e.what() 151 << std::endl; 152 rc = VERR_UNRESOLVED_ERROR; 153 } 154 catch (...) 155 { 156 std::cout << "Error shutting down seamless Additions - caught unknown exception.\n" 157 << std::endl; 158 rc = VERR_UNRESOLVED_ERROR; 159 } 128 RTStrmGetLine(g_pStdIn, ach, sizeof(ach)); 129 seamless.uninit(); 160 130 return rc; 161 131 }
Note:
See TracChangeset
for help on using the changeset viewer.