less flicker
svn path=/trunk/kdebase/kwin/; revision=61018
This commit is contained in:
parent
3fccc94b5b
commit
d0ab0a1595
2 changed files with 37 additions and 27 deletions
|
@ -275,7 +275,7 @@ void LaptopClient::slotReset()
|
|||
|
||||
LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||
const char *name )
|
||||
: Client( ws, w, parent, name, WResizeNoErase )
|
||||
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity )
|
||||
{
|
||||
if(titleHeight == -1){
|
||||
KConfig *config = KGlobal::config();
|
||||
|
@ -352,14 +352,15 @@ void LaptopClient::resizeEvent( QResizeEvent* e)
|
|||
Client::resizeEvent( e );
|
||||
|
||||
doShape();
|
||||
if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) {
|
||||
QPainter p( this );
|
||||
QRect t = titlebar->geometry();
|
||||
t.setTop( 0 );
|
||||
QRegion r = rect();
|
||||
r = r.subtract( t );
|
||||
p.setClipRegion( r );
|
||||
p.eraseRect( rect() );
|
||||
if ( isVisibleToTLW() ) {
|
||||
int dx = 16 + QABS( e->oldSize().width() - width() );
|
||||
int dy = 16 + QABS( e->oldSize().height() - height() );
|
||||
update( 0, height() - dy + 1, width(), dy );
|
||||
update( width() - dx + 1, 0, dx, height() );
|
||||
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() ) );
|
||||
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
|
||||
// titlebar needs no background
|
||||
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -377,8 +378,8 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
QRect r(width()-33, height()-33, 33, 33);
|
||||
p.setPen(Qt::black);
|
||||
p.drawRect(r);
|
||||
qDrawShadePanel(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false, 1,
|
||||
&g.brush(QColorGroup::Background));
|
||||
qDrawShadePanel(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false, 1 );
|
||||
// &g.brush(QColorGroup::Background));
|
||||
p.setPen(g.light());
|
||||
p.drawLine(r.right()-7, r.y()+1, r.right()-7, r.bottom()-8);
|
||||
p.drawLine(r.x()+1, r.bottom()-7, r.right()-7, r.bottom()-7);
|
||||
|
@ -391,9 +392,7 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
|||
p.setPen(Qt::black);
|
||||
p.drawRect(r);
|
||||
qDrawShadeRect(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false,
|
||||
1, 0, &g.brush(QColorGroup::Background));
|
||||
//qDrawShadePanel(&p, r.x()+3, r.y()+17, r.width()-6, r.height()-20, g,
|
||||
// true, 1);
|
||||
1, 0 ); //, &g.brush(QColorGroup::Background));
|
||||
qDrawShadePanel(&p, r.x()+3, r.y()+titleHeight+3, r.width()-6,
|
||||
r.height()-titleHeight-6, g, true, 1);
|
||||
|
||||
|
@ -512,6 +511,16 @@ void LaptopClient::init()
|
|||
//
|
||||
}
|
||||
|
||||
Client::MousePosition LaptopClient::mousePosition( const QPoint& pos) const
|
||||
{
|
||||
QPoint p = pos;
|
||||
if ( pos.x() > rect().right() - 12 )
|
||||
p.rx() += 8;
|
||||
if ( pos.y() > rect().bottom() - 12 )
|
||||
p.ry() += 8;
|
||||
return Client::mousePosition( p );
|
||||
}
|
||||
|
||||
void LaptopClient::activeChange(bool)
|
||||
{
|
||||
repaint(false);
|
||||
|
|
|
@ -31,6 +31,7 @@ class LaptopClient : public Client
|
|||
public:
|
||||
LaptopClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 );
|
||||
~LaptopClient(){;}
|
||||
MousePosition mousePosition( const QPoint& ) const;
|
||||
protected:
|
||||
void resizeEvent( QResizeEvent* );
|
||||
void paintEvent( QPaintEvent* );
|
||||
|
|
Loading…
Reference in a new issue