diff --git a/client.cpp b/client.cpp index 1147864718..8ff98c651b 100644 --- a/client.cpp +++ b/client.cpp @@ -2425,12 +2425,7 @@ void Client::setSessionInteract(bool needed) QRect Client::decorationRect() const { if (decoration && decoration->widget()) { - QRect r = decoration->widget()->rect().translated(-padding_left, -padding_top); - if (hasShadow()) - r |= shadow()->shadowRegion().boundingRect(); - return r; - } else if (hasShadow()) { - return shadow()->shadowRegion().boundingRect(); + return decoration->widget()->rect().translated(-padding_left, -padding_top); } else { return QRect(0, 0, width(), height()); } diff --git a/composite.cpp b/composite.cpp index 342f0c7916..6a27e000be 100644 --- a/composite.cpp +++ b/composite.cpp @@ -782,7 +782,7 @@ void Toplevel::addLayerRepaint(const QRegion& r) void Toplevel::addRepaintFull() { - repaints_region = decorationRect(); + repaints_region = visibleRect().translated(-pos()); workspace()->checkCompositeTimer(); } diff --git a/deleted.cpp b/deleted.cpp index 762ea26928..cfca429276 100644 --- a/deleted.cpp +++ b/deleted.cpp @@ -149,11 +149,7 @@ void Deleted::layoutDecorationRects(QRect& left, QRect& top, QRect& right, QRect QRect Deleted::decorationRect() const { - QRect r(rect()); - r.adjust(-padding_left, -padding_top, padding_top, padding_bottom); - if (hasShadow()) - r |= shadow()->shadowRegion().boundingRect(); - return r; + return rect().adjusted(-padding_left, -padding_top, padding_top, padding_bottom); } QRect Deleted::transparentRect() const diff --git a/geometry.cpp b/geometry.cpp index 357c5cc238..f7252ee9da 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1914,7 +1914,7 @@ void Client::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) discardWindowPixmap(); emit geometryShapeChanged(this, geom_before_block); } - const QRect deco_rect = decorationRect().translated(geom.x(), geom.y()); + const QRect deco_rect = visibleRect(); addLayerRepaint(deco_rect_before_block); addLayerRepaint(deco_rect); geom_before_block = geom; @@ -1981,7 +1981,7 @@ void Client::plainResize(int w, int h, ForceGeometry_t force) workspace()->checkUnredirect(); discardWindowPixmap(); emit geometryShapeChanged(this, geom_before_block); - const QRect deco_rect = decorationRect().translated(geom.x(), geom.y()); + const QRect deco_rect = visibleRect(); addLayerRepaint(deco_rect_before_block); addLayerRepaint(deco_rect); geom_before_block = geom; @@ -2028,7 +2028,7 @@ void Client::move(int x, int y, ForceGeometry_t force) workspace()->tiling()->notifyTilingWindowMove(this, moveResizeGeom, initialMoveResizeGeom); #endif // client itself is not damaged - const QRect deco_rect = decorationRect().translated(geom.x(), geom.y()); + const QRect deco_rect = visibleRect(); addLayerRepaint(deco_rect_before_block); addLayerRepaint(deco_rect); // trigger repaint of window's new location geom_before_block = geom; diff --git a/scene.cpp b/scene.cpp index 2af2262cd1..2a2d0b8962 100644 --- a/scene.cpp +++ b/scene.cpp @@ -536,7 +536,7 @@ WindowQuadList Scene::Window::buildQuads(bool force) const if (cached_quad_list != NULL && !force) return *cached_quad_list; WindowQuadList ret; - if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->visibleRect().size()) + if (toplevel->clientPos() == QPoint(0, 0) && toplevel->clientSize() == toplevel->decorationRect().size()) ret = makeQuads(WindowQuadContents, shape()); // has no decoration else { Client *client = dynamic_cast(toplevel); diff --git a/scene_xrender.cpp b/scene_xrender.cpp index b958be9fd1..a79933dcef 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -283,6 +283,7 @@ void SceneXrender::windowAdded(Toplevel* c) //**************************************** QPixmap *SceneXrender::Window::temp_pixmap = 0; +QRect SceneXrender::Window::temp_visibleRect; SceneXrender::Window::Window(Toplevel* c) : Scene::Window(c) @@ -411,14 +412,14 @@ QPoint SceneXrender::Window::mapToScreen(int mask, const WindowPaintData &data, void SceneXrender::Window::prepareTempPixmap() { - const QRect r = static_cast(toplevel)->decorationRect(); + temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos()); if (temp_pixmap && Extensions::nonNativePixmaps()) XFreePixmap(display(), temp_pixmap->handle()); // The picture owns the pixmap now if (!temp_pixmap) - temp_pixmap = new QPixmap(r.width(), r.height()); - else if (temp_pixmap->width() < r.width() || temp_pixmap->height() < r.height()) { - *temp_pixmap = QPixmap(r.width(), r.height()); + temp_pixmap = new QPixmap(temp_visibleRect.size()); + else if (temp_pixmap->width() < temp_visibleRect.width() || temp_pixmap->height() < temp_visibleRect.height()) { + *temp_pixmap = QPixmap(temp_visibleRect.size()); scene_setXRenderOffscreenTarget(0); // invalidate, better crash than cause weird results for developers } if (Extensions::nonNativePixmaps()) { @@ -471,9 +472,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat Client *client = dynamic_cast(toplevel); Deleted *deleted = dynamic_cast(toplevel); const QRect decorationRect = toplevel->decorationRect(); - if (client && Workspace::self()->decorationHasAlpha()) - transformed_shape = decorationRect; - else if (deleted && Workspace::self()->decorationHasAlpha()) + if ((client || deleted) && Workspace::self()->decorationHasAlpha()) transformed_shape = decorationRect; else transformed_shape = shape(); @@ -538,9 +537,10 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat Picture renderTarget = buffer; if (blitInTempPixmap) { - if (scene_xRenderOffscreenTarget()) + if (scene_xRenderOffscreenTarget()) { + temp_visibleRect = toplevel->visibleRect().translated(-toplevel->pos()); renderTarget = *scene_xRenderOffscreenTarget(); - else { + } else { prepareTempPixmap(); renderTarget = temp_pixmap->x11PictureHandle(); } @@ -568,7 +568,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat //END OF STUPID RADEON HACK } #define MAP_RECT_TO_TARGET(_RECT_) \ - if (blitInTempPixmap) _RECT_.translate(-decorationRect.topLeft()); else _RECT_ = mapToScreen(mask, data, _RECT_) + if (blitInTempPixmap) _RECT_.translate(-temp_visibleRect.topLeft()); else _RECT_ = mapToScreen(mask, data, _RECT_) //BEGIN deco preparations bool noBorder = true; @@ -624,7 +624,7 @@ void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintDat //BEGIN client preparations QRect dr = cr; if (blitInTempPixmap) { - dr.translate(-decorationRect.topLeft()); + dr.translate(-temp_visibleRect.topLeft()); } else { dr = mapToScreen(mask, data, dr); // Destination rect if (scaled) { @@ -685,13 +685,14 @@ XRenderComposite(display(), PictOpOver, _PART_->x11PictureHandle(), decorationAl // fake brightness change by overlaying black XRenderColor col = { 0, 0, 0, 0xffff *(1 - data.brightness) * data.opacity }; if (blitInTempPixmap) { - XRenderFillRectangle(display(), PictOpOver, renderTarget, &col, -decorationRect.left(), -decorationRect.top(), width(), height()); + XRenderFillRectangle(display(), PictOpOver, renderTarget, &col, + -temp_visibleRect.left(), -temp_visibleRect.top(), width(), height()); } else { XRenderFillRectangle(display(), PictOpOver, renderTarget, &col, wr.x(), wr.y(), wr.width(), wr.height()); } } if (blitInTempPixmap) { - const QRect r = mapToScreen(mask, data, decorationRect); + const QRect r = mapToScreen(mask, data, temp_visibleRect); XRenderSetPictureTransform(display(), temp_pixmap->x11PictureHandle(), &xform); XRenderSetPictureFilter(display(), temp_pixmap->x11PictureHandle(), const_cast("good"), NULL, 0); XRenderComposite(display(), PictOpOver, temp_pixmap->x11PictureHandle(), None, buffer, diff --git a/scene_xrender.h b/scene_xrender.h index b544b0b02e..dc3553a01b 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -91,6 +91,7 @@ private: double alpha_cached_opacity; QRegion transformed_shape; static QPixmap *temp_pixmap; + static QRect temp_visibleRect; }; class SceneXrender::EffectFrame diff --git a/toplevel.cpp b/toplevel.cpp index 60662c96ac..00bd7dd265 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -96,10 +96,7 @@ QDebug& operator<<(QDebug& stream, const ConstToplevelList& list) QRect Toplevel::decorationRect() const { - QRect r(rect()); - if (hasShadow()) - r |= shadow()->shadowRegion().boundingRect(); - return r; + return rect(); } void Toplevel::detectShape(Window id)