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=61249icc-effect-5.14.5
parent
078b8b3ff4
commit
5b1fb25c55
|
@ -1846,6 +1846,7 @@ void Client::setShade( bool s )
|
||||||
QSize s( sizeForWindowSize( QSize( windowWrapper()->width(), 0), TRUE ) );
|
QSize s( sizeForWindowSize( QSize( windowWrapper()->width(), 0), TRUE ) );
|
||||||
windowWrapper()->hide();
|
windowWrapper()->hide();
|
||||||
repaint( FALSE ); // force direct repaint
|
repaint( FALSE ); // force direct repaint
|
||||||
|
bool wasNorthWest = testWFlags( WNorthWestGravity );
|
||||||
setWFlags( WNorthWestGravity );
|
setWFlags( WNorthWestGravity );
|
||||||
int step = QMAX( 4, QABS( h - s.height() ) / as )+1;
|
int step = QMAX( 4, QABS( h - s.height() ) / as )+1;
|
||||||
do {
|
do {
|
||||||
|
@ -1853,7 +1854,8 @@ void Client::setShade( bool s )
|
||||||
resize ( s.width(), h );
|
resize ( s.width(), h );
|
||||||
QApplication::syncX();
|
QApplication::syncX();
|
||||||
} while ( h > s.height() + step );
|
} while ( h > s.height() + step );
|
||||||
clearWFlags( WNorthWestGravity );
|
if ( !wasNorthWest )
|
||||||
|
clearWFlags( WNorthWestGravity );
|
||||||
resize (s );
|
resize (s );
|
||||||
XEvent tmpE;
|
XEvent tmpE;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -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)
|
const unsigned char *bitmap)
|
||||||
: QButton(parent, name)
|
: 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));
|
return(QSize(22, 12));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void SystemButton::reset()
|
void LaptopClientButton::reset()
|
||||||
{
|
{
|
||||||
repaint(false);
|
repaint(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemButton::setBitmap(const unsigned char *bitmap)
|
void LaptopClientButton::setBitmap(const unsigned char *bitmap)
|
||||||
{
|
{
|
||||||
deco = QBitmap(8, 8, bitmap, true);
|
deco = QBitmap(8, 8, bitmap, true);
|
||||||
deco.setMask(deco);
|
deco.setMask(deco);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemButton::drawButton(QPainter *p)
|
void LaptopClientButton::drawButton(QPainter *p)
|
||||||
{
|
{
|
||||||
bool smallBtn = width() == btnWidth1;
|
bool smallBtn = width() == btnWidth1;
|
||||||
if(btnPix1){
|
if(btnPix1){
|
||||||
|
@ -302,18 +302,18 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
g->addColSpacing(2, 4);
|
g->addColSpacing(2, 4);
|
||||||
g->addColSpacing(2, 12);
|
g->addColSpacing(2, 12);
|
||||||
|
|
||||||
button[0] = new SystemButton(28, titleHeight-2, this, "close", close_bits);
|
button[0] = new LaptopClientButton(28, titleHeight-2, this, "close", close_bits);
|
||||||
button[1] = new SystemButton(18, titleHeight-2, this, "sticky");
|
button[1] = new LaptopClientButton(18, titleHeight-2, this, "sticky");
|
||||||
if(isSticky())
|
if(isSticky())
|
||||||
button[1]->setBitmap(unsticky_bits);
|
button[1]->setBitmap(unsticky_bits);
|
||||||
else
|
else
|
||||||
button[1]->setBitmap(sticky_bits);
|
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);
|
iconify_bits);
|
||||||
button[3] = new SystemButton(28, titleHeight-2, this, "maximize",
|
button[3] = new LaptopClientButton(28, titleHeight-2, this, "maximize",
|
||||||
maximize_bits);
|
maximize_bits);
|
||||||
if(help){
|
if(help){
|
||||||
button[4] = new SystemButton(18, titleHeight-2, this, "help",
|
button[4] = new LaptopClientButton(18, titleHeight-2, this, "help",
|
||||||
question_bits);
|
question_bits);
|
||||||
connect( button[4], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
|
connect( button[4], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
|
||||||
}
|
}
|
||||||
|
@ -353,14 +353,21 @@ void LaptopClient::resizeEvent( QResizeEvent* e)
|
||||||
|
|
||||||
doShape();
|
doShape();
|
||||||
if ( isVisibleToTLW() ) {
|
if ( isVisibleToTLW() ) {
|
||||||
int dx = 16 + QABS( e->oldSize().width() - width() );
|
int dx = 0;
|
||||||
int dy = 16 + QABS( e->oldSize().height() - height() );
|
int dy = 0;
|
||||||
update( 0, height() - dy + 1, width(), dy );
|
if ( e->oldSize().width() != width() )
|
||||||
update( width() - dx + 1, 0, dx, height() );
|
dx = 16 + QABS( e->oldSize().width() - width() );
|
||||||
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() ) );
|
if ( e->oldSize().height() != height() )
|
||||||
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
|
dy = 16 + QABS( e->oldSize().height() - height() );
|
||||||
// titlebar needs no background
|
if ( dy )
|
||||||
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
|
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 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ class QSpacerItem;
|
||||||
|
|
||||||
|
|
||||||
// get rid of autohide :P
|
// get rid of autohide :P
|
||||||
class SystemButton : public QButton
|
class LaptopClientButton : public QButton
|
||||||
{
|
{
|
||||||
public:
|
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);
|
const unsigned char *bitmap=NULL);
|
||||||
void setBitmap(const unsigned char *bitmap);
|
void setBitmap(const unsigned char *bitmap);
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -47,7 +47,7 @@ protected:
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotReset();
|
void slotReset();
|
||||||
private:
|
private:
|
||||||
SystemButton* button[5];
|
LaptopClientButton* button[5];
|
||||||
QSpacerItem* titlebar;
|
QSpacerItem* titlebar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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)
|
const unsigned char *bitmap)
|
||||||
: QButton(parent, name)
|
: QButton(parent, name)
|
||||||
{
|
{
|
||||||
|
@ -223,24 +223,24 @@ SystemButton::SystemButton(int w, int h, Client *parent, const char *name,
|
||||||
//setBackgroundMode(QWidget::NoBackground);
|
//setBackgroundMode(QWidget::NoBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize SystemButton::sizeHint() const
|
QSize KDEDefaultClientButton::sizeHint() const
|
||||||
{
|
{
|
||||||
return(defaultSize);
|
return(defaultSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemButton::reset()
|
void KDEDefaultClientButton::reset()
|
||||||
{
|
{
|
||||||
repaint(false);
|
repaint(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemButton::setBitmap(const unsigned char *bitmap)
|
void KDEDefaultClientButton::setBitmap(const unsigned char *bitmap)
|
||||||
{
|
{
|
||||||
deco = QBitmap(8, 8, bitmap, true);
|
deco = QBitmap(8, 8, bitmap, true);
|
||||||
deco.setMask(deco);
|
deco.setMask(deco);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemButton::drawButton(QPainter *p)
|
void KDEDefaultClientButton::drawButton(QPainter *p)
|
||||||
{
|
{
|
||||||
bool smallBtn = width() == btnWidth1;
|
bool smallBtn = width() == btnWidth1;
|
||||||
if(btnPix1){
|
if(btnPix1){
|
||||||
|
@ -321,18 +321,18 @@ KDEClient::KDEClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
g->addColSpacing(0, 4);
|
g->addColSpacing(0, 4);
|
||||||
g->addColSpacing(2, 4);
|
g->addColSpacing(2, 4);
|
||||||
|
|
||||||
button[BtnClose] = new SystemButton(28, titleHeight, this, "close", close_bits);
|
button[BtnClose] = new KDEDefaultClientButton(28, titleHeight, this, "close", close_bits);
|
||||||
button[BtnSticky] = new SystemButton(18, titleHeight, this, "sticky");
|
button[BtnSticky] = new KDEDefaultClientButton(18, titleHeight, this, "sticky");
|
||||||
if(isSticky())
|
if(isSticky())
|
||||||
button[BtnSticky]->setBitmap(unsticky_bits);
|
button[BtnSticky]->setBitmap(unsticky_bits);
|
||||||
else
|
else
|
||||||
button[BtnSticky]->setBitmap(sticky_bits);
|
button[BtnSticky]->setBitmap(sticky_bits);
|
||||||
button[BtnIconify] = new SystemButton(28, titleHeight, this, "iconify",
|
button[BtnIconify] = new KDEDefaultClientButton(28, titleHeight, this, "iconify",
|
||||||
iconify_bits);
|
iconify_bits);
|
||||||
button[BtnMax] = new SystemButton(28, titleHeight, this, "maximize",
|
button[BtnMax] = new KDEDefaultClientButton(28, titleHeight, this, "maximize",
|
||||||
maximize_bits);
|
maximize_bits);
|
||||||
if(help){
|
if(help){
|
||||||
button[BtnHelp] = new SystemButton(18, titleHeight, this, "help",
|
button[BtnHelp] = new KDEDefaultClientButton(18, titleHeight, this, "help",
|
||||||
question_bits);
|
question_bits);
|
||||||
connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
|
connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
|
||||||
}
|
}
|
||||||
|
@ -386,14 +386,21 @@ void KDEClient::resizeEvent( QResizeEvent* e)
|
||||||
doShape();
|
doShape();
|
||||||
calcHiddenButtons();
|
calcHiddenButtons();
|
||||||
if ( isVisibleToTLW() ) {
|
if ( isVisibleToTLW() ) {
|
||||||
int dx = 16 + QABS( e->oldSize().width() - width() );
|
int dx = 0;
|
||||||
int dy = 16 + QABS( e->oldSize().height() - height() );
|
int dy = 0;
|
||||||
update( 0, height() - dy + 1, width(), dy );
|
if ( e->oldSize().width() != width() )
|
||||||
update( width() - dx + 1, 0, dx, height() );
|
dx = 16 + QABS( e->oldSize().width() - width() );
|
||||||
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() - QPoint(1,0) ) );
|
if ( e->oldSize().height() != height() )
|
||||||
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
|
dy = 8 + QABS( e->oldSize().height() - height() );
|
||||||
// titlebar needs no background
|
if ( dy )
|
||||||
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
|
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 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@ class QHBoxLayout;
|
||||||
|
|
||||||
|
|
||||||
// get rid of autohide :P
|
// get rid of autohide :P
|
||||||
class SystemButton : public QButton
|
class KDEDefaultClientButton : public QButton
|
||||||
{
|
{
|
||||||
public:
|
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);
|
const unsigned char *bitmap=NULL);
|
||||||
void setBitmap(const unsigned char *bitmap);
|
void setBitmap(const unsigned char *bitmap);
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -67,7 +67,7 @@ protected slots:
|
||||||
void slotReset();
|
void slotReset();
|
||||||
void slotMaximize();
|
void slotMaximize();
|
||||||
private:
|
private:
|
||||||
SystemButton* button[5];
|
KDEDefaultClientButton* button[5];
|
||||||
QSpacerItem* titlebar;
|
QSpacerItem* titlebar;
|
||||||
bool hiddenItems;
|
bool hiddenItems;
|
||||||
QHBoxLayout *hb;
|
QHBoxLayout *hb;
|
||||||
|
|
Loading…
Reference in New Issue