From f81485d868ec58689946e2168d2f6ce7899d9a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Wed, 27 May 2009 16:04:58 +0000 Subject: [PATCH] Fix shaded and shaped windows not being clipped correctly. BUG: 193808 svn path=/trunk/KDE/kdebase/workspace/; revision=973673 --- scene.cpp | 14 +++++++++----- scene.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scene.cpp b/scene.cpp index 0cac318ab7..20cb9cc66b 100644 --- a/scene.cpp +++ b/scene.cpp @@ -233,7 +233,7 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region ) w->resetPaintingEnabled(); data.paint = region; // Clip out the decoration for opaque windows; the decoration is drawn in the second pass - data.clip = w->isOpaque() ? QRegion(w->clientRect().translated( w->x(), w->y())) : QRegion(); + data.clip = w->isOpaque() ? w->clientShape().translated( w->x(), w->y() ) : QRegion(); data.quads = w->buildQuads(); // preparation step effects->prePaintWindow( effectWindow( w ), data, time_diff ); @@ -410,10 +410,14 @@ QRegion Scene::Window::shape() const return shape_region; } -// Returns the rectangle occupied by the client within the window geometry -QRect Scene::Window::clientRect() const +QRegion Scene::Window::clientShape() const { - return QRect(toplevel->clientPos(), toplevel->clientSize()); + Client *c = dynamic_cast< Client* >( toplevel ); + if ( c && c->isShade() ) + return QRegion(); + + const QRegion r = shape() & QRect( toplevel->clientPos(), toplevel->clientSize() ); + return r.isEmpty() ? QRegion() : r; } bool Scene::Window::isVisible() const @@ -477,7 +481,7 @@ WindowQuadList Scene::Window::buildQuads( bool force ) const else { Client *client = static_cast( toplevel ); - QRegion contents = shape() & QRect( toplevel->clientPos(), toplevel->clientSize()); + QRegion contents = clientShape(); QRegion decoration = (Workspace::self()->decorationHasAlpha() ? QRegion(client->decorationRect()) : shape()) - contents; ret = makeQuads( WindowQuadContents, contents ); diff --git a/scene.h b/scene.h index 69d146ed72..1de771feb2 100644 --- a/scene.h +++ b/scene.h @@ -186,7 +186,7 @@ class Scene::Window bool isOpaque() const; // shape of the window QRegion shape() const; - QRect clientRect() const; + QRegion clientShape() const; void discardShape(); void updateToplevel( Toplevel* c ); // creates initial quad list for the window