diff --git a/client.cpp b/client.cpp index fed879589d..ef58095be0 100644 --- a/client.cpp +++ b/client.cpp @@ -16,6 +16,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich #include #include #include +#include #include #include #include @@ -2077,7 +2078,7 @@ void Client::setShade( bool s ) int h = height(); QSize s( sizeForWindowSize( QSize( windowWrapper()->width(), 0), TRUE ) ); windowWrapper()->hide(); - repaint( FALSE ); // force direct repaint + repaint( FALSE ); bool wasNorthWest = testWFlags( WNorthWestGravity ); setWFlags( WNorthWestGravity ); int step = QMAX( 4, QABS( h - s.height() ) / as )+1; @@ -2095,6 +2096,7 @@ void Client::setShade( bool s ) } else { int h = height(); QSize s( sizeForWindowSize( windowWrapper()->size(), TRUE ) ); + bool wasNorthWest = testWFlags( WNorthWestGravity ); setWFlags( WNorthWestGravity ); int step = QMAX( 4, QABS( h - s.height() ) / as )+1; do { @@ -2105,11 +2107,11 @@ void Client::setShade( bool s ) repaint( 0, h - step-5, width(), step+5, TRUE); QApplication::syncX(); } while ( h < s.height() - step ); - clearWFlags( WNorthWestGravity ); + if ( !wasNorthWest ) + clearWFlags( WNorthWestGravity ); resize ( s ); windowWrapper()->show(); activateLayout(); - repaint(); if ( isActive() ) workspace()->requestFocus( this ); XEvent tmpE; diff --git a/default/kdedefault.cpp b/default/kdedefault.cpp index 54bb39c1ea..9991f881f0 100644 --- a/default/kdedefault.cpp +++ b/default/kdedefault.cpp @@ -371,7 +371,6 @@ KDEDefaultClientButton::KDEDefaultClientButton(Client *parent, const char *name, resize(16, 16); if(bitmap) setBitmap(bitmap); - //setBackgroundMode(QWidget::NoBackground); } QSize KDEDefaultClientButton::sizeHint() const @@ -398,7 +397,7 @@ void KDEDefaultClientButton::setPixmap(const QPixmap &p, deco.resize(0, 0); pix = p; moPix = mouseOverPix; - setMask(QRect(0, 0, 16, 16)); + clearMask(); repaint(); } @@ -499,6 +498,8 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent, g->addRowSpacing(0, 3); g->addRowSpacing(2, 1); g->addWidget(windowWrapper(), 3, 1); + // without the next line, unshade flickers + g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) ); g->setRowStretch(3, 10); g->addRowSpacing(4, 8); // bottom handles g->addColSpacing(0, 4); @@ -604,16 +605,16 @@ void KDEClient::resizeEvent( QResizeEvent* e) Client::resizeEvent( e ); doShape(); - calcHiddenButtons(); + if ( e->oldSize().width() != width() ) { + calcHiddenButtons(); + // make layout update titlebar->geometry() in case some buttons + // where shown or hidden in calcHiddenButtons() above + QApplication::sendPostedEvents( this, QEvent::LayoutHint ); + } if ( !isVisible() ) return; - // make layout update titlebar->geometry() in case some buttons - // where shown or hidden in calcHiddenButtons() above - QApplication::sendPostedEvents( this, QEvent::LayoutHint ); - - // we selected WResizeNoErase and WNorthWestGravity. That means: // on a resize event, we do not get a full paint event and the // background is not erased. This makes it possible for us to @@ -777,11 +778,6 @@ void KDEClient::showEvent(QShowEvent *ev) repaint(); } -void KDEClient::windowWrapperShowEvent( QShowEvent* ) -{ - doShape(); -} - void KDEClient::mouseDoubleClickEvent( QMouseEvent * e ) { if (titlebar->geometry().contains( e->pos() ) ) diff --git a/default/kdedefault.h b/default/kdedefault.h index 3d0647b17c..98f721016b 100644 --- a/default/kdedefault.h +++ b/default/kdedefault.h @@ -12,7 +12,7 @@ class QHBoxLayout; // get rid of autohide :P class KDEDefaultClientButton : public QToolButton -{ +{ public: KDEDefaultClientButton(Client *parent=0, const char *name=0, const unsigned char *bitmap=NULL); @@ -57,7 +57,6 @@ protected: void resizeEvent( QResizeEvent* ); void paintEvent( QPaintEvent* ); void showEvent( QShowEvent* ); - void windowWrapperShowEvent( QShowEvent* ); void mouseDoubleClickEvent( QMouseEvent * ); void init(); void captionChange( const QString& name );