Changeset 81040 in vbox
- Timestamp:
- Sep 27, 2019 9:45:46 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133643
- Location:
- trunk/src/VBox/Additions/x11/VBoxClient
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/VBoxClient.h
r76563 r81040 27 27 #include <iprt/string.h> 28 28 29 /** Exit with a fatal error. */ 30 #define VBClFatalError(format) \ 31 do { \ 32 char *pszMessage = RTStrAPrintf2 format; \ 33 LogRel(format); \ 34 vbclFatalError(pszMessage); \ 35 } while(0) 36 37 /** Exit with a fatal error. */ 38 extern DECLNORETURN(void) vbclFatalError(char *pszMessage); 29 void VBClLogInfo(const char *pszFormat, ...); 30 void VBClLogError(const char *pszFormat, ...); 31 void VBClLogFatalError(const char *pszFormat, ...); 39 32 40 33 /** Call clean-up for the current service and exit. */ -
trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp
r81028 r81040 70 70 LogRelFlowFunc(("u32Format=%d, pv=%p, cb=%d\n", u32Format, pv, cb)); 71 71 rc = VbglR3ClipboardWriteData(g_ctx.client, u32Format, pv, cb); 72 LogRelFlowFunc (("rc=%Rrc\n", rc));72 LogRelFlowFuncLeaveRC(rc); 73 73 return rc; 74 74 } … … 88 88 int ClipRequestDataForX11(SHCLCONTEXT *pCtx, uint32_t u32Format, void **ppv, uint32_t *pcb) 89 89 { 90 RT_NOREF 1(pCtx);90 RT_NOREF(pCtx); 91 91 int rc = VINF_SUCCESS; 92 92 uint32_t cb = 1024; … … 127 127 RTMemFree(pv); 128 128 } 129 LogRelFlowFunc (("returning %Rrc\n", rc));129 LogRelFlowFuncLeaveRC(rc); 130 130 if (RT_SUCCESS(rc)) 131 131 LogRelFlow((" *pcb=%d\n", *pcb)); … … 150 150 void ClipReportX11Formats(SHCLCONTEXT *pCtx, uint32_t u32Formats) 151 151 { 152 RT_NOREF 1(pCtx);152 RT_NOREF(pCtx); 153 153 LogRelFlowFunc(("u32Formats=%d\n", u32Formats)); 154 154 int rc = VbglR3ClipboardFormatsReport(g_ctx.client, u32Formats); 155 LogRelFlowFunc (("rc=%Rrc\n", rc));155 LogRelFlowFuncLeaveRC(rc); 156 156 } 157 157 … … 168 168 void ClipRequestFromX11CompleteCallback(SHCLCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb) 169 169 { 170 RT_NOREF 1(pCtx);170 RT_NOREF(pCtx); 171 171 if (RT_SUCCESS(rc)) 172 172 vboxClipboardSendData(pReq->u32Format, pv, cb); … … 197 197 rc = VbglR3ClipboardConnect(&g_ctx.client); 198 198 if (RT_FAILURE(rc)) 199 LogRel(("Error connecting to host. rc=%Rrc\n", rc));199 VBClLogError("Error connecting to host, rc=%Rrc\n", rc); 200 200 else if (!g_ctx.client) 201 201 { 202 LogRel(("Invalid client ID of 0\n"));202 VBClLogError("Invalid client ID of 0\n"); 203 203 rc = VERR_NOT_SUPPORTED; 204 204 } … … 207 207 if (rc != VINF_SUCCESS && g_ctx.pBackend) 208 208 ClipDestructX11(g_ctx.pBackend); 209 LogRelFlowFunc(("g_ctx.client=%u rc=%Rrc\n", g_ctx.client, rc)); 209 210 LogRelFlowFuncLeaveRC(rc); 210 211 return rc; 211 212 } … … 271 272 272 273 default: 273 LogRel2(("Unsupported message from host!!!\n")); 274 { 275 VBClLogInfo("Unsupported message from host (%RU32)\n", Msg); 276 break; 277 } 274 278 } 275 279 } … … 277 281 LogRelFlow(("processed host event rc = %d\n", rc)); 278 282 } 279 LogRelFlowFunc (("rc=%d\n", rc));283 LogRelFlowFuncLeaveRC(rc); 280 284 return rc; 281 285 } … … 288 292 static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised) 289 293 { 290 RT_NOREF 2(ppInterface, fDaemonised);294 RT_NOREF(ppInterface, fDaemonised); 291 295 292 296 /* Initialise the guest library. */ … … 327 331 328 332 if (!pService) 329 VBCl FatalError(("Out of memory\n"));333 VBClLogFatalError("Out of memory\n"); 330 334 pService->pInterface = &vbclClipboardInterface; 331 335 return &pService->pInterface; -
trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
r81028 r81040 63 63 64 64 if (uname(&name) == -1) 65 VBCl FatalError(("Failed to get kernel name.\n"));65 VBClLogFatalError("Failed to get kernel name\n"); 66 66 if (strcmp(name.sysname, "Linux")) 67 67 return false; … … 81 81 82 82 if (pContext->pDisplay != NULL) 83 VBCl FatalError(("%s called with bad argument\n", __func__));83 VBClLogFatalError("%s called with bad argument\n", __func__); 84 84 pContext->pDisplay = XOpenDisplay(NULL); 85 85 if (pContext->pDisplay == NULL) … … 156 156 _XFlush(pContext->pDisplay); 157 157 if (pContext->pDisplay->bufptr + cb > pContext->pDisplay->bufmax) 158 VBCl FatalError(("%s display buffer overflow.\n", __func__));158 VBClLogFatalError("%s display buffer overflow\n", __func__); 159 159 if (cb % 4 != 0) 160 VBCl FatalError(("%s bad parameter.\n", __func__));160 VBClLogFatalError("%s bad parameter\n", __func__); 161 161 pContext->pDisplay->last_req = pContext->pDisplay->bufptr; 162 162 *ppReq = (struct X11REQHEADER *)pContext->pDisplay->bufptr; … … 178 178 179 179 if (!VALID_PTR(pContext->pDisplay)) 180 VBCl FatalError(("%s bad display argument.\n", __func__));180 VBClLogFatalError("%s bad display argument\n", __func__); 181 181 if (cRects == 0) 182 182 return; … … 205 205 return; 206 206 /* What now? */ 207 VBCl FatalError(("%s failed to set resolution\n", __func__));207 VBClLogFatalError("%s failed to set resolution\n", __func__); 208 208 } 209 209 … … 215 215 216 216 if (!VALID_PTR(pContext->pDisplay)) 217 VBCl FatalError(("%s bad display argument.\n", __func__));217 VBClLogFatalError("%s bad display argument\n", __func__); 218 218 x11GetRequest(pContext, pContext->hRandRMajor, X11_RANDR_GET_SCREEN_REQUEST, 219 219 sizeof(struct X11RANDRGETSCREENREQ), … … 222 222 _XSend(pContext->pDisplay, NULL, 0); 223 223 if (!_XReply(pContext->pDisplay, (xReply *)&repGetScreen, 0, xTrue)) 224 VBCl FatalError(("%s failed to set resolution\n", __func__));224 VBClLogFatalError("%s failed to set resolution\n", __func__); 225 225 } 226 226 … … 247 247 rc = VbglR3CtlFilterMask(VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST, 0); 248 248 if (RT_FAILURE(rc)) 249 VBCl FatalError(("Failed to request display change events, rc=%Rrc\n", rc));249 VBClLogFatalError("Failed to request display change events, rc=%Rrc\n", rc); 250 250 rc = VbglR3AcquireGuestCaps(VMMDEV_GUEST_SUPPORTS_GRAPHICS, 0, false); 251 251 if (rc == VERR_RESOURCE_BUSY) /* Someone else has already acquired it. */ 252 252 return VINF_SUCCESS; 253 253 if (RT_FAILURE(rc)) 254 VBCl FatalError(("Failed to register resizing support, rc=%Rrc\n", rc));254 VBClLogFatalError("Failed to register resizing support, rc=%Rrc\n", rc); 255 255 for (;;) 256 256 { … … 263 263 rc = VbglR3GetDisplayChangeRequestMulti(VMW_MAX_HEADS, &cDisplaysOut, aDisplays, true); 264 264 if (RT_FAILURE(rc)) 265 VBCl FatalError(("Failed to get display change request, rc=%Rrc\n", rc));265 VBClLogFatalError("Failed to get display change request, rc=%Rrc\n", rc); 266 266 if (cDisplaysOut > VMW_MAX_HEADS) 267 VBCl FatalError(("Display change request contained, rc=%Rrc\n", rc));267 VBClLogFatalError("Display change request contained, rc=%Rrc\n", rc); 268 268 for (i = 0, cHeads = 0; i < cDisplaysOut && i < VMW_MAX_HEADS; ++i) 269 269 { … … 289 289 rc = VbglR3WaitEvent(VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST, RT_INDEFINITE_WAIT, &events); 290 290 if (RT_FAILURE(rc)) 291 VBCl FatalError(("Failure waiting for event, rc=%Rrc\n", rc));291 VBClLogFatalError("Failure waiting for event, rc=%Rrc\n", rc); 292 292 } 293 293 } -
trunk/src/VBox/Additions/x11/VBoxClient/display-svga.cpp
r81028 r81040 102 102 103 103 if (pContext->hDevice != NIL_RTFILE) 104 VBCl FatalError(("%s called with bad argument\n", __func__));104 VBClLogFatalError("%s called with bad argument\n", __func__); 105 105 /* Try to open the SVGA DRM device. */ 106 106 for (i = 0; i < 128; ++i) … … 121 121 rc = RTStrPrintf(szPath, sizeof(szPath), "/dev/dri/controlD%u", i / 2 + 64); 122 122 if (RT_FAILURE(rc)) 123 VBCl FatalError(("RTStrPrintf of device path failed, rc=%Rrc\n", rc));123 VBClLogFatalError("RTStrPrintf of device path failed, rc=%Rrc\n", rc); 124 124 rc = RTFileOpen(&hDevice, szPath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 125 125 if (RT_FAILURE(rc)) … … 158 158 159 159 if (pContext->hDevice == NIL_RTFILE) 160 VBCl FatalError(("%s bad device argument.\n", __func__));160 VBClLogFatalError("%s bad device argument\n", __func__); 161 161 ioctlLayout.cOutputs = cHeads; 162 162 ioctlLayout.ptrRects = (uint64_t)paRects; … … 164 164 &ioctlLayout, sizeof(ioctlLayout), NULL); 165 165 if (RT_FAILURE(rc) && rc != VERR_INVALID_PARAMETER) 166 VBCl FatalError(("Failure updating layout, rc=%Rrc\n", rc));166 VBClLogFatalError("Failure updating layout, rc=%Rrc\n", rc); 167 167 } 168 168 … … 190 190 rc = VbglR3CtlFilterMask(VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST, 0); 191 191 if (RT_FAILURE(rc)) 192 VBCl FatalError(("Failed to request display change events, rc=%Rrc\n", rc));192 VBClLogFatalError("Failed to request display change events, rc=%Rrc\n", rc); 193 193 rc = VbglR3AcquireGuestCaps(VMMDEV_GUEST_SUPPORTS_GRAPHICS, 0, false); 194 194 if (rc == VERR_RESOURCE_BUSY) /* Someone else has already acquired it. */ 195 195 return VINF_SUCCESS; 196 196 if (RT_FAILURE(rc)) 197 VBCl FatalError(("Failed to register resizing support, rc=%Rrc\n", rc));197 VBClLogFatalError("Failed to register resizing support, rc=%Rrc\n", rc); 198 198 for (;;) 199 199 { … … 207 207 fAck = true; 208 208 if (RT_FAILURE(rc)) 209 VBCl FatalError(("Failed to get display change request, rc=%Rrc\n", rc));209 VBClLogFatalError("Failed to get display change request, rc=%Rrc\n", rc); 210 210 if (cDisplaysOut > VMW_MAX_HEADS) 211 VBCl FatalError(("Display change request contained, rc=%Rrc\n", rc));211 VBClLogFatalError("Display change request contained, rc=%Rrc\n", rc); 212 212 for (i = 0, cHeads = 0; i < cDisplaysOut && i < VMW_MAX_HEADS; ++i) 213 213 { … … 233 233 rc = VbglR3WaitEvent(VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST, RT_INDEFINITE_WAIT, &events); 234 234 if (RT_FAILURE(rc)) 235 VBCl FatalError(("Failure waiting for event, rc=%Rrc\n", rc));235 VBClLogFatalError("Failure waiting for event, rc=%Rrc\n", rc); 236 236 } 237 237 } -
trunk/src/VBox/Additions/x11/VBoxClient/display.cpp
r76553 r81040 214 214 status = system(pState->pcszXrandr); 215 215 if (WEXITSTATUS(status) != 0) /* Utility or extension not available. */ 216 VBCl FatalError(("Failed to execute the xrandr utility.\n"));216 VBClLogFatalError("Failed to execute the xrandr utility\n"); 217 217 RTStrPrintf(szCommand, sizeof(szCommand), "%s --q12", pState->pcszXrandr); 218 218 status = system(szCommand); … … 231 231 struct DISPLAYSTATE *pSelf = (struct DISPLAYSTATE *)ppInterface; 232 232 if (pSelf->magic != DISPLAYSTATE_MAGIC) 233 VBCl FatalError(("Bad display service object!\n"));233 VBClLogFatalError("Bad display service object!\n"); 234 234 return pSelf; 235 235 } … … 274 274 275 275 if (!pService) 276 VBCl FatalError(("Out of memory\n"));276 VBClLogFatalError("Out of memory\n"); 277 277 pService->pInterface = &vbclDisplayInterface; 278 278 pService->magic = DISPLAYSTATE_MAGIC; -
trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
r81028 r81040 523 523 void uninit(void); 524 524 void reset(void); 525 526 /* Logging. */527 VBOX_DND_FN_DECL_LOG(void) logInfo(const char *pszFormat, ...);528 VBOX_DND_FN_DECL_LOG(void) logError(const char *pszFormat, ...);529 525 530 526 /* X11 message processing. */ … … 860 856 if (!m_wndProxy.hWnd) 861 857 { 862 LogRel(("DnD: Error creating proxy window\n"));858 VBClLogError("Error creating proxy window\n"); 863 859 rc = VERR_GENERAL_FAILURE; 864 860 break; … … 868 864 if (RT_FAILURE(rc)) 869 865 { 870 LogRel(("DnD: Error initializing proxy window, rc=%Rrc\n", rc));866 VBClLogError("Error initializing proxy window, rc=%Rrc\n", rc); 871 867 break; 872 868 } … … 878 874 XFlush(m_pDisplay); 879 875 #endif 880 logInfo("Proxy window=%RU32, root window=%RU32 ...\n", m_wndProxy.hWnd, m_wndRoot);876 VBClLogInfo("Proxy window=%RU32, root window=%RU32 ...\n", m_wndProxy.hWnd, m_wndRoot); 881 877 882 878 /* Set the window's name for easier lookup. */ … … 894 890 } 895 891 else 896 logError("Initializing drag instance for screen %RU32 failed with rc=%Rrc\n", uScreenID, rc);892 VBClLogError("Initializing drag instance for screen %RU32 failed with rc=%Rrc\n", uScreenID, rc); 897 893 898 894 LogFlowFuncLeaveRC(rc); 899 895 return rc; 900 }901 902 /**903 * Logs an error message to the (release) logging instance.904 *905 * @param pszFormat Format string to log.906 */907 VBOX_DND_FN_DECL_LOG(void) DragInstance::logError(const char *pszFormat, ...)908 {909 va_list args;910 va_start(args, pszFormat);911 char *psz = NULL;912 RTStrAPrintfV(&psz, pszFormat, args);913 va_end(args);914 915 AssertPtr(psz);916 LogFlowFunc(("%s", psz));917 LogRel(("DnD: %s", psz));918 919 RTStrFree(psz);920 }921 922 /**923 * Logs an info message to the (release) logging instance.924 *925 * @param pszFormat Format string to log.926 */927 VBOX_DND_FN_DECL_LOG(void) DragInstance::logInfo(const char *pszFormat, ...)928 {929 va_list args;930 va_start(args, pszFormat);931 char *psz = NULL;932 RTStrAPrintfV(&psz, pszFormat, args);933 va_end(args);934 935 AssertPtr(psz);936 LogFlowFunc(("%s", psz));937 LogRel2(("DnD: %s", psz));938 939 RTStrFree(psz);940 896 } 941 897 … … 1154 1110 False /* Propagate */, NoEventMask, reinterpret_cast<XEvent *>(&m)); 1155 1111 if (xRc == 0) 1156 logError("Error sending position XA_XdndStatus event to current window=%#x: %s\n",1157 m_wndCur, gX11->xErrorToString(xRc).c_str());1112 VBClLogError("Error sending position XA_XdndStatus event to current window=%#x: %s\n", 1113 m_wndCur, gX11->xErrorToString(xRc).c_str()); 1158 1114 } 1159 1115 else if ( e.xclient.message_type == xAtom(XA_XdndLeave) … … 1161 1117 { 1162 1118 LogFlowThisFunc(("XA_XdndLeave\n")); 1163 logInfo("Guest to host transfer canceled by the guest source window\n");1119 VBClLogInfo("Guest to host transfer canceled by the guest source window\n"); 1164 1120 1165 1121 /* Start over. */ … … 1174 1130 { 1175 1131 /* Can occur when dragging from guest->host, but then back in to the guest again. */ 1176 logInfo("Could not drop on own proxy window\n"); /* Not fatal. */1132 VBClLogInfo("Could not drop on own proxy window\n"); /* Not fatal. */ 1177 1133 1178 1134 /* Let the source know. */ … … 1189 1145 else /* Unhandled event, abort. */ 1190 1146 { 1191 logInfo("Unhandled event from wnd=%#x, msg=%s\n", e.xclient.window, xAtomToString(e.xclient.message_type).c_str());1147 VBClLogInfo("Unhandled event from wnd=%#x, msg=%s\n", e.xclient.window, xAtomToString(e.xclient.message_type).c_str()); 1192 1148 1193 1149 /* Let the source know. */ … … 1335 1291 if (pReq->target == xAtom(XA_TARGETS)) 1336 1292 { 1337 logInfo("Target window %#x ('%s') asking for target list\n", e.xselectionrequest.requestor, pszWndName);1293 VBClLogInfo("Target window %#x ('%s') asking for target list\n", e.xselectionrequest.requestor, pszWndName); 1338 1294 1339 1295 /* If so, set the window property with the formats on the requestor … … 1346 1302 else if (m_lstFormats.contains(pReq->target)) 1347 1303 { 1348 logInfo("Target window %#x ('%s') is asking for data as '%s'\n",1349 pReq->requestor, pszWndName, xAtomToString(pReq->target).c_str());1304 VBClLogInfo("Target window %#x ('%s') is asking for data as '%s'\n", 1305 pReq->requestor, pszWndName, xAtomToString(pReq->target).c_str()); 1350 1306 1351 1307 /* Did we not drop our stuff to the guest yet? Bail out. */ … … 1360 1316 RTCString strFormat = xAtomToString(pReq->target); 1361 1317 Assert(strFormat.isNotEmpty()); 1362 logInfo("Target window=%#x requested data from host as '%s', rc=%Rrc\n",1363 pReq->requestor, strFormat.c_str(), rc);1318 VBClLogInfo("Target window=%#x requested data from host as '%s', rc=%Rrc\n", 1319 pReq->requestor, strFormat.c_str(), rc); 1364 1320 1365 1321 /* Make a copy of the MIME data to be passed back. The X server will be become … … 1388 1344 else 1389 1345 { 1390 logError("Refusing unknown command/format '%s' of wnd=%#x ('%s')\n",1391 xAtomToString(e.xselectionrequest.target).c_str(), pReq->requestor, pszWndName);1346 VBClLogError("Refusing unknown command/format '%s' of wnd=%#x ('%s')\n", 1347 xAtomToString(e.xselectionrequest.target).c_str(), pReq->requestor, pszWndName); 1392 1348 rc = VERR_NOT_SUPPORTED; 1393 1349 } … … 1399 1355 int xRc = XSendEvent(pReq->display, pReq->requestor, True /* Propagate */, 0, &s); 1400 1356 if (xRc == 0) 1401 logError("Error sending SelectionNotify(1) event to wnd=%#x: %s\n", pReq->requestor,1402 gX11->xErrorToString(xRc).c_str());1357 VBClLogError("Error sending SelectionNotify(1) event to wnd=%#x: %s\n", pReq->requestor, 1358 gX11->xErrorToString(xRc).c_str()); 1403 1359 XFlush(pReq->display); 1404 1360 … … 1749 1705 if (xRc != Success) 1750 1706 { 1751 logError("Error getting properties of cursor window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str());1707 VBClLogError("Error getting properties of cursor window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str()); 1752 1708 } 1753 1709 else … … 1756 1712 { 1757 1713 /** @todo Do we need to deal with this? */ 1758 logError("Wrong window properties for window %#x: pcData=%#x, iFmt=%d, cItems=%ul\n",1759 wndCursor, pcData, fmt, cItems);1714 VBClLogError("Wrong window properties for window %#x: pcData=%#x, iFmt=%d, cItems=%ul\n", 1715 wndCursor, pcData, fmt, cItems); 1760 1716 } 1761 1717 else … … 1789 1745 char *pszWndName = wndX11GetNameA(m_wndCur); 1790 1746 AssertPtr(pszWndName); 1791 logInfo("Left old window %#x ('%s'), Xdnd version=%ld\n", m_wndCur, pszWndName, newVer);1747 VBClLogInfo("Left old window %#x ('%s'), Xdnd version=%ld\n", m_wndCur, pszWndName, newVer); 1792 1748 RTStrFree(pszWndName); 1793 1749 … … 1804 1760 xRc = XSendEvent(m_pDisplay, m_wndCur, False, NoEventMask, reinterpret_cast<XEvent*>(&m)); 1805 1761 if (xRc == 0) 1806 logError("Error sending XA_XdndLeave event to old window=%#x: %s\n", m_wndCur, gX11->xErrorToString(xRc).c_str());1762 VBClLogError("Error sending XA_XdndLeave event to old window=%#x: %s\n", m_wndCur, gX11->xErrorToString(xRc).c_str()); 1807 1763 1808 1764 /* Reset our current window. */ … … 1821 1777 char *pszWndName = wndX11GetNameA(wndCursor); 1822 1778 AssertPtr(pszWndName); 1823 logInfo("Entered new window %#x ('%s'), supports Xdnd version=%ld\n", wndCursor, pszWndName, newVer);1779 VBClLogInfo("Entered new window %#x ('%s'), supports Xdnd version=%ld\n", wndCursor, pszWndName, newVer); 1824 1780 RTStrFree(pszWndName); 1825 1781 … … 1851 1807 xRc = XSendEvent(m_pDisplay, wndCursor, False, NoEventMask, reinterpret_cast<XEvent*>(&m)); 1852 1808 if (xRc == 0) 1853 logError("Error sending XA_XdndEnter event to window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str());1809 VBClLogError("Error sending XA_XdndEnter event to window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str()); 1854 1810 } 1855 1811 … … 1880 1836 xRc = XSendEvent(m_pDisplay, wndCursor, False, NoEventMask, reinterpret_cast<XEvent*>(&m)); 1881 1837 if (xRc == 0) 1882 logError("Error sending XA_XdndPosition event to current window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str());1838 VBClLogError("Error sending XA_XdndPosition event to current window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str()); 1883 1839 } 1884 1840 … … 1933 1889 1934 1890 int rc = VbglR3DnDHGSendReqData(&m_dndCtx, szFormat); 1935 logInfo("Drop event from host resulted in: %Rrc\n", rc);1891 VBClLogInfo("Drop event from host resulted in: %Rrc\n", rc); 1936 1892 1937 1893 LogFlowFuncLeaveRC(rc); … … 1972 1928 * be on the guest, so proceed working on communicating with the target window. 1973 1929 */ 1974 logInfo("Received %RU32 bytes of URI list meta data from host\n", cbData);1930 VBClLogInfo("Received %RU32 bytes of URI list meta data from host\n", cbData); 1975 1931 1976 1932 /* Destroy any old data. */ … … 2017 1973 int xRc = XSendEvent(m_pDisplay, m_wndCur, False /* Propagate */, NoEventMask, reinterpret_cast<XEvent*>(&m)); 2018 1974 if (xRc == 0) 2019 logError("Error sending XA_XdndDrop event to window=%#x: %s\n", m_wndCur, gX11->xErrorToString(xRc).c_str());1975 VBClLogError("Error sending XA_XdndDrop event to window=%#x: %s\n", m_wndCur, gX11->xErrorToString(xRc).c_str()); 2020 1976 XFlush(m_pDisplay); 2021 1977 … … 2097 2053 char *pszWndName = wndX11GetNameA(wndSelection); 2098 2054 AssertPtr(pszWndName); 2099 logInfo("New guest source window %#x ('%s')\n", wndSelection, pszWndName);2055 VBClLogInfo("New guest source window %#x ('%s')\n", wndSelection, pszWndName); 2100 2056 2101 2057 /* Start over. */ … … 2141 2097 if (fWaitFailed) 2142 2098 { 2143 logError("Error mapping proxy window to guest source window %#x ('%s'), rc=%Rrc\n",2144 wndSelection, pszWndName, rc);2099 VBClLogError("Error mapping proxy window to guest source window %#x ('%s'), rc=%Rrc\n", 2100 wndSelection, pszWndName, rc); 2145 2101 2146 2102 /* Reset the counter in any case. */ … … 2153 2109 } 2154 2110 else 2155 logInfo("No guest source window\n");2111 VBClLogInfo("No guest source window\n"); 2156 2112 } 2157 2113 … … 2182 2138 if (RT_FAILURE(rc2)) 2183 2139 { 2184 logError("Error reporting pending drag and drop operation status to host: %Rrc\n", rc2);2140 VBClLogError("Error reporting pending drag and drop operation status to host: %Rrc\n", rc2); 2185 2141 if (RT_SUCCESS(rc)) 2186 2142 rc = rc2; … … 2294 2250 &aPropType, &iPropFormat, &cItems, &cbRemaining, &pcData); 2295 2251 if (xRc != Success) 2296 logError("Error getting XA_XdndSelection property of proxy window=%#x: %s\n",2297 m_wndProxy.hWnd, gX11->xErrorToString(xRc).c_str());2252 VBClLogError("Error getting XA_XdndSelection property of proxy window=%#x: %s\n", 2253 m_wndProxy.hWnd, gX11->xErrorToString(xRc).c_str()); 2298 2254 2299 2255 LogFlowThisFunc(("strType=%s, iPropFormat=%d, cItems=%RU32, cbRemaining=%RU32\n", … … 2348 2304 AssertMsgFailed(("Incremental transfers are not supported yet\n")); 2349 2305 2350 logError("Incremental transfers are not supported yet\n");2306 VBClLogError("Incremental transfers are not supported yet\n"); 2351 2307 rc = VERR_NOT_IMPLEMENTED; 2352 2308 } 2353 2309 else 2354 2310 { 2355 logError("Not supported data type: %s\n", gX11->xAtomToString(aPropType).c_str());2311 VBClLogError("Not supported data type: %s\n", gX11->xAtomToString(aPropType).c_str()); 2356 2312 rc = VERR_NOT_SUPPORTED; 2357 2313 } … … 2362 2318 if (fCancel) 2363 2319 { 2364 logInfo("Cancelling dropping to host\n");2320 VBClLogInfo("Cancelling dropping to host\n"); 2365 2321 2366 2322 /* Cancel the operation -- inform the source window by … … 2504 2460 int xRc = XTestFakeButtonEvent(m_pDisplay, 1, fPress ? True : False, CurrentTime); 2505 2461 if (Rc == 0) 2506 logError("Error sending XTestFakeButtonEvent event: %s\n", gX11->xErrorToString(xRc).c_str());2462 VBClLogError("Error sending XTestFakeButtonEvent event: %s\n", gX11->xErrorToString(xRc).c_str()); 2507 2463 XFlush(m_pDisplay); 2508 2464 } … … 2550 2506 reinterpret_cast<XEvent*>(&eBtn)); 2551 2507 if (xRc == 0) 2552 logError("Error sending XButtonEvent event to window=%#x: %s\n", wndDest, gX11->xErrorToString(xRc).c_str());2508 VBClLogError("Error sending XButtonEvent event to window=%#x: %s\n", wndDest, gX11->xErrorToString(xRc).c_str()); 2553 2509 2554 2510 XFlush(m_pDisplay); … … 3022 2978 if (xRc == 0) 3023 2979 { 3024 LogRel(("DnD:Error sending XA_XdndFinished event to source window=%#x: %s\n",3025 hWndSource, gX11->xErrorToString(xRc).c_str()));2980 VBClLogError("Error sending XA_XdndFinished event to source window=%#x: %s\n", 2981 hWndSource, gX11->xErrorToString(xRc).c_str()); 3026 2982 3027 2983 return VERR_GENERAL_FAILURE; /** @todo Fudge. */ … … 3048 3004 if (!m_pDisplay) 3049 3005 { 3050 VBCl FatalError(("DnD: Unable to connect to X server -- running in a terminal session?\n"));3006 VBClLogFatalError("Unable to connect to X server -- running in a terminal session?\n"); 3051 3007 return VERR_NOT_FOUND; 3052 3008 } … … 3100 3056 3101 3057 if (RT_FAILURE(rc)) 3102 LogRel(("DnD: Failed to initialize, rc=%Rrc\n", rc));3058 VBClLogError("Failed to initialize, rc=%Rrc\n", rc); 3103 3059 3104 3060 LogFlowFuncLeaveRC(rc); … … 3137 3093 { 3138 3094 if (RT_FAILURE(rc)) 3139 LogRel(("DnD: Unable to connect to drag and drop service, rc=%Rrc\n", rc));3095 VBClLogError("Unable to connect to drag and drop service, rc=%Rrc\n", rc); 3140 3096 else if (rc == VINF_PERMISSION_DENIED) 3141 LogRel(("DnD: Not available on host, terminating\n"));3097 VBClLogError("Not available on host, terminating\n"); 3142 3098 break; 3143 3099 } 3144 3100 3145 LogRel(("DnD: Started\n"));3146 LogRel2(("DnD: %sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()));3101 VBClLogInfo("Started\n"); 3102 VBClLogInfo("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()); 3147 3103 3148 3104 /* Enter the main event processing loop. */ … … 3255 3211 default: 3256 3212 { 3257 m_pCurDnD->logError("Received unsupported message '%RU32'\n", pVbglR3Event->enmType);3213 VBClLogError("Received unsupported message '%RU32'\n", pVbglR3Event->enmType); 3258 3214 rc = VERR_NOT_SUPPORTED; 3259 3215 break; … … 3265 3221 { 3266 3222 /* Tell the user. */ 3267 m_pCurDnD->logError("Processing message %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc);3223 VBClLogError("Processing message %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc); 3268 3224 3269 3225 /* If anything went wrong, do a reset and start over. */ … … 3290 3246 } while (!ASMAtomicReadBool(&m_fSrvStopping)); 3291 3247 3292 LogRel(("DnD: Stopped with rc=%Rrc\n", rc));3248 VBClLogInfo("Stopped with rc=%Rrc\n", rc); 3293 3249 3294 3250 } while (0); … … 3308 3264 LogFlowFuncEnter(); 3309 3265 3310 LogRel2(("DnD: Terminating threads ...\n"));3266 VBClLogInfo("Terminating threads ...\n"); 3311 3267 3312 3268 ASMAtomicXchgBool(&m_fSrvStopping, true); … … 3327 3283 3328 3284 if (RT_FAILURE(rc2)) 3329 LogRel(("DnD: Error waiting for HGCM thread to terminate: %Rrc\n", rc2));3285 VBClLogInfo("Error waiting for HGCM thread to terminate: %Rrc\n", rc2); 3330 3286 } 3331 3287 … … 3341 3297 3342 3298 if (RT_FAILURE(rc2)) 3343 LogRel(("DnD: Error waiting for X11 thread to terminate: %Rrc\n", rc2));3344 } 3345 3346 LogRel2(("DnD: Terminating threads done\n"));3299 VBClLogError("Error waiting for X11 thread to terminate: %Rrc\n", rc2); 3300 } 3301 3302 VBClLogInfo("Terminating threads done\n"); 3347 3303 3348 3304 xHelpers::destroyInstance(); … … 3408 3364 else 3409 3365 { 3410 LogRel(("DnD: Processing next message failed with rc=%Rrc\n", rc));3366 VBClLogError("Processing next message failed with rc=%Rrc\n", rc); 3411 3367 3412 3368 /* Old(er) hosts either are broken regarding DnD support or otherwise … … 3415 3371 if (cMsgSkippedInvalid++ > 32) 3416 3372 { 3417 LogRel(("DnD: Too many invalid/skipped messages from host, exiting ...\n"));3373 VBClLogError("Too many invalid/skipped messages from host, exiting ...\n"); 3418 3374 break; 3419 3375 } … … 3533 3489 3534 3490 if (pSelf->uMagic != DRAGANDDROPSERVICE_MAGIC) 3535 VBCl FatalError(("Bad DnD service object!\n"));3491 VBClLogFatalError("Bad DnD service object!\n"); 3536 3492 return pSelf->mDragAndDrop.init(); 3537 3493 } … … 3542 3498 3543 3499 if (pSelf->uMagic != DRAGANDDROPSERVICE_MAGIC) 3544 VBCl FatalError(("Bad DnD service object!\n"));3500 VBClLogFatalError("Bad DnD service object!\n"); 3545 3501 return pSelf->mDragAndDrop.run(fDaemonised); 3546 3502 } … … 3551 3507 3552 3508 if (pSelf->uMagic != DRAGANDDROPSERVICE_MAGIC) 3553 VBCl FatalError(("Bad DnD service object!\n"));3509 VBClLogFatalError("Bad DnD service object!\n"); 3554 3510 return pSelf->mDragAndDrop.cleanup(); 3555 3511 } … … 3570 3526 3571 3527 if (!pService) 3572 VBCl FatalError(("Out of memory\n"));3528 VBClLogFatalError("Out of memory\n"); 3573 3529 pService->pInterface = &vbclDragAndDropInterface; 3574 3530 pService->uMagic = DRAGANDDROPSERVICE_MAGIC; -
trunk/src/VBox/Additions/x11/VBoxClient/hostversion.cpp
r81028 r81040 59 59 if (msg == NULL) 60 60 { 61 LogRel(("Could not create D-BUS message!\n"));61 VBClLogError("Could not create D-BUS message!\n"); 62 62 rc = VERR_INVALID_HANDLE; 63 63 } … … 103 103 reply = dbus_connection_send_with_reply_and_block(conn, msg, 30 * 1000 /* 30 seconds timeout */, &err); 104 104 if (dbus_error_is_set(&err)) 105 LogRel(("D-BUS returned an error while sending the notification: %s", err.message));105 VBClLogError("D-BUS returned an error while sending the notification: %s", err.message); 106 106 else if (reply) 107 107 { … … 139 139 rc = RTDBusLoadLib(); 140 140 if (RT_FAILURE(rc)) 141 LogRel(("VBoxClient: D-Bus seems not to be installed; no host version check/notification done.\n"));141 VBClLogError("D-Bus seems not to be installed; no host version check/notification done\n"); 142 142 # else 143 143 rc = VERR_NOT_IMPLEMENTED; … … 150 150 rc = VbglR3GuestPropConnect(&uGuestPropSvcClientID); 151 151 if (RT_FAILURE(rc)) 152 LogRel(("VBoxClient: Cannot connect to guest property service while chcking for host version! rc = %Rrc\n", rc));152 VBClLogError("Cannot connect to guest property service while chcking for host version! rc = %Rrc\n", rc); 153 153 } 154 154 … … 179 179 #endif 180 180 rc = showNotify(szTitle, szMsg); 181 LogRel(("VBoxClient: VirtualBox Guest Additions update available!"));181 VBClLogInfo("VirtualBox Guest Additions update available!\n"); 182 182 if (RT_FAILURE(rc)) 183 LogRel(("VBoxClient: Could not show version notifier tooltip! rc = %d\n", rc));183 VBClLogError("Could not show version notifier tooltip! rc = %d\n", rc); 184 184 } 185 185 … … 218 218 219 219 if (!pService) 220 VBCl FatalError(("Out of memory\n"));220 VBClLogFatalError("Out of memory\n"); 221 221 pService->pInterface = &vbclHostVersionInterface; 222 222 return &pService->pInterface; -
trunk/src/VBox/Additions/x11/VBoxClient/main.cpp
r81038 r81040 70 70 */ 71 71 RTCRITSECT g_critSect; 72 /** Counter of how often our deamon has been respawned. */ 73 unsigned cRespawn = 0; 74 75 76 77 /** 78 * Exit with a fatal error. 79 * 80 * This is used by the VBClFatalError macro and thus needs to be external. 81 */ 82 void vbclFatalError(char *pszMessage) 83 { 84 char *pszCommand; 85 int status; 86 if (pszMessage && cRespawn == 0) 87 { 88 pszCommand = RTStrAPrintf2("notify-send \"VBoxClient: %s\"", pszMessage); 72 /** Counter of how often our daemon has been respawned. */ 73 unsigned g_cRespawn = 0; 74 /** Logging verbosity level. */ 75 unsigned g_cVerbosity = 0; 76 77 /** 78 * Notifies the desktop environment with a message. 79 * 80 * @param pszMessage Message to notify desktop environment with. 81 */ 82 int vbclLogNotify(const char *pszMessage) 83 { 84 AssertPtrReturn(pszMessage, VERR_INVALID_POINTER); 85 86 int rc = VINF_SUCCESS; 87 88 if (g_cRespawn == 0) 89 { 90 char *pszCommand = RTStrAPrintf2("notify-send \"VBoxClient: %s\"", pszMessage); 89 91 if (pszCommand) 90 92 { 91 status = system(pszCommand); 93 int status = system(pszCommand); 94 95 RTStrFree(pszCommand); 96 92 97 if (WEXITSTATUS(status) != 0) /* Utility or extension not available. */ 93 98 { … … 101 106 RTPrintf("VBoxClient: %s", pszMessage); 102 107 } 108 109 RTStrFree(pszCommand); 103 110 } 111 else 112 rc = VERR_NO_MEMORY; 104 113 } 105 114 } 106 } 107 _exit(RTEXITCODE_FAILURE); 115 else 116 rc = VERR_NO_MEMORY; 117 } 118 119 return rc; 120 } 121 122 /** 123 * Logs a fatal error, notifies the desktop environment via a message and 124 * exits the application immediately. 125 * 126 * @param pszFormat Format string to log. 127 * @param ... Variable arguments for format string. Optional. 128 */ 129 void VBClLogFatalError(const char *pszFormat, ...) 130 { 131 va_list args; 132 va_start(args, pszFormat); 133 char *psz = NULL; 134 RTStrAPrintfV(&psz, pszFormat, args); 135 va_end(args); 136 137 AssertPtr(psz); 138 LogFlowFunc(("%s", psz)); 139 LogRel(("%s", psz)); 140 141 vbclLogNotify(psz); 142 143 RTStrFree(psz); 144 } 145 146 /** 147 * Logs an error message to the (release) logging instance. 148 * 149 * @param pszFormat Format string to log. 150 */ 151 void VBClLogError(const char *pszFormat, ...) 152 { 153 va_list args; 154 va_start(args, pszFormat); 155 char *psz = NULL; 156 RTStrAPrintfV(&psz, pszFormat, args); 157 va_end(args); 158 159 AssertPtr(psz); 160 LogFlowFunc(("%s", psz)); 161 LogRel(("%s", psz)); 162 163 RTStrFree(psz); 164 } 165 166 /** 167 * Logs an info message to the (release) logging instance. 168 * 169 * @param pszFormat Format string to log. 170 */ 171 void VBClLogInfo(const char *pszFormat, ...) 172 { 173 va_list args; 174 va_start(args, pszFormat); 175 char *psz = NULL; 176 RTStrAPrintfV(&psz, pszFormat, args); 177 va_end(args); 178 179 AssertPtr(psz); 180 LogFlowFunc(("%s", psz)); 181 LogRel2(("%s", psz)); 182 183 RTStrFree(psz); 108 184 } 109 185 … … 120 196 int rc = RTCritSectEnter(&g_critSect); 121 197 if (RT_FAILURE(rc)) 122 VBCl FatalError(("VBoxClient: Failure while acquiring the global critical section, rc=%Rrc\n", rc));198 VBClLogFatalError("Failure while acquiring the global critical section, rc=%Rrc\n", rc); 123 199 if (g_pService) 124 200 (*g_pService)->cleanup(g_pService); … … 134 210 static void vboxClientSignalHandler(int cSignal) 135 211 { 136 LogRel(("VBoxClient: terminated with signal %d\n", cSignal));212 VBClLogInfo("Terminated with signal %d\n", cSignal); 137 213 /** Disable seamless mode */ 138 RTPrintf(("VBoxClient: terminating...\n"));214 VBClLogInfo("Terminating ...\n"); 139 215 VBClCleanUp(); 140 216 } … … 148 224 149 225 XGetErrorText(pDisplay, pError->error_code, errorText, sizeof(errorText)); 150 LogRelFlow(("VBoxClient: an X Window protocol error occurred: %s (error code %d). Request code: %d, minor code: %d, serial number: %d\n", errorText, pError->error_code, pError->request_code, pError->minor_code, pError->serial));226 VBClLogError("An X Window protocol error occurred: %s (error code %d). Request code: %d, minor code: %d, serial number: %d\n", errorText, pError->error_code, pError->request_code, pError->minor_code, pError->serial); 151 227 return 0; 152 228 } … … 159 235 { 160 236 RT_NOREF1(pDisplay); 161 LogRel(("VBoxClient: a fatal guest X Window error occurred. This may just mean that the Window system was shut down while the client was still running.\n"));237 VBClLogError("A fatal guest X Window error occurred. This may just mean that the Window system was shut down while the client was still running\n"); 162 238 VBClCleanUp(); 163 239 return 0; /* We should never reach this. */ … … 172 248 struct sigaction sigAction; 173 249 174 LogRelFlowFunc (("\n"));250 LogRelFlowFuncEnter(); 175 251 sigAction.sa_handler = vboxClientSignalHandler; 176 252 sigemptyset(&sigAction.sa_mask); … … 184 260 sigaction(SIGUSR1, &sigAction, NULL); 185 261 sigaction(SIGUSR2, &sigAction, NULL); 186 LogRelFlowFunc (("returning\n"));262 LogRelFlowFuncLeave(); 187 263 } 188 264 … … 224 300 RTPrintf(" -d, --nodaemon continues running as a system service\n"); 225 301 RTPrintf(" -h, --help shows this help text\n"); 302 RTPrintf(" -v, --verbose increases logging verbosity level\n"); 226 303 RTPrintf(" -V, --version shows version information\n"); 227 304 RTPrintf("\n"); … … 253 330 * object should probably never be used from multiple threads anyway. */ 254 331 if (!XInitThreads()) 255 VBCl FatalError(("Failed to initialize X11 threads\n"));332 VBClLogFatalError("Failed to initialize X11 threads\n"); 256 333 257 334 /* Get our file name for usage info and hints. */ … … 336 413 return RTEXITCODE_SUCCESS; 337 414 } 415 else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) 416 { 417 g_cVerbosity++; 418 } 338 419 else 339 420 { … … 352 433 rc = VbglR3InitUser(); 353 434 if (RT_FAILURE(rc)) 354 VBCl FatalError(("VbglR3InitUser failed: %Rrc", rc));435 VBClLogFatalError("VbglR3InitUser failed: %Rrc", rc); 355 436 356 437 if (!fDaemonise) … … 368 449 rc = RTCritSectInit(&g_critSect); 369 450 if (RT_FAILURE(rc)) 370 VBCl FatalError(("Initialising critical section failed: %Rrc\n", rc));451 VBClLogFatalError("Initialising critical section failed: %Rrc\n", rc); 371 452 if ((*g_pService)->getPidFilePath) 372 453 { 373 454 rc = RTPathUserHome(g_szPidFile, sizeof(g_szPidFile)); 374 455 if (RT_FAILURE(rc)) 375 VBCl FatalError(("Getting home directory for PID file failed: %Rrc\n", rc));456 VBClLogFatalError("Getting home directory for PID file failed: %Rrc\n", rc); 376 457 rc = RTPathAppend(g_szPidFile, sizeof(g_szPidFile), 377 458 (*g_pService)->getPidFilePath()); 378 459 if (RT_FAILURE(rc)) 379 VBCl FatalError(("Creating PID file path failed: %Rrc\n", rc));460 VBClLogFatalError("Creating PID file path failed: %Rrc\n", rc); 380 461 if (fDaemonise) 381 rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, fRespawn, & cRespawn);462 rc = VbglR3Daemonize(false /* fNoChDir */, false /* fNoClose */, fRespawn, &g_cRespawn); 382 463 if (RT_FAILURE(rc)) 383 VBCl FatalError(("Daemonizing failed: %Rrc\n", rc));464 VBClLogFatalError("Daemonizing failed: %Rrc\n", rc); 384 465 if (g_szPidFile[0]) 385 466 rc = VbglR3PidFile(g_szPidFile, &g_hPidFile); … … 387 468 return RTEXITCODE_SUCCESS; 388 469 if (RT_FAILURE(rc)) 389 VBCl FatalError(("Creating PID file failed: %Rrc\n", rc));470 VBClLogFatalError("Creating PID file failed: %Rrc\n", rc); 390 471 } 391 472 /* Set signal handlers to clean up on exit. */ … … 404 485 rc = (*g_pService)->run(g_pService, fDaemonise); 405 486 if (RT_FAILURE(rc)) 406 LogRel2(("Running service failed: %Rrc\n", rc));487 VBClLogError("Running service failed: %Rrc\n", rc); 407 488 } 408 489 else … … 410 491 /** @todo r=andy Should we return an appropriate exit code if the service failed to init? 411 492 * Must be tested carefully with our init scripts first. */ 412 LogRel2(("Initializing service failed: %Rrc\n", rc));493 VBClLogError("Initializing service failed: %Rrc\n", rc); 413 494 } 414 495 VBClCleanUp(false /*fExit*/); -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
r76553 r81040 46 46 const char *aPropName, unsigned long *nItems) 47 47 { 48 LogRelFlowFunc (("\n"));48 LogRelFlowFuncEnter(); 49 49 Atom propNameAtom = XInternAtom (aDpy, aPropName, 50 50 True /* only_if_exists */); … … 65 65 return NULL; 66 66 67 LogRelFlowFunc (("returning\n"));67 LogRelFlowFuncLeave(); 68 68 return propVal; 69 69 } … … 79 79 int rc = VINF_SUCCESS; 80 80 81 LogRelFlowFunc (("\n"));81 LogRelFlowFuncEnter(); 82 82 if (mHostCallback != NULL) /* Assertion */ 83 83 { 84 LogRel(("VBoxClient: ERROR: attempt to initialise seamless guest object twice!\n"));84 VBClLogError("Attempting to initialise seamless guest object twice!\n"); 85 85 return VERR_INTERNAL_ERROR; 86 86 } 87 87 if (!(mDisplay = XOpenDisplay(NULL))) 88 88 { 89 LogRel(("VBoxClient: seamless guest object failed to acquire a connection to the display.\n"));89 VBClLogError("Seamless guest object failed to acquire a connection to the display\n"); 90 90 return VERR_ACCESS_DENIED; 91 91 } … … 93 93 mEnabled = false; 94 94 unmonitorClientList(); 95 LogRelFlowFunc (("returning %Rrc\n", rc));95 LogRelFlowFuncLeaveRC(rc); 96 96 return rc; 97 97 } … … 111 111 int error, event; 112 112 113 LogRelFlowFunc (("\n"));113 LogRelFlowFuncEnter(); 114 114 if (mEnabled) 115 115 return VINF_SUCCESS; … … 118 118 monitorClientList(); 119 119 rebuildWindowTree(); 120 LogRelFlowFunc (("returning %Rrc\n", rc));120 LogRelFlowFuncLeaveRC(rc); 121 121 return rc; 122 122 } … … 126 126 void SeamlessX11::stop(void) 127 127 { 128 LogRelFlowFunc (("\n"));128 LogRelFlowFuncEnter(); 129 129 if (!mEnabled) 130 130 return; … … 132 132 unmonitorClientList(); 133 133 freeWindowTree(); 134 LogRelFlowFunc (("returning\n"));134 LogRelFlowFuncLeave(); 135 135 } 136 136 137 137 void SeamlessX11::monitorClientList(void) 138 138 { 139 LogRelFlowFunc (("called\n"));139 LogRelFlowFuncEnter(); 140 140 XSelectInput(mDisplay, DefaultRootWindow(mDisplay), PropertyChangeMask | SubstructureNotifyMask); 141 141 } … … 143 143 void SeamlessX11::unmonitorClientList(void) 144 144 { 145 LogRelFlowFunc (("called\n"));145 LogRelFlowFuncEnter(); 146 146 XSelectInput(mDisplay, DefaultRootWindow(mDisplay), PropertyChangeMask); 147 147 } … … 153 153 void SeamlessX11::rebuildWindowTree(void) 154 154 { 155 LogRelFlowFunc (("called\n"));155 LogRelFlowFuncEnter(); 156 156 freeWindowTree(); 157 157 addClients(DefaultRootWindow(mDisplay)); … … 177 177 unsigned cChildren; 178 178 179 LogRelFlowFunc (("\n"));179 LogRelFlowFuncEnter(); 180 180 if (!XQueryTree(mDisplay, hRoot, &hRealRoot, &hParent, &phChildrenRaw, &cChildren)) 181 181 return; … … 184 184 addClientWindow(phChildren[i]); 185 185 XFree(phChildrenRaw); 186 LogRelFlowFunc (("returning\n"));186 LogRelFlowFuncLeave(); 187 187 } 188 188 … … 190 190 void SeamlessX11::addClientWindow(const Window hWin) 191 191 { 192 LogRelFlowFunc (("\n"));192 LogRelFlowFuncEnter(); 193 193 XWindowAttributes winAttrib; 194 194 bool fAddWin = true; … … 199 199 if (fAddWin && !XGetWindowAttributes(mDisplay, hWin, &winAttrib)) 200 200 { 201 LogRelFunc(("VBoxClient: Failed to get the window attributes for window %d\n", hWin));201 VBClLogError("Failed to get the window attributes for window %d\n", hWin); 202 202 fAddWin = false; 203 203 } … … 211 211 &dummyLong))) 212 212 { 213 LogRelFlowFunc(("window %lu, client window %lu has no size hints\n", 214 hWin, hClient)); 213 LogRelFlowFunc(("window %lu, client window %lu has no size hints\n", hWin, hClient)); 215 214 fAddWin = false; 216 215 } … … 244 243 pRects); 245 244 } 246 LogRelFlowFunc (("returning\n"));245 LogRelFlowFuncLeave(); 247 246 } 248 247 … … 260 259 bool rc = false; 261 260 262 LogRelFlowFunc (("\n"));261 LogRelFlowFuncEnter(); 263 262 windowTypeRaw = XXGetProperty(mDisplay, hWin, XA_ATOM, WM_TYPE_PROP, &ulCount); 264 263 if (windowTypeRaw != NULL) … … 290 289 { 291 290 /* We use post-increment in the operation to prevent the iterator from being invalidated. */ 292 LogRelFlowFunc (("\n"));291 LogRelFlowFuncEnter(); 293 292 mGuestWindows.detachAll(VBoxGuestWinFree, mDisplay); 294 LogRelFlowFunc (("returning\n"));293 LogRelFlowFuncLeave(); 295 294 } 296 295 … … 305 304 XEvent event; 306 305 307 LogRelFlowFunc (("\n"));306 LogRelFlowFuncEnter(); 308 307 /* Start by sending information about the current window setup to the host. We do this 309 308 here because we want to send all such information from a single thread. */ … … 341 340 || event.xproperty.window != DefaultRootWindow(mDisplay)) 342 341 break; 343 LogRelFlowFunc(("_NET_CLIENT_LIST property event on root window .\n"));342 LogRelFlowFunc(("_NET_CLIENT_LIST property event on root window\n")); 344 343 rebuildWindowTree(); 345 344 break; … … 392 391 void SeamlessX11::doShapeEvent(Window hWin) 393 392 { 394 LogRelFlowFunc (("\n"));393 LogRelFlowFuncEnter(); 395 394 VBoxGuestWinInfo *pInfo = mGuestWindows.find(hWin); 396 395 if (pInfo) … … 410 409 mChanged = true; 411 410 } 412 LogRelFlowFunc (("returning\n"));411 LogRelFlowFuncLeave(); 413 412 } 414 413 … … 477 476 int SeamlessX11::updateRects(void) 478 477 { 479 LogRelFlowFunc (("\n"));478 LogRelFlowFuncEnter(); 480 479 struct RectList rects = RTVEC_INITIALIZER; 481 480 … … 492 491 mcRects = RectListSize(&rects); 493 492 mpRects = RectListDetach(&rects); 494 LogRelFlowFunc (("returning\n"));493 LogRelFlowFuncLeave(); 495 494 return VINF_SUCCESS; 496 495 } … … 506 505 Display *pDisplay = XOpenDisplay(NULL); 507 506 508 LogRelFlowFunc (("\n"));507 LogRelFlowFuncEnter(); 509 508 if (pDisplay == NULL) 510 VBCl FatalError(("Failed to open X11 display.\n"));509 VBClLogFatalError("Failed to open X11 display\n"); 511 510 /* Message contents set to zero. */ 512 511 XClientMessageEvent clientMessage = { ClientMessage, 0, 0, 0, 0, 0, 8 }; -
trunk/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
r79482 r81040 155 155 pRects); 156 156 pInfo->Core.Key = hWin; 157 LogRelFlowFunc (("returning\n"));157 LogRelFlowFuncLeave(); 158 158 return RTAvlU32Insert(&mWindows, &pInfo->Core); 159 159 } … … 161 161 VBoxGuestWinInfo *removeWindow(Window hWin) 162 162 { 163 LogRelFlowFunc (("called\n"));163 LogRelFlowFuncEnter(); 164 164 return (VBoxGuestWinInfo *)RTAvlU32Remove(&mWindows, hWin); 165 165 } -
trunk/src/VBox/Additions/x11/VBoxClient/seamless.cpp
r81028 r81040 36 36 SeamlessMain::SeamlessMain(void) 37 37 { 38 LogRelFlowFunc (("\n"));38 LogRelFlowFuncEnter(); 39 39 mX11MonitorThread = NIL_RTTHREAD; 40 40 mX11MonitorThreadStopping = false; … … 45 45 SeamlessMain::~SeamlessMain() 46 46 { 47 LogRelFlowFunc (("\n"));47 LogRelFlowFuncEnter(); 48 48 stop(); 49 49 } … … 54 54 static void sendRegionUpdate(RTRECT *pRects, size_t cRects) 55 55 { 56 LogRelFlowFunc (("\n"));56 LogRelFlowFuncEnter(); 57 57 if (cRects && !pRects) /* Assertion */ 58 58 { 59 LogRelFunc(("ERROR: called with nullpointer!\n"));59 VBClLogError(("Region update called with NULL pointer!\n")); 60 60 return; 61 61 } 62 62 VbglR3SeamlessSendRects(cRects, pRects); 63 LogRelFlowFunc (("returning\n"));63 LogRelFlowFuncLeave(); 64 64 } 65 65 … … 72 72 const char *pcszStage; 73 73 74 LogRelFlowFunc (("\n"));74 LogRelFlowFuncEnter(); 75 75 do { 76 76 pcszStage = "Connecting to the X server"; … … 91 91 } while(0); 92 92 if (RT_FAILURE(rc)) 93 VBClFatalError(("VBoxClient (seamless): failed to start. Stage: \"%s\" Error: %Rrc\n", 94 pcszStage, rc)); 93 VBClLogError("Failed to start in stage '%s' -- error: %Rrc\n", pcszStage, rc); 95 94 return rc; 96 95 } … … 106 105 int rc = VINF_SUCCESS; 107 106 108 LogRelFlowFunc (("\n"));107 LogRelFlowFuncEnter(); 109 108 /* This will only exit if something goes wrong. */ 110 109 while (RT_SUCCESS(rc) || rc == VERR_INTERRUPTED) … … 118 117 if (RT_FAILURE(rc)) 119 118 { 120 LogRel(("VBoxClient (seamless): event loop failed with error: %Rrc\n", 121 rc)); 119 VBClLogError("Event loop failed with error: %Rrc\n", rc); 122 120 stop(); 123 121 } … … 128 126 void SeamlessMain::stop() 129 127 { 130 LogRelFlowFunc (("\n"));128 LogRelFlowFuncEnter(); 131 129 VbglR3SeamlessSetCap(false); 132 130 VbglR3CtlFilterMask(0, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST); 133 131 stopX11MonitorThread(); 134 132 mX11Monitor.uninit(); 135 LogRelFlowFunc (("returning\n"));133 LogRelFlowFuncLeave(); 136 134 } 137 135 … … 145 143 VMMDevSeamlessMode newMode = VMMDev_Seamless_Disabled; 146 144 147 LogRelFlowFunc (("\n"));145 LogRelFlowFuncEnter(); 148 146 int rc = VbglR3SeamlessWaitEvent(&newMode); 149 147 if (RT_SUCCESS(rc)) … … 155 153 /* A simplified seamless mode, obtained by making the host VM window 156 154 * borderless and making the guest desktop transparent. */ 157 LogRelFlowFunc(("\"Visible region\" mode requested (VBoxClient) .\n"));155 LogRelFlowFunc(("\"Visible region\" mode requested (VBoxClient)\n")); 158 156 break; 159 157 case VMMDev_Seamless_Disabled: 160 LogRelFlowFunc(("\"Disabled\" mode requested (VBoxClient) .\n"));158 LogRelFlowFunc(("\"Disabled\" mode requested (VBoxClient)\n")); 161 159 break; 162 160 case VMMDev_Seamless_Host_Window: 163 161 /* One host window represents one guest window. Not yet implemented. */ 164 LogRelFunc(("Unsupported \"host window\" mode requested (VBoxClient) .\n"));162 LogRelFunc(("Unsupported \"host window\" mode requested (VBoxClient)\n")); 165 163 return VERR_NOT_SUPPORTED; 166 164 default: 167 LogRelFunc(("Unsupported mode %d requested (VBoxClient) .\n",165 LogRelFunc(("Unsupported mode %d requested (VBoxClient)\n", 168 166 newMode)); 169 167 return VERR_NOT_SUPPORTED; … … 182 180 LogRelFunc(("VbglR3SeamlessWaitEvent returned %Rrc (VBoxClient)\n", rc)); 183 181 } 184 LogRelFlowFunc (("returning %Rrc\n", rc));182 LogRelFlowFuncLeaveRC(rc); 185 183 return rc; 186 184 } … … 195 193 int rc = VINF_SUCCESS; 196 194 197 LogRelFlowFunc (("\n"));195 LogRelFlowFuncEnter(); 198 196 while (!pHost->mX11MonitorThreadStopping) 199 197 { … … 202 200 rc = pHost->mX11Monitor.start(); 203 201 if (RT_FAILURE(rc)) 204 VBCl FatalError(("Failed to change the X11 seamless service state, mfPaused=%RTbool, rc=%Rrc\n",205 pHost->mfPaused, rc));202 VBClLogFatalError("Failed to change the X11 seamless service state, mfPaused=%RTbool, rc=%Rrc\n", 203 pHost->mfPaused, rc); 206 204 } 207 205 pHost->mX11Monitor.nextConfigurationEvent(); … … 209 207 pHost->mX11Monitor.stop(); 210 208 } 211 LogRelFlowFunc (("returning %Rrc\n", rc));209 LogRelFlowFuncLeaveRC(rc); 212 210 return rc; 213 211 } … … 227 225 "X11 events"); 228 226 if (RT_FAILURE(rc)) 229 LogRelFunc(("Warning: failed to start X11 monitor thread (VBoxClient) .\n"));227 LogRelFunc(("Warning: failed to start X11 monitor thread (VBoxClient)\n")); 230 228 return rc; 231 229 } … … 279 277 struct SEAMLESSSERVICE *pSelf = (struct SEAMLESSSERVICE *)ppInterface; 280 278 if (pSelf->magic != SEAMLESSSERVICE_MAGIC) 281 VBCl FatalError(("Bad seamless service object!\n"));279 VBClLogFatalError("Bad seamless service object!\n"); 282 280 return pSelf; 283 281 } … … 332 330 333 331 if (!pService) 334 VBCl FatalError(("Out of memory\n"));332 VBClLogFatalError("Out of memory\n"); 335 333 pService->pInterface = &vbclSeamlessInterface; 336 334 pService->magic = SEAMLESSSERVICE_MAGIC; -
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
r76553 r81040 46 46 #define TEST_ROOT ((Window)1) 47 47 48 extern void vbclFatalError(char *psz) 49 { 50 RTPrintf("Fatal error: %s\n", psz); 48 void VBClLogError(const char *pszFormat, ...) 49 { 50 va_list args; 51 va_start(args, pszFormat); 52 char *psz = NULL; 53 RTStrAPrintfV(&psz, pszFormat, args); 54 va_end(args); 55 56 AssertPtr(psz); 57 RTPrintf("Error: %s", psz); 58 59 RTStrFree(psz); 60 } 61 62 /** Exit with a fatal error. */ 63 void VBClLogFatalError(const char *pszFormat, ...) 64 { 65 va_list args; 66 va_start(args, pszFormat); 67 char *psz = NULL; 68 RTStrAPrintfV(&psz, pszFormat, args); 69 va_end(args); 70 71 AssertPtr(psz); 72 RTPrintf("Fatal error: %s", psz); 73 74 RTStrFree(psz); 75 51 76 exit(1); 52 77 } -
trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp
r76553 r81040 21 21 #include <iprt/initterm.h> 22 22 #include <iprt/semaphore.h> 23 #include <iprt/string.h> 23 24 #include <iprt/stream.h> 24 25 #include <VBox/VBoxGuestLib.h> … … 28 29 static RTSEMEVENT eventSem; 29 30 31 void VBClLogError(const char *pszFormat, ...) 32 { 33 va_list args; 34 va_start(args, pszFormat); 35 char *psz = NULL; 36 RTStrAPrintfV(&psz, pszFormat, args); 37 va_end(args); 38 39 AssertPtr(psz); 40 RTPrintf("Error: %s", psz); 41 42 RTStrFree(psz); 43 } 44 30 45 /** Exit with a fatal error. */ 31 void vbclFatalError(char *pszMessage)46 void VBClLogFatalError(const char *pszFormat, ...) 32 47 { 33 RTPrintf("Fatal error: %s", pszMessage); 48 va_list args; 49 va_start(args, pszFormat); 50 char *psz = NULL; 51 RTStrAPrintfV(&psz, pszFormat, args); 52 va_end(args); 53 54 AssertPtr(psz); 55 RTPrintf("Fatal error: %s", psz); 56 57 RTStrFree(psz); 58 34 59 exit(1); 35 60 }
Note:
See TracChangeset
for help on using the changeset viewer.