diff --git a/plugins/scenes/xrender/scene_xrender.cpp b/plugins/scenes/xrender/scene_xrender.cpp --- a/plugins/scenes/xrender/scene_xrender.cpp +++ b/plugins/scenes/xrender/scene_xrender.cpp @@ -468,8 +468,9 @@ } 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.h b/toplevel.h --- a/toplevel.h +++ b/toplevel.h @@ -390,18 +390,11 @@ */ 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(); diff --git a/toplevel.cpp b/toplevel.cpp --- a/toplevel.cpp +++ b/toplevel.cpp @@ -146,7 +146,7 @@ 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,16 +578,16 @@ { 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); } emit shadowChanged(); } else { Shadow::createShadow(this); } - if (hasShadow()) + if (shadow()) dirtyRect |= shadow()->shadowRegion().boundingRect(); if (oldVisibleRect != visibleRect()) emit paddingChanged(this, oldVisibleRect); @@ -597,14 +597,6 @@ } } -bool Toplevel::hasShadow() const -{ - if (effectWindow() && effectWindow()->sceneWindow()) { - return effectWindow()->sceneWindow()->shadow() != nullptr; - } - return false; -} - Shadow *Toplevel::shadow() { if (effectWindow() && effectWindow()->sceneWindow()) {