some cleanups

svn path=/trunk/kdebase/kwin/; revision=73923
This commit is contained in:
Matthias Ettrich 2000-12-08 11:57:09 +00:00
parent 52973e7e30
commit ccc84f2cfe
3 changed files with 15 additions and 18 deletions

View file

@ -16,6 +16,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qlayout.h>
#include <qpainter.h>
#include <qwhatsthis.h>
#include <qobjectlist.h>
#include <qdatetime.h>
#include <qtimer.h>
#include <kwin.h>
@ -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;

View file

@ -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() ) )

View file

@ -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 );