reduce flicker when dragging the titlebar

svn path=/trunk/kdebase/kwin/; revision=46450
This commit is contained in:
Boris Wedl 2000-04-12 17:00:56 +00:00
parent 6f2db8d4c7
commit 06dc47b2da
2 changed files with 18 additions and 11 deletions

View file

@ -282,11 +282,15 @@ B2Client::B2Client( Workspace *ws, WId w, QWidget *parent,
else else
button[BtnMax]->setPixmaps(iMaxPix, iMaxPixDown); button[BtnMax]->setPixmaps(iMaxPix, iMaxPixDown);
} }
QColor c = options->colorGroup(Options::TitleBar, isActive()). // QColor c = options->colorGroup(Options::TitleBar, isActive()).
// color(QColorGroup::Button);
QColor c = options->colorGroup(Options::TitleBar, true).
color(QColorGroup::Button); color(QColorGroup::Button);
for(i=0; i < 6; ++i) for(i=0; i < 6; ++i)
button[i]->setBg(c); button[i]->setBg(c);
setBackgroundColor(c);
positionButtons(); positionButtons();
connect(button[BtnMenu], SIGNAL(clicked()), this, SLOT(menuButtonPressed())); connect(button[BtnMenu], SIGNAL(clicked()), this, SLOT(menuButtonPressed()));
connect(button[BtnSticky], SIGNAL(clicked()), this, SLOT(toggleSticky())); connect(button[BtnSticky], SIGNAL(clicked()), this, SLOT(toggleSticky()));
@ -319,13 +323,14 @@ void B2Client::captionChange( const QString &)
{ {
positionButtons(); positionButtons();
doShape(); doShape();
repaint(); repaint(false);
} }
void B2Client::paintEvent( QPaintEvent* ) void B2Client::paintEvent( QPaintEvent* )
{ {
QPixmap pm(size());
QPainter p( this ); QPainter p;
p.begin( &pm, this );
QRect t = g->cellGeometry(0, 1); QRect t = g->cellGeometry(0, 1);
t.setRight(button[BtnClose]->x()+17); t.setRight(button[BtnClose]->x()+17);
@ -382,6 +387,8 @@ void B2Client::paintEvent( QPaintEvent* )
button[BtnSticky]->x()+17); button[BtnSticky]->x()+17);
t.setRight(button[BtnIconify]->x()-1); t.setRight(button[BtnIconify]->x()-1);
p.drawText(t, AlignLeft | AlignVCenter, caption()); p.drawText(t, AlignLeft | AlignVCenter, caption());
p.end();
bitBlt(this, 0, 0, &pm);
} }
#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
@ -414,7 +421,7 @@ void B2Client::showEvent(QShowEvent *ev)
{ {
Client::showEvent(ev); Client::showEvent(ev);
doShape(); doShape();
repaint(); repaint(false);
} }
void B2Client::windowWrapperShowEvent( QShowEvent* ) void B2Client::windowWrapperShowEvent( QShowEvent* )
@ -504,7 +511,7 @@ void B2Client::mouseMoveEvent( QMouseEvent * e)
if (bar_x_ofs != old_ofs) { if (bar_x_ofs != old_ofs) {
positionButtons(); positionButtons();
doShape(); doShape();
repaint( 0, 0, width(), t.height(), true ); repaint( 0, 0, width(), t.height(), false );
} }
} }
} else } else
@ -530,7 +537,7 @@ void B2Client::maximizeChange(bool m)
else else
button[BtnMax]->setPixmaps(iMaxPix, iMaxPixDown); button[BtnMax]->setPixmaps(iMaxPix, iMaxPixDown);
} }
button[BtnMax]->repaint(); button[BtnMax]->repaint(false);
} }
@ -563,7 +570,7 @@ void B2Client::activeChange(bool on)
color(QColorGroup::Button); color(QColorGroup::Button);
for(i=0; i < 6; ++i){ for(i=0; i < 6; ++i){
button[i]->setBg(c); button[i]->setBg(c);
button[i]->repaint(); button[i]->repaint(false);
} }
Client::activeChange(on); Client::activeChange(on);
} }
@ -590,7 +597,7 @@ void B2Client::slotReset()
button[i]->setBg(c); button[i]->setBg(c);
button[i]->repaint(false); button[i]->repaint(false);
} }
repaint(); repaint(false);
} }
static void redraw_pixmaps() static void redraw_pixmaps()

View file

@ -16,7 +16,7 @@ public:
B2Button(QWidget *parent=0, const char *name=0) B2Button(QWidget *parent=0, const char *name=0)
: QButton(parent, name){useMiniIcon = false;} : QButton(parent, name){useMiniIcon = false;}
B2Button(KPixmap *pix, KPixmap *pixDown, QWidget *parent=0, const char *name=0); B2Button(KPixmap *pix, KPixmap *pixDown, QWidget *parent=0, const char *name=0);
void setBg(const QColor &c){bg = c;} void setBg(const QColor &c){bg = c; setBackgroundColor(c);}
void setPixmaps(KPixmap *pix, KPixmap *pixDown); void setPixmaps(KPixmap *pix, KPixmap *pixDown);
void setToggle(){setToggleType(Toggle);} void setToggle(){setToggleType(Toggle);}
void setActive(bool on){setOn(on);} void setActive(bool on){setOn(on);}