Cleaned up debug and warning output in xcb plugin.

Got rid of unnecessary debug output, and prefixed debug / warnings
with class name to provide more context.

Change-Id: Ia68e85ec0207de4d87d02226bdf6e4cddf464afc
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
Samuel Rødal 2012-03-02 18:25:22 +01:00 committed by Qt by Nokia
parent 87975f88ce
commit 3280b91985
10 changed files with 40 additions and 38 deletions

View File

@ -74,7 +74,7 @@ public:
break;
default:
qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode");
qWarning("QXcbClipboardMime: Internal error: Unsupported clipboard mode");
break;
}
}
@ -209,7 +209,7 @@ QXcbClipboard::~QXcbClipboard()
// waiting until the clipboard manager fetches the content.
if (!waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, clipboard_timeout, true)) {
qWarning("QClipboard: Unable to receive an event from the "
qWarning("QXcbClipboard: Unable to receive an event from the "
"clipboard manager in a reasonable time");
}
}
@ -292,7 +292,7 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
xcb_set_selection_owner(xcb_connection(), newOwner, modeAtom, connection()->time());
if (getSelectionOwner(modeAtom) != newOwner) {
qWarning("QClipboard::setData: Cannot set X11 selection owner");
qWarning("QXcbClipboard::setData: Cannot set X11 selection owner");
}
emitChanged(mode);
@ -403,7 +403,7 @@ xcb_atom_t QXcbClipboard::sendSelection(QMimeData *d, xcb_atom_t target, xcb_win
atom(QXcbAtom::INCR), 32, 1, (const void *)&bytes);
// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment);
qWarning() << "not implemented INCR just YET!";
qWarning("QXcbClipboard: INCR is unimplemented");
return property;
}
@ -445,7 +445,7 @@ void QXcbClipboard::handleSelectionClearRequest(xcb_selection_clear_event_t *eve
void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
{
if (requestor() && req->requestor == requestor()) {
qDebug() << "This should be caught before";
qWarning("QXcbClipboard: Selection request should be caught before");
return;
}
@ -460,7 +460,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
QMimeData *d;
QClipboard::Mode mode = modeForAtom(req->selection);
if (mode > QClipboard::Selection) {
qWarning() << "QClipboard: Unknown selection" << connection()->atomName(req->selection);
qWarning() << "QXcbClipboard: Unknown selection" << connection()->atomName(req->selection);
xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);
return;
}
@ -468,14 +468,14 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
d = m_clientClipboard[mode];
if (!d) {
qWarning("QClipboard: Cannot transfer data, no data available");
qWarning("QXcbClipboard: Cannot transfer data, no data available");
xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);
return;
}
if (m_timestamp[mode] == XCB_CURRENT_TIME // we don't own the selection anymore
|| (req->time != XCB_CURRENT_TIME && req->time < m_timestamp[mode])) {
qDebug("QClipboard: SelectionRequest too old");
qWarning("QXcbClipboard: SelectionRequest too old");
xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event);
return;
}
@ -530,7 +530,7 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req)
property, XCB_ATOM_INTEGER, 32, 1, &m_timestamp[mode]);
ret = property;
} else {
qWarning("QClipboard: Invalid data timestamp");
qWarning("QXcbClipboard: Invalid data timestamp");
}
} else if (target == xa_targets) {
ret = sendTargetsSelection(d, req->requestor, property);

View File

@ -135,7 +135,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
#endif //XCB_USE_XLIB
if (!m_connection || xcb_connection_has_error(m_connection))
qFatal("Could not connect to display %s", m_displayName.constData());
qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData());
m_reader = new QXcbEventReader(this);
#ifdef XCB_POLL_FOR_QUEUED_EVENT
@ -255,7 +255,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event)
#ifdef XCB_EVENT_DEBUG
#define PRINT_XCB_EVENT(ev) \
case ev: \
qDebug("%s: %d - %s - sequence: %d", message, int(ev), #ev, event->sequence); \
qDebug("QXcbConnection: %s: %d - %s - sequence: %d", message, int(ev), #ev, event->sequence); \
break;
switch (event->response_type & ~0x80) {
@ -292,7 +292,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event)
PRINT_XCB_EVENT(XCB_CLIENT_MESSAGE);
PRINT_XCB_EVENT(XCB_MAPPING_NOTIFY);
default:
qDebug("%s: unknown event - response_type: %d - sequence: %d", message, int(event->response_type & ~0x80), int(event->sequence));
qDebug("QXcbConnection: %s: unknown event - response_type: %d - sequence: %d", message, int(event->response_type & ~0x80), int(event->sequence));
}
#else
Q_UNUSED(message);
@ -465,7 +465,7 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error)
uint clamped_error_code = qMin<uint>(error->error_code, (sizeof(xcb_errors) / sizeof(xcb_errors[0])) - 1);
uint clamped_major_code = qMin<uint>(error->major_code, (sizeof(xcb_protocol_request_codes) / sizeof(xcb_protocol_request_codes[0])) - 1);
qDebug("XCB error: %d (%s), sequence: %d, resource id: %d, major code: %d (%s), minor code: %d",
qWarning("QXcbConnection: 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],
@ -557,7 +557,6 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
break;
case XCB_SELECTION_NOTIFY:
setTime(((xcb_selection_notify_event_t *)event)->time);
qDebug() << "XCB_SELECTION_NOTIFY";
handled = false;
break;
case XCB_PROPERTY_NOTIFY:
@ -1029,7 +1028,7 @@ void QXcbConnection::initializeXFixes()
xcb_xfixes_query_version_reply_t *xfixes_query = xcb_xfixes_query_version_reply (m_connection,
xfixes_query_cookie, &error);
if (!xfixes_query || error || xfixes_query->major_version < 2) {
qWarning("Failed to initialize XFixes");
qWarning("QXcbConnection: Failed to initialize XFixes");
free(error);
xfixes_first_event = 0;
}
@ -1046,7 +1045,7 @@ void QXcbConnection::initializeXRender()
xcb_render_query_version_reply_t *xrender_query = xcb_render_query_version_reply(m_connection,
xrender_query_cookie, &error);
if (!xrender_query || error || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) {
qWarning("Failed to initialize XRender");
qWarning("QXcbConnection: Failed to initialize XRender");
free(error);
}
free(xrender_query);
@ -1090,7 +1089,7 @@ void QXcbConnection::initializeDri2()
connect_cookie, NULL);
if (! connect || connect->driver_name_length + connect->device_name_length == 0) {
qDebug() << "Failed to connect to dri2";
qWarning("QXcbConnection: Failed to connect to DRI2");
return;
}
@ -1100,14 +1099,14 @@ void QXcbConnection::initializeDri2()
int fd = open(m_dri2_device_name.constData(), O_RDWR);
if (fd < 0) {
qDebug() << "InitializeDri2: Could'nt open device << dri2DeviceName";
qWarning() << "QXcbConnection: Couldn't open DRI2 device" << m_dri2_device_name;
m_dri2_device_name = QByteArray();
return;
}
drm_magic_t magic;
if (drmGetMagic(fd, &magic)) {
qDebug() << "Failed to get drmMagic";
qWarning("QXcbConnection: Failed to get drmMagic");
return;
}
@ -1116,7 +1115,7 @@ void QXcbConnection::initializeDri2()
xcb_dri2_authenticate_reply_t *authenticate = xcb_dri2_authenticate_reply(m_connection,
authenticate_cookie, NULL);
if (authenticate == NULL || !authenticate->authenticated) {
qWarning("DRI2: failed to authenticate");
qWarning("QXcbConnection: DRI2: failed to authenticate");
free(authenticate);
return;
}
@ -1125,14 +1124,14 @@ void QXcbConnection::initializeDri2()
EGLDisplay display = eglGetDRMDisplayMESA(fd);
if (!display) {
qWarning("failed to create display");
qWarning("QXcbConnection: Failed to create EGL display using DRI2");
return;
}
m_egl_display = display;
EGLint major,minor;
if (!eglInitialize(display, &major, &minor)) {
qWarning("failed to initialize display");
qWarning("QXcbConnection: Failed to initialize EGL display using DRI2");
return;
}
}

