less flicker
svn path=/trunk/kdebase/kwin/; revision=61018
This commit is contained in:
parent
3fccc94b5b
commit
d0ab0a1595
2 changed files with 37 additions and 27 deletions
|
@ -26,7 +26,7 @@ extern "C"
|
||||||
|
|
||||||
static unsigned char iconify_bits[] = {
|
static unsigned char iconify_bits[] = {
|
||||||
0xff, 0xff, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18};
|
0xff, 0xff, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18};
|
||||||
|
|
||||||
static unsigned char close_bits[] = {
|
static unsigned char close_bits[] = {
|
||||||
0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00 };
|
0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00 };
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ static unsigned char maximize_bits[] = {
|
||||||
|
|
||||||
static unsigned char minmax_bits[] = {
|
static unsigned char minmax_bits[] = {
|
||||||
0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};
|
0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};
|
||||||
|
|
||||||
static unsigned char unsticky_bits[] = {
|
static unsigned char unsticky_bits[] = {
|
||||||
0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00};
|
0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00};
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ static unsigned char sticky_bits[] = {
|
||||||
|
|
||||||
static unsigned char question_bits[] = {
|
static unsigned char question_bits[] = {
|
||||||
0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18};
|
0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18};
|
||||||
|
|
||||||
static QPixmap *titlePix=0;
|
static QPixmap *titlePix=0;
|
||||||
static KPixmap *aUpperGradient=0;
|
static KPixmap *aUpperGradient=0;
|
||||||
static KPixmap *iUpperGradient=0;
|
static KPixmap *iUpperGradient=0;
|
||||||
|
@ -94,7 +94,7 @@ static void create_pixmaps()
|
||||||
titlePix = new QPixmap(33, 12);
|
titlePix = new QPixmap(33, 12);
|
||||||
QBitmap mask(33, 12);
|
QBitmap mask(33, 12);
|
||||||
mask.fill(Qt::color0);
|
mask.fill(Qt::color0);
|
||||||
|
|
||||||
p.begin(titlePix);
|
p.begin(titlePix);
|
||||||
maskPainter.begin(&mask);
|
maskPainter.begin(&mask);
|
||||||
maskPainter.setPen(Qt::color1);
|
maskPainter.setPen(Qt::color1);
|
||||||
|
@ -177,7 +177,7 @@ static void create_pixmaps()
|
||||||
if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128)
|
if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128)
|
||||||
btnForeground = Qt::black;
|
btnForeground = Qt::black;
|
||||||
else
|
else
|
||||||
btnForeground = Qt::white;
|
btnForeground = Qt::white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void LaptopClient::slotReset()
|
||||||
|
|
||||||
LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
const char *name )
|
const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase )
|
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity )
|
||||||
{
|
{
|
||||||
if(titleHeight == -1){
|
if(titleHeight == -1){
|
||||||
KConfig *config = KGlobal::config();
|
KConfig *config = KGlobal::config();
|
||||||
|
@ -286,12 +286,12 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
if(titleHeight > 32)
|
if(titleHeight > 32)
|
||||||
titleHeight = 32;
|
titleHeight = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
create_pixmaps();
|
create_pixmaps();
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
bool help = providesContextHelp();
|
bool help = providesContextHelp();
|
||||||
|
|
||||||
|
|
||||||
QGridLayout* g = new QGridLayout(this, 0, 0, 0);
|
QGridLayout* g = new QGridLayout(this, 0, 0, 0);
|
||||||
g->addRowSpacing(0, 3);
|
g->addRowSpacing(0, 3);
|
||||||
g->addRowSpacing(2, 1);
|
g->addRowSpacing(2, 1);
|
||||||
|
@ -301,7 +301,7 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
g->addColSpacing(0, 4);
|
g->addColSpacing(0, 4);
|
||||||
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 SystemButton(28, titleHeight-2, this, "close", close_bits);
|
||||||
button[1] = new SystemButton(18, titleHeight-2, this, "sticky");
|
button[1] = new SystemButton(18, titleHeight-2, this, "sticky");
|
||||||
if(isSticky())
|
if(isSticky())
|
||||||
|
@ -352,14 +352,15 @@ void LaptopClient::resizeEvent( QResizeEvent* e)
|
||||||
Client::resizeEvent( e );
|
Client::resizeEvent( e );
|
||||||
|
|
||||||
doShape();
|
doShape();
|
||||||
if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) {
|
if ( isVisibleToTLW() ) {
|
||||||
QPainter p( this );
|
int dx = 16 + QABS( e->oldSize().width() - width() );
|
||||||
QRect t = titlebar->geometry();
|
int dy = 16 + QABS( e->oldSize().height() - height() );
|
||||||
t.setTop( 0 );
|
update( 0, height() - dy + 1, width(), dy );
|
||||||
QRegion r = rect();
|
update( width() - dx + 1, 0, dx, height() );
|
||||||
r = r.subtract( t );
|
update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() ) );
|
||||||
p.setClipRegion( r );
|
update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) );
|
||||||
p.eraseRect( rect() );
|
// titlebar needs no background
|
||||||
|
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,8 +378,8 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
||||||
QRect r(width()-33, height()-33, 33, 33);
|
QRect r(width()-33, height()-33, 33, 33);
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
p.drawRect(r);
|
p.drawRect(r);
|
||||||
qDrawShadePanel(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false, 1,
|
qDrawShadePanel(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false, 1 );
|
||||||
&g.brush(QColorGroup::Background));
|
// &g.brush(QColorGroup::Background));
|
||||||
p.setPen(g.light());
|
p.setPen(g.light());
|
||||||
p.drawLine(r.right()-7, r.y()+1, r.right()-7, r.bottom()-8);
|
p.drawLine(r.right()-7, r.y()+1, r.right()-7, r.bottom()-8);
|
||||||
p.drawLine(r.x()+1, r.bottom()-7, r.right()-7, r.bottom()-7);
|
p.drawLine(r.x()+1, r.bottom()-7, r.right()-7, r.bottom()-7);
|
||||||
|
@ -387,19 +388,17 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
||||||
r = QRect(rect());
|
r = QRect(rect());
|
||||||
r.setHeight(r.height()-8);
|
r.setHeight(r.height()-8);
|
||||||
r.setWidth(r.width()-8);
|
r.setWidth(r.width()-8);
|
||||||
|
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
p.drawRect(r);
|
p.drawRect(r);
|
||||||
qDrawShadeRect(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false,
|
qDrawShadeRect(&p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, g, false,
|
||||||
1, 0, &g.brush(QColorGroup::Background));
|
1, 0 ); //, &g.brush(QColorGroup::Background));
|
||||||
//qDrawShadePanel(&p, r.x()+3, r.y()+17, r.width()-6, r.height()-20, g,
|
|
||||||
// true, 1);
|
|
||||||
qDrawShadePanel(&p, r.x()+3, r.y()+titleHeight+3, r.width()-6,
|
qDrawShadePanel(&p, r.x()+3, r.y()+titleHeight+3, r.width()-6,
|
||||||
r.height()-titleHeight-6, g, true, 1);
|
r.height()-titleHeight-6, g, true, 1);
|
||||||
|
|
||||||
r = titlebar->geometry();
|
r = titlebar->geometry();
|
||||||
KPixmap *grPix = isActive() ? aUpperGradient : iUpperGradient;
|
KPixmap *grPix = isActive() ? aUpperGradient : iUpperGradient;
|
||||||
|
|
||||||
if(grPix){
|
if(grPix){
|
||||||
p.drawTiledPixmap(r.x(), r.y(), r.width(), r.height()-1, *grPix);
|
p.drawTiledPixmap(r.x(), r.y(), r.width(), r.height()-1, *grPix);
|
||||||
}
|
}
|
||||||
|
@ -409,7 +408,7 @@ void LaptopClient::paintEvent( QPaintEvent* )
|
||||||
|
|
||||||
if(titlePix && isActive())
|
if(titlePix && isActive())
|
||||||
p.drawTiledPixmap(r.x(), r.y(), r.width(), r.height()-1, *titlePix);
|
p.drawTiledPixmap(r.x(), r.y(), r.width(), r.height()-1, *titlePix);
|
||||||
|
|
||||||
|
|
||||||
QButton *rBtn = providesContextHelp() ? button[4] : button[1];
|
QButton *rBtn = providesContextHelp() ? button[4] : button[1];
|
||||||
int x2 = button[3]->x()+button[3]->width();
|
int x2 = button[3]->x()+button[3]->width();
|
||||||
|
@ -488,7 +487,7 @@ void LaptopClient::showEvent(QShowEvent *ev)
|
||||||
void LaptopClient::windowWrapperShowEvent( QShowEvent* )
|
void LaptopClient::windowWrapperShowEvent( QShowEvent* )
|
||||||
{
|
{
|
||||||
doShape();
|
doShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaptopClient::mouseDoubleClickEvent( QMouseEvent * e )
|
void LaptopClient::mouseDoubleClickEvent( QMouseEvent * e )
|
||||||
{
|
{
|
||||||
|
@ -512,6 +511,16 @@ void LaptopClient::init()
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client::MousePosition LaptopClient::mousePosition( const QPoint& pos) const
|
||||||
|
{
|
||||||
|
QPoint p = pos;
|
||||||
|
if ( pos.x() > rect().right() - 12 )
|
||||||
|
p.rx() += 8;
|
||||||
|
if ( pos.y() > rect().bottom() - 12 )
|
||||||
|
p.ry() += 8;
|
||||||
|
return Client::mousePosition( p );
|
||||||
|
}
|
||||||
|
|
||||||
void LaptopClient::activeChange(bool)
|
void LaptopClient::activeChange(bool)
|
||||||
{
|
{
|
||||||
repaint(false);
|
repaint(false);
|
||||||
|
|
|
@ -31,6 +31,7 @@ class LaptopClient : public Client
|
||||||
public:
|
public:
|
||||||
LaptopClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 );
|
LaptopClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 );
|
||||||
~LaptopClient(){;}
|
~LaptopClient(){;}
|
||||||
|
MousePosition mousePosition( const QPoint& ) const;
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* );
|
void resizeEvent( QResizeEvent* );
|
||||||
void paintEvent( QPaintEvent* );
|
void paintEvent( QPaintEvent* );
|
||||||
|
@ -48,7 +49,7 @@ protected slots:
|
||||||
private:
|
private:
|
||||||
SystemButton* button[5];
|
SystemButton* button[5];
|
||||||
QSpacerItem* titlebar;
|
QSpacerItem* titlebar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue