From c754ba7f8d1c903318b11e9a20d54513c33df1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 10 Sep 2013 13:29:06 +0200 Subject: [PATCH] Use Xcb::Atom for resolving the highlight windows atom in TabBox Nice side-effect: it will only be fetched once and not every time highlight is invoked or ended. --- tabbox/tabboxhandler.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index d5e5141fd4..8e60d593bf 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -78,6 +78,7 @@ public: QPoint m_embeddedOffset; QSize m_embeddedSize; Qt::Alignment m_embeddedAlignment; + Xcb::Atom m_highlightWindowsAtom; }; TabBoxHandlerPrivate::TabBoxHandlerPrivate(TabBoxHandler *q) @@ -86,6 +87,7 @@ TabBoxHandlerPrivate::TabBoxHandlerPrivate(TabBoxHandler *q) , m_embedded(0) , m_embeddedOffset(QPoint(0, 0)) , m_embeddedSize(QSize(0, 0)) + , m_highlightWindowsAtom(QByteArrayLiteral("_KDE_WINDOW_HIGHLIGHT")) { this->q = q; isShown = false; @@ -117,7 +119,6 @@ void TabBoxHandlerPrivate::updateHighlightWindows() if (!isShown || config.tabBoxMode() != TabBoxConfig::ClientTabBox) return; - Display *dpy = QX11Info::display(); TabBoxClient *currentClient = q->client(index); QWindow *w = NULL; if (m_declarativeView && m_declarativeView->isVisible()) { @@ -154,8 +155,8 @@ void TabBoxHandlerPrivate::updateHighlightWindows() } } - WId wId; - QVector< WId > data; + xcb_window_t wId; + QVector< xcb_window_t > data; if (config.isShowTabBox() && w) { wId = w->winId(); data.resize(2); @@ -165,9 +166,8 @@ void TabBoxHandlerPrivate::updateHighlightWindows() data.resize(1); } data[ 0 ] = currentClient ? currentClient->window() : 0L; - Atom atom = XInternAtom(dpy, "_KDE_WINDOW_HIGHLIGHT", False); - XChangeProperty(dpy, wId, atom, atom, 32, PropModeReplace, - reinterpret_cast(data.data()), data.size()); + xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, wId, m_highlightWindowsAtom, + m_highlightWindowsAtom, 32, data.size(), data.constData()); } void TabBoxHandlerPrivate::endHighlightWindows(bool abort) @@ -180,8 +180,7 @@ void TabBoxHandlerPrivate::endHighlightWindows(bool abort) lastRaisedClient = 0; lastRaisedClientSucc = 0; // highlight windows - Atom atom = XInternAtom(display(), "_KDE_WINDOW_HIGHLIGHT", False); - xcb_delete_property(connection(), config.isShowTabBox() && m_declarativeView ? m_declarativeView->winId() : rootWindow(), atom); + xcb_delete_property(connection(), config.isShowTabBox() && m_declarativeView ? m_declarativeView->winId() : rootWindow(), m_highlightWindowsAtom); } /***********************************************