diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -137,7 +137,7 @@ DELEGATE(bool, isKeepAbove, keepAbove) DELEGATE(bool, isKeepBelow, keepBelow) DELEGATE(bool, isShaded, isShade) -DELEGATE(WId, windowId, window) +DELEGATE(WId, windowId, windowId) DELEGATE(WId, decorationId, frameId) #undef DELEGATE diff --git a/effects.cpp b/effects.cpp --- a/effects.cpp +++ b/effects.cpp @@ -166,6 +166,9 @@ static QByteArray readWindowProperty(xcb_window_t win, xcb_atom_t atom, xcb_atom_t type, int format) { + if (win == XCB_WINDOW_NONE) { + return QByteArray(); + } uint32_t len = 32768; for (;;) { Xcb::Property prop(false, win, atom, XCB_ATOM_ANY, 0, len); @@ -183,6 +186,9 @@ static void deleteWindowProperty(Window win, long int atom) { + if (win == XCB_WINDOW_NONE) { + return; + } xcb_delete_property(connection(), win, atom); } diff --git a/shadow.cpp b/shadow.cpp --- a/shadow.cpp +++ b/shadow.cpp @@ -127,12 +127,14 @@ QVector< uint32_t > Shadow::readX11ShadowProperty(xcb_window_t id) { QVector ret; - Xcb::Property property(false, id, atoms->kde_net_wm_shadow, XCB_ATOM_CARDINAL, 0, 12); - uint32_t *shadow = property.value(); - if (shadow) { - ret.reserve(12); - for (int i=0; i<12; ++i) { - ret << shadow[i]; + if (id != XCB_WINDOW) { + Xcb::Property property(false, id, atoms->kde_net_wm_shadow, XCB_ATOM_CARDINAL, 0, 12); + uint32_t *shadow = property.value(); + if (shadow) { + ret.reserve(12); + for (int i=0; i<12; ++i) { + ret << shadow[i]; + } } } return ret; diff --git a/shell_client.h b/shell_client.h --- a/shell_client.h +++ b/shell_client.h @@ -90,16 +90,15 @@ bool userCanSetFullScreen() const override; bool userCanSetNoBorder() const override; bool wantsInput() const override; - xcb_window_t window() const override; using AbstractClient::resizeWithChecks; void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override; using AbstractClient::setGeometry; void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) override; bool hasStrut() const override; void setInternalFramebufferObject(const QSharedPointer &fbo) override; - quint32 windowId() const { + quint32 windowId() const override { return m_windowId; } bool isInternal() const; diff --git a/shell_client.cpp b/shell_client.cpp --- a/shell_client.cpp +++ b/shell_client.cpp @@ -766,11 +766,6 @@ return surface()->client() == waylandServer()->inputMethodConnection(); } -xcb_window_t ShellClient::window() const -{ - return windowId(); -} - void ShellClient::requestGeometry(const QRect &rect) { m_positionAfterResize.setPoint(rect.topLeft()); diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -375,7 +375,7 @@ WId TabBoxClientImpl::window() const { - return m_client->window(); + return m_client->windowId(); } bool TabBoxClientImpl::isMinimized() const diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -159,7 +159,7 @@ } m_client = client; if (m_client) { - setWId(m_client->window()); + setWId(m_client->windowId()); } else { setWId(0); } @@ -183,7 +183,7 @@ void WindowThumbnailItem::repaint(KWin::EffectWindow *w) { - if (static_cast(w)->window()->window() == m_wId) { + if (static_cast(w)->window()->windowId() == m_wId) { update(); } } diff --git a/toplevel.h b/toplevel.h --- a/toplevel.h +++ b/toplevel.h @@ -82,7 +82,7 @@ Q_PROPERTY(int screen READ screen NOTIFY screenChanged) Q_PROPERTY(QSize size READ size) Q_PROPERTY(int width READ width) - Q_PROPERTY(qulonglong windowId READ window CONSTANT) + Q_PROPERTY(qulonglong windowId READ windowId CONSTANT) Q_PROPERTY(int x READ x) Q_PROPERTY(int y READ y) Q_PROPERTY(int desktop READ desktop) @@ -213,7 +213,11 @@ public: explicit Toplevel(); virtual xcb_window_t frameId() const; - virtual xcb_window_t window() const; + xcb_window_t window() const; + /** + * @return a unique identifier for the Toplevel. On X11 same as @link {window} + **/ + virtual quint32 windowId() const; QRect geometry() const; QSize size() const; QPoint pos() const; diff --git a/toplevel.cpp b/toplevel.cpp --- a/toplevel.cpp +++ b/toplevel.cpp @@ -519,5 +519,10 @@ return m; } +quint32 Toplevel::windowId() const +{ + return window(); +} + } // namespace diff --git a/useractions.cpp b/useractions.cpp --- a/useractions.cpp +++ b/useractions.cpp @@ -222,7 +222,7 @@ args << QStringLiteral("--dontagain") << QLatin1String("kwin_dialogsrc:") + type; } if (!c.isNull()) - args << QStringLiteral("--embed") << QString::number(c.data()->window()); + args << QStringLiteral("--embed") << QString::number(c.data()->windowId()); QtConcurrent::run([args]() { KProcess::startDetached(QStringLiteral("kdialog"), args); }); @@ -1704,7 +1704,7 @@ bool succeeded = false; if (Xcb::Extensions::self()->isRandrAvailable()) { - ScreenResources res(active_client ? active_client->window() : rootWindow()); + ScreenResources res((active_client && active_client->window() != XCB_WINDOW_NONE) ? active_client->window() : rootWindow()); if (!res.isNull()) { for (int j = 0; j < res->num_crtcs; ++j) {