File add-logging-category-for-xcb-warnings.patch of Package libqt5-qtbase.13634
From: Antonio Larrosa <alarrosa@suse.com>
Subject: Add qt.qpa.xcb and qt.qpa.events logging categories
Add qt.qpa.xcb and qt.qpa.events logging categories so xcb
warning and debug messages can be disabled
Fixes: https://bugreports.qt.io/browse/QTBUG-55167
and
https://bugzilla.opensuse.org/show_bug.cgi?id=1115541
Index: qtbase-opensource-src-5.9.7/src/plugins/platforms/xcb/qxcbconnection.cpp
===================================================================
--- qtbase-opensource-src-5.9.7.orig/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ qtbase-opensource-src-5.9.7/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -109,6 +109,8 @@ Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.
Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices")
Q_LOGGING_CATEGORY(lcQpaXInputEvents, "qt.qpa.input.events")
Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen")
+Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events")
+Q_LOGGING_CATEGORY(lcQpaXcb, "qt.qpa.xcb")
// this event type was added in libxcb 1.10,
// but we support also older version
@@ -765,7 +767,7 @@ void printXcbEvent(const char *message,
#ifdef XCB_EVENT_DEBUG
#define PRINT_XCB_EVENT(ev) \
case ev: \
- qDebug("QXcbConnection: %s: %d - %s - sequence: %d", message, int(ev), #ev, event->sequence); \
+ qCDebug(lcQpaEvents, "QXcbConnection: %s: %d - %s - sequence: %d", message, int(ev), #ev, event->sequence); \
break;
switch (event->response_type & ~0x80) {
@@ -804,7 +806,7 @@ void printXcbEvent(const char *message,
PRINT_XCB_EVENT(XCB_MAPPING_NOTIFY);
PRINT_XCB_EVENT(XCB_GE_GENERIC);
default:
- qDebug("QXcbConnection: %s: unknown event - response_type: %d - sequence: %d", message, int(event->response_type & ~0x80), int(event->sequence));
+ qCDebug(lcQpaEvents, "QXcbConnection: %s: unknown event - response_type: %d - sequence: %d", message, int(event->response_type & ~0x80), int(event->sequence));
}
#else
Q_UNUSED(message);
@@ -982,7 +984,8 @@ void QXcbConnection::handleXcbError(xcb_
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);
- qWarning("QXcbConnection: XCB error: %d (%s), sequence: %d, resource id: %d, major code: %d (%s), minor code: %d",
+ qCWarning(lcQpaXcb,
+ "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],
@@ -992,19 +995,19 @@ void QXcbConnection::handleXcbError(xcb_
int i = 0;
for (; i < m_callLog.size(); ++i) {
if (m_callLog.at(i).sequence == error->sequence) {
- qDebug("Caused by: %s:%d", m_callLog.at(i).file.constData(), m_callLog.at(i).line);
+ qCDebug(lcQpaXcb, "Caused by: %s:%d", m_callLog.at(i).file.constData(), m_callLog.at(i).line);
break;
} else if (m_callLog.at(i).sequence > error->sequence) {
- qDebug("Caused some time before: %s:%d", m_callLog.at(i).file.constData(),
+ qCDebug(lcQpaXcb, "Caused some time before: %s:%d", m_callLog.at(i).file.constData(),
m_callLog.at(i).line);
if (i > 0)
- qDebug("and after: %s:%d", m_callLog.at(i-1).file.constData(),
+ qCDebug(lcQpaXcb, "and after: %s:%d", m_callLog.at(i-1).file.constData(),
m_callLog.at(i-1).line);
break;
}
}
if (i == m_callLog.size() && !m_callLog.isEmpty())
- qDebug("Caused some time after: %s:%d", qAsConst(m_callLog).first().file.constData(),
+ qCDebug(lcQpaXcb, "Caused some time after: %s:%d", qAsConst(m_callLog).first().file.constData(),
qAsConst(m_callLog).first().line);
#endif
}
@@ -2066,7 +2069,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("QXcbConnection: Failed to initialize XFixes");
+ qCWarning(lcQpaXcb, "QXcbConnection: Failed to initialize XFixes");
free(error);
return;
}
@@ -2080,7 +2083,7 @@ void QXcbConnection::initializeXRender()
#if QT_CONFIG(xcb_render)
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_render_id);
if (!reply || !reply->present) {
- qDebug("XRender extension not present on the X server");
+ qCDebug(lcQpaXcb, "XRender extension not present on the X server");
return;
}
@@ -2091,7 +2094,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) {
- qWarning("xcb_render_query_version failed");
+ qCWarning(lcQpaXcb, "xcb_render_query_version failed");
free(error);
return;
}
@@ -2120,7 +2123,7 @@ void QXcbConnection::initializeXRandr()
xcb_randr_query_version_reply_t *xrandr_query = xcb_randr_query_version_reply(m_connection,
xrandr_query_cookie, &error);
if (!xrandr_query || error || (xrandr_query->major_version < 1 || (xrandr_query->major_version == 1 && xrandr_query->minor_version < 2))) {
- qWarning("QXcbConnection: Failed to initialize XRandr");
+ qCWarning(lcQpaXcb, "QXcbConnection: Failed to initialize XRandr");
free(error);
has_randr_extension = false;
}
@@ -2165,7 +2168,7 @@ void QXcbConnection::initializeXShape()
xcb_shape_query_version_reply_t *shape_query = xcb_shape_query_version_reply(m_connection,
cookie, NULL);
if (!shape_query) {
- qWarning("QXcbConnection: Failed to initialize SHAPE extension");
+ qCWarning(lcQpaXcb, "QXcbConnection: Failed to initialize SHAPE extension");
} else if (shape_query->major_version > 1 || (shape_query->major_version == 1 && shape_query->minor_version >= 1)) {
// The input shape is the only thing added in SHAPE 1.1
has_input_shape = true;
@@ -2178,7 +2181,7 @@ void QXcbConnection::initializeXKB()
#if QT_CONFIG(xkb)
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id);
if (!reply || !reply->present) {
- qWarning("Qt: XKEYBOARD extension not present on the X server.");
+ qCWarning(lcQpaXcb, "Qt: XKEYBOARD extension not present on the X server.");
xkb_first_event = 0;
return;
}
@@ -2192,10 +2195,10 @@ void QXcbConnection::initializeXKB()
xkb_query = xcb_xkb_use_extension_reply(c, xkb_query_cookie, 0);
if (!xkb_query) {
- qWarning("Qt: Failed to initialize XKB extension");
+ qCWarning(lcQpaXcb, "Qt: Failed to initialize XKB extension");
return;
} else if (!xkb_query->supported) {
- qWarning("Qt: Unsupported XKB version (We want %d %d, but X server has %d %d)",
+ qCWarning(lcQpaXcb, "Qt: Unsupported XKB version (We want %d %d, but X server has %d %d)",
XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION,
xkb_query->serverMajor, xkb_query->serverMinor);
free(xkb_query);
@@ -2232,7 +2235,7 @@ void QXcbConnection::initializeXKB()
xcb_generic_error_t *error = xcb_request_check(c, select);
if (error) {
free(error);
- qWarning("Qt: failed to select notify events from xcb-xkb");
+ qCWarning(lcQpaXcb, "Qt: failed to select notify events from xcb-xkb");
return;
}
#endif
Index: qtbase-opensource-src-5.9.7/src/plugins/platforms/xcb/qxcbconnection.h
===================================================================
--- qtbase-opensource-src-5.9.7.orig/src/plugins/platforms/xcb/qxcbconnection.h
+++ qtbase-opensource-src-5.9.7/src/plugins/platforms/xcb/qxcbconnection.h
@@ -89,6 +89,8 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaXInput)
Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputDevices)
Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputEvents)
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaEvents)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaXcb)
class QXcbVirtualDesktop;
class QXcbScreen;