diff --git a/deleted.cpp b/deleted.cpp index f49ff57491..fc557d7430 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -179,7 +179,8 @@ NET::WindowType Deleted::windowType(bool direct, int supportedTypes) const void Deleted::mainClientClosed(Toplevel *client) { - m_mainClients.removeAll(static_cast(client)); + if (AbstractClient *c = dynamic_cast(client)) + m_mainClients.removeAll(c); } xcb_window_t Deleted::frameId() const diff --git a/input.cpp b/input.cpp index ea3161f311..361d47c48e 100644 --- a/input.cpp +++ b/input.cpp @@ -1130,8 +1130,7 @@ Toplevel *InputRedirection::findToplevel(const QPoint &pos) // a deleted window doesn't get mouse events continue; } - if (t->isClient()) { - Client *c = static_cast(t); + if (AbstractClient *c = dynamic_cast(t)) { if (!c->isOnCurrentActivity() || !c->isOnCurrentDesktop() || c->isMinimized() || !c->isCurrentTab()) { continue; } diff --git a/layers.cpp b/layers.cpp index 2aec6181d6..46dd76354f 100644 --- a/layers.cpp +++ b/layers.cpp @@ -315,7 +315,10 @@ void Workspace::lowerClient(AbstractClient* c, bool nogroup) unconstrained_stacking_order.prepend(c); if (!nogroup && c->isTransient()) { // lower also all windows in the group, in their reversed stacking order - ClientList wins = ensureStackingOrder(static_cast(c)->group()->members()); + ClientList wins; + if (Client *client = dynamic_cast(c)) { + wins = ensureStackingOrder(client->group()->members()); + } for (int i = wins.size() - 1; i >= 0; --i) { diff --git a/scene.cpp b/scene.cpp index c46f8d1db6..462eac69bf 100644 --- a/scene.cpp +++ b/scene.cpp @@ -275,13 +275,13 @@ void Scene::paintSimpleScreen(int orig_mask, QRegion region) // Clip out the decoration for opaque windows; the decoration is drawn in the second pass opaqueFullscreen = false; // TODO: do we care about unmanged windows here (maybe input windows?) if (w->isOpaque()) { - Client *c = NULL; - if (topw->isClient()) { - c = static_cast(topw); + AbstractClient *c = dynamic_cast(topw); + if (c) { opaqueFullscreen = c->isFullScreen(); } + Client *cc = dynamic_cast(c); // the window is fully opaque - if (c && c->decorationHasAlpha()) { + if (cc && cc->decorationHasAlpha()) { // decoration uses alpha channel, so we may not exclude it in clipping data.clip = w->clientShape().translated(w->x(), w->y()); } else { @@ -739,8 +739,7 @@ const QRegion &Scene::Window::shape() const QRegion Scene::Window::clientShape() const { - if (toplevel->isClient()) { - Client *c = static_cast< Client * > (toplevel); + if (AbstractClient *c = dynamic_cast< AbstractClient * > (toplevel)) { if (c->isShade()) return QRegion(); } @@ -788,14 +787,16 @@ void Scene::Window::resetPaintingEnabled() } if (!toplevel->isOnCurrentActivity()) disable_painting |= PAINT_DISABLED_BY_ACTIVITY; - if (toplevel->isClient()) { - Client *c = static_cast(toplevel); + if (AbstractClient *c = dynamic_cast(toplevel)) { if (c->isMinimized()) disable_painting |= PAINT_DISABLED_BY_MINIMIZE; if (c->tabGroup() && c != c->tabGroup()->current()) disable_painting |= PAINT_DISABLED_BY_TAB_GROUP; - else if (c->isHiddenInternal()) - disable_painting |= PAINT_DISABLED; + if (Client *cc = dynamic_cast(c)) { + if (cc->isHiddenInternal()) { + disable_painting |= PAINT_DISABLED; + } + } } } diff --git a/scene_opengl.cpp b/scene_opengl.cpp index b1ace1cd21..8b3be71d50 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1386,8 +1386,7 @@ void SceneOpenGL::Window::endRenderWindow() GLTexture *SceneOpenGL::Window::getDecorationTexture() const { - if (toplevel->isClient()) { - Client *client = static_cast(toplevel); + if (Client *client = dynamic_cast(toplevel)) { if (client->noBorder()) { return nullptr; }