View File

@ -201,7 +201,7 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image,
formatsCookie,
&error);
if (!formatsReply || error) {
qWarning("createCursorXRender: query_pict_formats failed");
qWarning("qt_xcb_createCursorXRender: query_pict_formats failed");
free(formatsReply);
free(error);
return XCB_NONE;
@ -209,7 +209,7 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image,
xcb_render_pictforminfo_t *fmt = xcb_render_util_find_standard_format(formatsReply,
XCB_PICT_STANDARD_ARGB_32);
if (!fmt) {
qWarning("createCursorXRender: Failed to find format PICT_STANDARD_ARGB_32");
qWarning("qt_xcb_createCursorXRender: Failed to find format PICT_STANDARD_ARGB_32");
free(formatsReply);
return XCB_NONE;
}
@ -221,13 +221,13 @@ xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image,
XCB_IMAGE_ORDER_MSB_FIRST,
0, 0, 0);
if (!xi) {
qWarning("createCursorXRender: xcb_image_create failed");
qWarning("qt_xcb_createCursorXRender: xcb_image_create failed");
free(formatsReply);
return XCB_NONE;
}
xi->data = (uint8_t *) malloc(xi->stride * h);
if (!xi->data) {
qWarning("createCursorXRender: Failed to malloc() image data");
qWarning("qt_xcb_createCursorXRender: Failed to malloc() image data");
xcb_image_destroy(xi);
free(formatsReply);
return XCB_NONE;

View File

@ -101,7 +101,9 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
m_connections << new QXcbConnection(m_nativeInterface.data());
for (int i = 0; i < parameters.size() - 1; i += 2) {
qDebug() << parameters.at(i) << parameters.at(i+1);
#ifdef Q_XCB_DEBUG
qDebug() << "QXcbIntegration: Connecting to additional display: " << parameters.at(i) << parameters.at(i+1);
#endif
QString display = parameters.at(i) + ':' + parameters.at(i+1);
m_connections << new QXcbConnection(m_nativeInterface.data(), display.toAscii().constData());
}
@ -185,7 +187,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
#elif defined(XCB_USE_DRI2)
return new QDri2Context(context->format(), context->shareHandle());
#endif
qWarning("Cannot create platform GL context, none of GLX, EGL, DRI2 is enabled");
qWarning("QXcbIntegration: Cannot create platform OpenGL context, none of GLX, EGL, or DRI2 are enabled");
return 0;
}
#endif

