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
This commit is contained in:
Vlad Zahorodnii 2019-09-29 14:15:18 +03:00
parent da1a47f91b
commit c1eafcbce1
3 changed files with 6 additions and 20 deletions

View file

@ -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),

View file

@ -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()) {

View file

@ -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();