With transparent moving/resizing, make sure the outline is not larger

than the window (#88567).

svn path=/trunk/kdebase/kwin/; revision=348501
remotes/origin/Plasma/5.0
Luboš Luňák 22 years ago
parent d76ee99c2e
commit 4e52fbebdc
  1. 21
      clients/b2/b2client.cpp
  2. 15
      geometry.cpp
  3. 3
      lib/kdecoration.h

@ -1092,16 +1092,25 @@ bool B2Client::drawbound(const QRect& geom, bool clear)
int barLeft = geom.left() + bar_x_ofs;
int barRight = barLeft + t.width() - 1;
if (barRight > geom.right()) barRight = geom.right();
// line width is 5 pixels, so compensate for the 2 outer pixels (#88657)
QRect g = geom;
g.setLeft( g.left() + 2 );
g.setTop( g.top() + 2 );
g.setRight( g.right() - 2 );
g.setBottom( g.bottom() - 2 );
frameTop += 2;
barLeft += 2;
barRight -= 2;
bound_shape.putPoints(0, 8,
geom.left(), frameTop,
g.left(), frameTop,
barLeft, frameTop,
barLeft, geom.top(),
barRight, geom.top(),
barLeft, g.top(),
barRight, g.top(),
barRight, frameTop,
geom.right(), frameTop,
geom.right(), geom.bottom(),
geom.left(), geom.bottom());
g.right(), frameTop,
g.right(), g.bottom(),
g.left(), g.bottom());
} else {
*visible_bound = geom;
}

@ -1978,7 +1978,20 @@ void Client::doDrawbound( const QRect& geom, bool clear )
QPainter p ( workspace()->desktopWidget() );
p.setPen( QPen( Qt::white, 5 ) );
p.setRasterOp( Qt::XorROP );
p.drawRect( geom );
// the line is 5 pixel thick, so compensate for the extra two pixels
// on outside (#88657)
QRect g = geom;
if( g.width() > 5 )
{
g.setLeft( g.left() + 2 );
g.setRight( g.right() - 2 );
}
if( g.height() > 5 )
{
g.setTop( g.top() + 2 );
g.setBottom( g.bottom() - 2 );
}
p.drawRect( g );
}
void Client::positionGeometryTip()

@ -601,6 +601,9 @@ class KDecoration
* This function may be reimplemented to provide custom bound drawing
* for transparent moving or resizing of the window.
* @a False should be returned if the default implementation should be used.
* Note that if you e.g. paint the outline using a 5 pixels wide line,
* you should compensate for the 2 pixels that would make the window
* look larger.
*
* @param geom The geometry at this the bound should be drawn
* @param clear @a true if the bound should be cleared

Loading…
Cancel
Save