From c1eafcbce1266165dd04a4564a74702054724d99 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 29 Sep 2019 14:15:18 +0300 Subject: [PATCH] Drop Toplevel::hasShadow() method Summary: Use Toplevel::shadow() instead to check whether a Toplevel has a Shadow. Reviewers: #kwin, romangg Reviewed By: #kwin, romangg Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D24297 --- plugins/scenes/xrender/scene_xrender.cpp | 3 ++- toplevel.cpp | 14 +++----------- toplevel.h | 9 +-------- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/plugins/scenes/xrender/scene_xrender.cpp b/plugins/scenes/xrender/scene_xrender.cpp index 439fac9da1..55ae3f7752 100644 --- a/plugins/scenes/xrender/scene_xrender.cpp +++ b/plugins/scenes/xrender/scene_xrender.cpp @@ -468,8 +468,9 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat } else { transformed_shape = shape(); } - if (toplevel->hasShadow()) + if (toplevel->shadow()) { transformed_shape |= toplevel->shadow()->shadowRegion(); + } xcb_render_transform_t xform = { DOUBLE_TO_FIXED(1), DOUBLE_TO_FIXED(0), DOUBLE_TO_FIXED(0), diff --git a/toplevel.cpp b/toplevel.cpp index 9b550d9e24..5367fd0f16 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -146,7 +146,7 @@ void Toplevel::disownDataPassedToDeleted() QRect Toplevel::visibleRect() const { QRect r = decorationRect(); - if (hasShadow() && !shadow()->shadowRegion().isEmpty()) { + if (shadow() && !shadow()->shadowRegion().isEmpty()) { r |= shadow()->shadowRegion().boundingRect(); } return r.translated(geometry().topLeft()); @@ -578,7 +578,7 @@ void Toplevel::getShadow() { QRect dirtyRect; // old & new shadow region const QRect oldVisibleRect = visibleRect(); - if (hasShadow()) { + if (shadow()) { dirtyRect = shadow()->shadowRegion().boundingRect(); if (!effectWindow()->sceneWindow()->shadow()->updateShadow()) { effectWindow()->sceneWindow()->updateShadow(nullptr); @@ -587,7 +587,7 @@ void Toplevel::getShadow() } else { Shadow::createShadow(this); } - if (hasShadow()) + if (shadow()) dirtyRect |= shadow()->shadowRegion().boundingRect(); if (oldVisibleRect != visibleRect()) emit paddingChanged(this, oldVisibleRect); @@ -597,14 +597,6 @@ void Toplevel::getShadow() } } -bool Toplevel::hasShadow() const -{ - if (effectWindow() && effectWindow()->sceneWindow()) { - return effectWindow()->sceneWindow()->shadow() != nullptr; - } - return false; -} - Shadow *Toplevel::shadow() { if (effectWindow() && effectWindow()->sceneWindow()) { diff --git a/toplevel.h b/toplevel.h index 14bc5bf717..8efe9fb8e4 100644 --- a/toplevel.h +++ b/toplevel.h @@ -390,18 +390,11 @@ public: */ void elevate(bool elevate); - /** - * @returns Whether the Toplevel has a Shadow or not - * @see shadow - */ - bool hasShadow() const; /** * Returns the pointer to the Toplevel's Shadow. A Shadow * is only available if Compositing is enabled and the corresponding X window * has the Shadow property set. - * If a shadow is available hasShadow returns @c true. - * @returns The Shadow belonging to this Toplevel, may be @c NULL. - * @see hasShadow + * @returns The Shadow belonging to this Toplevel, @c null if there's no Shadow. */ const Shadow *shadow() const; Shadow *shadow();