diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 363a5625da..e90d74caa2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -115,7 +115,7 @@ QXcbConnection::QXcbConnection(const char *displayName) #endif //XCB_USE_XLIB if (m_connection) - printf("Successfully connected to display %s\n", m_displayName.constData()); + qDebug("Successfully connected to display %s", m_displayName.constData()); m_reader = new QXcbEventReader(m_connection); #ifdef XCB_POLL_FOR_QUEUED_EVENT @@ -225,7 +225,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event) #ifdef XCB_EVENT_DEBUG #define PRINT_XCB_EVENT(ev) \ case ev: \ - printf("%s: %d - %s - sequence: %d\n", message, int(ev), #ev, event->sequence); \ + qDebug("%s: %d - %s - sequence: %d", message, int(ev), #ev, event->sequence); \ break; switch (event->response_type & ~0x80) { @@ -262,7 +262,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event) PRINT_XCB_EVENT(XCB_CLIENT_MESSAGE); PRINT_XCB_EVENT(XCB_MAPPING_NOTIFY); default: - printf("%s: unknown event - response_type: %d - sequence: %d\n", message, int(event->response_type & ~0x80), int(event->sequence)); + qDebug("%s: unknown event - response_type: %d - sequence: %d", message, int(event->response_type & ~0x80), int(event->sequence)); } #else Q_UNUSED(message); @@ -435,7 +435,7 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error) uint clamped_error_code = qMin(error->error_code, (sizeof(xcb_errors) / sizeof(xcb_errors[0])) - 1); uint clamped_major_code = qMin(error->major_code, (sizeof(xcb_protocol_request_codes) / sizeof(xcb_protocol_request_codes[0])) - 1); - printf("XCB error: %d (%s), sequence: %d, resource id: %d, major code: %d (%s), minor code: %d\n", + qDebug("XCB error: %d (%s), sequence: %d, resource id: %d, major code: %d (%s), minor code: %d", int(error->error_code), xcb_errors[clamped_error_code], int(error->sequence), int(error->resource_id), int(error->major_code), xcb_protocol_request_codes[clamped_major_code], @@ -445,17 +445,17 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error) int i = 0; for (; i < m_callLog.size(); ++i) { if (m_callLog.at(i).sequence == error->sequence) { - printf("Caused by: %s:%d\n", qPrintable(m_callLog.at(i).file), m_callLog.at(i).line); + qDebug("Caused by: %s:%d", qPrintable(m_callLog.at(i).file), m_callLog.at(i).line); break; } else if (m_callLog.at(i).sequence > error->sequence) { - printf("Caused some time before: %s:%d\n", qPrintable(m_callLog.at(i).file), m_callLog.at(i).line); + qDebug("Caused some time before: %s:%d", qPrintable(m_callLog.at(i).file), m_callLog.at(i).line); if (i > 0) - printf("and after: %s:%d\n", qPrintable(m_callLog.at(i-1).file), m_callLog.at(i-1).line); + qDebug("and after: %s:%d", qPrintable(m_callLog.at(i-1).file), m_callLog.at(i-1).line); break; } } if (i == m_callLog.size() && !m_callLog.isEmpty()) - printf("Caused some time after: %s:%d\n", qPrintable(m_callLog.first().file), m_callLog.first().line); + qDebug("Caused some time after: %s:%d", qPrintable(m_callLog.first().file), m_callLog.first().line); #endif } @@ -1022,7 +1022,7 @@ void QXcbConnection::initializeDri2() xcb_dri2_authenticate_reply_t *authenticate = xcb_dri2_authenticate_reply(m_connection, authenticate_cookie, NULL); if (authenticate == NULL || !authenticate->authenticated) { - fprintf(stderr, "DRI2: failed to authenticate\n"); + qWarning("DRI2: failed to authenticate"); free(authenticate); return; } @@ -1031,14 +1031,14 @@ void QXcbConnection::initializeDri2() EGLDisplay display = eglGetDRMDisplayMESA(fd); if (!display) { - fprintf(stderr, "failed to create display\n"); + qWarning("failed to create display"); return; } m_egl_display = display; EGLint major,minor; if (!eglInitialize(display, &major, &minor)) { - fprintf(stderr, "failed to initialize display\n"); + qWarning("failed to initialize display"); return; } } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 42259feda8..d9583160d7 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -46,19 +46,21 @@ #include +#include + QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number) : QXcbObject(connection) , m_screen(screen) , m_number(number) { - printf ("\n"); - printf ("Information of screen %d:\n", screen->root); - printf (" width.........: %d\n", screen->width_in_pixels); - printf (" height........: %d\n", screen->height_in_pixels); - printf (" depth.........: %d\n", screen->root_depth); - printf (" white pixel...: %x\n", screen->white_pixel); - printf (" black pixel...: %x\n", screen->black_pixel); - printf ("\n"); + qDebug(); + qDebug("Information of screen %d:", screen->root); + qDebug(" width.........: %d", screen->width_in_pixels); + qDebug(" height........: %d", screen->height_in_pixels); + qDebug(" depth.........: %d", screen->root_depth); + qDebug(" white pixel...: %x", screen->white_pixel); + qDebug(" black pixel...: %x", screen->black_pixel); + qDebug(); const quint32 mask = XCB_CW_EVENT_MASK; const quint32 values[] = { @@ -89,7 +91,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num atom(QXcbAtom::UTF8_STRING), 0, 1024), &error); if (windowManagerReply && windowManagerReply->format == 8 && windowManagerReply->type == atom(QXcbAtom::UTF8_STRING)) { m_windowManagerName = QString::fromUtf8((const char *)xcb_get_property_value(windowManagerReply), xcb_get_property_value_length(windowManagerReply)); - printf("Running window manager: %s\n", qPrintable(m_windowManagerName)); + qDebug("Running window manager: %s", qPrintable(m_windowManagerName)); } else if (error) { connection->handleXcbError(error); free(error);