View File

@ -935,7 +935,7 @@ void QXcbKeyboard::setupModifiers()
xcb_get_modifier_mapping_reply_t *modMapReply =
xcb_get_modifier_mapping_reply(conn, modMapCookie, &error);
if (error) {
qWarning("xcb keyboard: failed to get modifier mapping");
qWarning("QXcbKeyboard: failed to get modifier mapping");
free(error);
return;
}

View File

@ -137,7 +137,7 @@ QPlatformNativeInterface::EventFilter QXcbNativeInterface::setEventFilter(const
if (eventType == QByteArrayLiteral("xcb_generic_event_t"))
type = GenericEventFilter;
if (type == -1) {
qWarning("%s: Attempt to set invalid event filter type '%s'.",
qWarning("QXcbNativeInterface: %s: Attempt to set invalid event filter type '%s'.",
Q_FUNC_INFO, eventType.constData());
return 0;
}

View File

@ -55,6 +55,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num
, m_screen(screen)
, m_number(number)
{
#ifdef Q_XCB_DEBUG
qDebug();
qDebug("Information of screen %d:", screen->root);
qDebug(" width.........: %d", screen->width_in_pixels);
@ -63,6 +64,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num
qDebug(" white pixel...: %x", screen->white_pixel);
qDebug(" black pixel...: %x", screen->black_pixel);
qDebug();
#endif
const quint32 mask = XCB_CW_EVENT_MASK;
const quint32 values[] = {
@ -93,7 +95,9 @@ 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));
#ifdef Q_XCB_DEBUG
qDebug("Running window manager: %s", qPrintable(m_windowManagerName));
#endif
} else if (error) {
connection->handleXcbError(error);
free(error);

View File

@ -581,7 +581,7 @@ QXcbSharedBufferManager::Buffer *QXcbSharedBufferManager::allocateBuffer(int wid
bool ok = buffer->buffer->create(buffer->width * buffer->height * buffer->bytesPerPixel,
QSharedMemory::ReadWrite);
if (!ok) {
qWarning("SharedBufferManager::findAvailableBuffer: Can't create new buffer (%s)",
qWarning("QXcbSharedBufferManager::findAvailableBuffer: Can't create new buffer (%s)",
qPrintable(buffer->buffer->errorString()));
delete buffer;
return 0;

View File

@ -1281,7 +1281,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
m_syncValue.lo = event->data.data32[2];
m_syncValue.hi = event->data.data32[3];
} else {
qWarning() << "unhandled WM_PROTOCOLS message:" << connection()->atomName(event->data.data32[0]);
qWarning() << "QXcbWindow: Unhandled WM_PROTOCOLS message:" << connection()->atomName(event->data.data32[0]);
}
} else if (event->type == atom(QXcbAtom::XdndEnter)) {
connection()->drag()->handleEnter(window(), event);
@ -1292,7 +1292,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
} else if (event->type == atom(QXcbAtom::XdndDrop)) {
connection()->drag()->handleDrop(window(), event);
} else {
qWarning() << "unhandled client message:" << connection()->atomName(event->type);
qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type);
}
}

View File

@ -89,11 +89,6 @@ void QXcbWMSupport::updateNetWMAtoms()
free(reply);
} while (remaining > 0);
// qDebug() << "======== updateNetWMAtoms";
// for (int i = 0; i < net_wm_atoms.size(); ++i)
// qDebug() << atomName(net_wm_atoms.at(i));
// qDebug() << "======== updateNetWMAtoms";
}
// update the virtual roots array
@ -130,10 +125,12 @@ void QXcbWMSupport::updateVirtualRoots()
free(reply);
} while (remaining > 0);
#ifdef Q_XCB_DEBUG
qDebug() << "======== updateVirtualRoots";
for (int i = 0; i < net_virtual_roots.size(); ++i)
qDebug() << connection()->atomName(net_virtual_roots.at(i));
qDebug() << "======== updateVirtualRoots";
#endif
}
QT_END_NAMESPACE