less flicker for default. Clean-up namespace for classes

(several clients used different versions of the same class 'SystemButton')

svn path=/trunk/kdebase/kwin/; revision=61249
icc-effect-5.14.5
Matthias Ettrich 2000-08-16 13:11:21 +00:00
parent 078b8b3ff4
commit 5b1fb25c55
5 changed files with 59 additions and 43 deletions

View File

@ -1846,6 +1846,7 @@ void Client::setShade( bool s )
QSize s( sizeForWindowSize( QSize( windowWrapper()->width(), 0), TRUE ) );
windowWrapper()->hide();
repaint( FALSE ); // force direct repaint
bool wasNorthWest = testWFlags( WNorthWestGravity );
setWFlags( WNorthWestGravity );
int step = QMAX( 4, QABS( h - s.height() ) / as )+1;
do {
@ -1853,7 +1854,8 @@ void Client::setShade( bool s )
resize ( s.width(), h );
QApplication::syncX();
} while ( h > s.height() + step );
clearWFlags( WNorthWestGravity );
if ( !wasNorthWest )
clearWFlags( WNorthWestGravity );
resize (s );
XEvent tmpE;
do {

View File

@ -181,7 +181,7 @@ static void create_pixmaps()
}
SystemButton::SystemButton(int w, int h, Client *parent, const char *name,
LaptopClientButton::LaptopClientButton(int w, int h, Client *parent, const char *name,
const unsigned char *bitmap)
: QButton(parent, name)
{
@ -193,24 +193,24 @@ SystemButton::SystemButton(int w, int h, Client *parent, const char *name,
}
/*
QSize SystemButton::sizeHint() const
QSize LaptopClientButton::sizeHint() const
{
return(QSize(22, 12));
}*/
void SystemButton::reset()
void LaptopClientButton::reset()
{
repaint(false);
}
void SystemButton::setBitmap(const unsigned char *bitmap)
void LaptopClientButton::setBitmap(const unsigned char *bitmap)
{
deco = QBitmap(8, 8, bitmap, true);
deco.setMask(deco);
repaint();
}
void SystemButton::drawButton(QPainter *p)
void LaptopClientButton::drawButton(QPainter *p)
{
bool smallBtn = width() == btnWidth1;
if(btnPix1){
@ -302,18 +302,18 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
g->addColSpacing(2, 4);
g->addColSpacing(2, 12);
button[0] = new SystemButton(28, titleHeight-2, this, "close", close_bits);
button[1] = new SystemButton(18, titleHeight-2, this, "sticky");
button[0] = new LaptopClientButton(28, titleHeight-2, this, "close", close_bits);
button[1] = new LaptopClientButton(18, titleHeight-2, this, "sticky");
if(isSticky())
button[1]->setBitmap(unsticky_bits);
else
button[1]->setBitmap(sticky_bits);
button[2] = new SystemButton(28, titleHeight-2, this, "iconify",
button[2] = new LaptopClientButton(28, titleHeight-2, this, "iconify",
iconify_bits);
button[3] = new SystemButton(28, titleHeight-2, this, "maximize",
button[3] = new LaptopClientButton(28, titleHeight-2, this, "maximize",
maximize_bits);
if(help){
button[4] = new SystemButton(18, titleHeight-2, this, "help",
button[4] = new LaptopClientButton(18, titleHeight-2, this, "help",
question_bits);
connect( button[4], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
}
@ -353,14 +353,21 @@ void LaptopClient::resizeEvent( QResizeEvent* e)
doShape();
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 ) );
int dx = 0;
int dy = 0;
if ( e->oldSize().width() != width() )
dx = 16 + QABS( e->oldSize().width() - width() );
if ( e->oldSize().height() != height() )
dy = 16 + QABS( e->oldSize().height() - height() );
if ( dy )
update( 0, height() - dy + 1, width(), dy );
if ( dx ) {
update( width() - dx + 1, 0, dx, height() );
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() - QPoint(1,0) ) );
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
// titlebar needs no background
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
}
}
}

View File

@ -10,10 +10,10 @@ class QSpacerItem;
// get rid of autohide :P
class SystemButton : public QButton
class LaptopClientButton : public QButton
{
public:
SystemButton(int w, int h, Client *parent=0, const char *name=0,
LaptopClientButton(int w, int h, Client *parent=0, const char *name=0,
const unsigned char *bitmap=NULL);
void setBitmap(const unsigned char *bitmap);
void reset();
@ -47,7 +47,7 @@ protected:
protected slots:
void slotReset();
private:
SystemButton* button[5];
LaptopClientButton* button[5];
QSpacerItem* titlebar;
};

View File

@ -210,7 +210,7 @@ static void create_pixmaps()
}
SystemButton::SystemButton(int w, int h, Client *parent, const char *name,
KDEDefaultClientButton::KDEDefaultClientButton(int w, int h, Client *parent, const char *name,
const unsigned char *bitmap)
: QButton(parent, name)
{
@ -223,24 +223,24 @@ SystemButton::SystemButton(int w, int h, Client *parent, const char *name,
//setBackgroundMode(QWidget::NoBackground);
}
QSize SystemButton::sizeHint() const
QSize KDEDefaultClientButton::sizeHint() const
{
return(defaultSize);
}
void SystemButton::reset()
void KDEDefaultClientButton::reset()
{
repaint(false);
}
void SystemButton::setBitmap(const unsigned char *bitmap)
void KDEDefaultClientButton::setBitmap(const unsigned char *bitmap)
{
deco = QBitmap(8, 8, bitmap, true);
deco.setMask(deco);
repaint();
}
void SystemButton::drawButton(QPainter *p)
void KDEDefaultClientButton::drawButton(QPainter *p)
{
bool smallBtn = width() == btnWidth1;
if(btnPix1){
@ -321,18 +321,18 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
g->addColSpacing(0, 4);
g->addColSpacing(2, 4);
button[BtnClose] = new SystemButton(28, titleHeight, this, "close", close_bits);
button[BtnSticky] = new SystemButton(18, titleHeight, this, "sticky");
button[BtnClose] = new KDEDefaultClientButton(28, titleHeight, this, "close", close_bits);
button[BtnSticky] = new KDEDefaultClientButton(18, titleHeight, this, "sticky");
if(isSticky())
button[BtnSticky]->setBitmap(unsticky_bits);
else
button[BtnSticky]->setBitmap(sticky_bits);
button[BtnIconify] = new SystemButton(28, titleHeight, this, "iconify",
button[BtnIconify] = new KDEDefaultClientButton(28, titleHeight, this, "iconify",
iconify_bits);
button[BtnMax] = new SystemButton(28, titleHeight, this, "maximize",
button[BtnMax] = new KDEDefaultClientButton(28, titleHeight, this, "maximize",
maximize_bits);
if(help){
button[BtnHelp] = new SystemButton(18, titleHeight, this, "help",
button[BtnHelp] = new KDEDefaultClientButton(18, titleHeight, this, "help",
question_bits);
connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
}
@ -386,14 +386,21 @@ void KDEClient::resizeEvent( QResizeEvent* e)
doShape();
calcHiddenButtons();
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() - QPoint(1,0) ) );
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
// titlebar needs no background
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
int dx = 0;
int dy = 0;
if ( e->oldSize().width() != width() )
dx = 16 + QABS( e->oldSize().width() - width() );
if ( e->oldSize().height() != height() )
dy = 8 + QABS( e->oldSize().height() - height() );
if ( dy )
update( 0, height() - dy + 1, width(), dy );
if ( dx ) {
update( width() - dx + 1, 0, dx, height() );
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() - QPoint(1,0) ) );
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
// titlebar needs no background
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
}
}
}

View File

@ -11,10 +11,10 @@ class QHBoxLayout;
// get rid of autohide :P
class SystemButton : public QButton
class KDEDefaultClientButton : public QButton
{
public:
SystemButton(int w, int h, Client *parent=0, const char *name=0,
KDEDefaultClientButton(int w, int h, Client *parent=0, const char *name=0,
const unsigned char *bitmap=NULL);
void setBitmap(const unsigned char *bitmap);
void reset();
@ -67,7 +67,7 @@ protected slots:
void slotReset();
void slotMaximize();
private:
SystemButton* button[5];
KDEDefaultClientButton* button[5];
QSpacerItem* titlebar;
bool hiddenItems;
QHBoxLayout *hb;