xcb: every window should have a title in debug mode

Qt creates various invisible windows for internal purposes.
Giving them all titles makes the output of tools like
xprop and xwininfo more readable, which makes solving certain bugs
(like transient-window bugs) easier.

Task-number: QTBUG-33644
Change-Id: I9d37b40d3339fb0f81ffeae64949b88ecb655474
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Shawn Rutledge 2013-09-27 13:33:22 +02:00 committed by The Qt Project
parent d3ba95f5c1
commit 51c28cad67
5 changed files with 59 additions and 0 deletions

View File

@ -95,6 +95,9 @@ static Window createDummyWindow(QXcbScreen *screen, XVisualInfo *visualInfo)
0, 0, 100, 100,
0, visualInfo->depth, InputOutput, visualInfo->visual,
CWBackPixel|CWBorderPixel|CWColormap, &a);
#ifndef QT_NO_DEBUG
XStoreName(DISPLAY_FROM_XCB(screen), window, "Qt GLX dummy window");
#endif
XFreeColormap(DISPLAY_FROM_XCB(screen), cmap);
return window;
}

View File

@ -298,6 +298,17 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c)
m_screen->screen()->root_visual, // visual
0, // value mask
0)); // value list
#ifndef QT_NO_DEBUG
QByteArray ba("Qt clipboard window");
Q_XCB_CALL(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_owner,
atom(QXcbAtom::_NET_WM_NAME),
atom(QXcbAtom::UTF8_STRING),
8,
ba.length(),
ba.constData()));
#endif
if (connection()->hasXFixes()) {
const uint32_t mask = XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER |
@ -475,6 +486,17 @@ xcb_window_t QXcbClipboard::requestor() const
m_screen->screen()->root_visual, // visual
0, // value mask
0)); // value list
#ifndef QT_NO_DEBUG
QByteArray ba("Qt clipboard requestor window");
Q_XCB_CALL(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
window,
atom(QXcbAtom::_NET_WM_NAME),
atom(QXcbAtom::UTF8_STRING),
8,
ba.length(),
ba.constData()));
#endif
uint32_t mask = XCB_EVENT_MASK_PROPERTY_CHANGE;
xcb_change_window_attributes(xcb_connection(), window, XCB_CW_EVENT_MASK, &mask);

View File

@ -324,6 +324,17 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
m_connectionEventListener, m_screens.at(0)->root(),
0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY,
m_screens.at(0)->screen()->root_visual, 0, 0);
#ifndef QT_NO_DEBUG
QByteArray ba("Qt xcb connection listener window");
Q_XCB_CALL(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_connectionEventListener,
atom(QXcbAtom::_NET_WM_NAME),
atom(QXcbAtom::UTF8_STRING),
8,
ba.length(),
ba.constData()));
#endif
initializeGLX();
initializeXFixes();

View File

@ -161,6 +161,18 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen()->root_visual,
0, 0), connection);
#ifndef QT_NO_DEBUG
QByteArray ba("Qt client leader window for screen ");
ba += m_outputName.toUtf8();
Q_XCB_CALL2(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_clientLeader,
atom(QXcbAtom::_NET_WM_NAME),
atom(QXcbAtom::UTF8_STRING),
8,
ba.length(),
ba.constData()), connection);
#endif
Q_XCB_CALL2(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,

View File

@ -1144,6 +1144,17 @@ void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp)
xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW),
XCB_ATOM_WINDOW, 32, 1, &m_netWmUserTimeWindow);
xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_USER_TIME));
#ifndef QT_NO_DEBUG
QByteArray ba("Qt NET_WM user time window");
Q_XCB_CALL(xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
m_window,
atom(QXcbAtom::_NET_WM_NAME),
atom(QXcbAtom::UTF8_STRING),
8,
ba.length(),
ba.constData()));
#endif
} else if (!isSupportedByWM) {
// WM no longer supports it, then we should remove the
// _NET_WM_USER_TIME_WINDOW atom.