From a974abc657478ecffe16d985b122dbeb4b0e5e4b Mon Sep 17 00:00:00 2001 From: "Daniel M. Duley" Date: Fri, 28 Apr 2000 10:10:27 +0000 Subject: [PATCH] Fixes for when active colors != inactive colors && titlebutton colors != frame colors. svn path=/trunk/kdebase/kwin/; revision=47729 --- clients/system/systemclient.cpp | 30 ++++++++++++++++++++---------- clients/system/systemclient.h | 1 + 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/clients/system/systemclient.cpp b/clients/system/systemclient.cpp index 09cba6fa67..7ec3ebcc4d 100644 --- a/clients/system/systemclient.cpp +++ b/clients/system/systemclient.cpp @@ -52,7 +52,7 @@ static bool pixmaps_created = false; static void drawButtonFrame(KPixmap *pix, const QColorGroup &g) { - QPainter p(pix); + QPainter p; p.begin(pix); p.setPen(g.mid()); p.drawLine(0, 0, 13, 0); @@ -73,7 +73,6 @@ static void create_pixmaps() QPainter p; if(QPixmap::defaultDepth() > 8){ - warning("Creating pixmaps"); // titlebar aUpperGradient = new KPixmap; aUpperGradient->resize(32, 18); @@ -125,12 +124,12 @@ static void create_pixmaps() btnPix = new KPixmap; btnPix->resize(14, 14); bitBlt(btnPix, 2, 2, &aPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(btnPix, options->colorGroup(Options::ButtonBg, true)); + drawButtonFrame(btnPix, options->colorGroup(Options::Frame, true)); iBtnPix = new KPixmap; iBtnPix->resize(14, 14); bitBlt(iBtnPix, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(iBtnPix, options->colorGroup(Options::ButtonBg, false)); + drawButtonFrame(iBtnPix, options->colorGroup(Options::Frame, false)); // pressed buttons @@ -159,20 +158,19 @@ static void create_pixmaps() btnPixDown = new KPixmap; btnPixDown->resize(14, 14); bitBlt(btnPixDown, 2, 2, &aPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(btnPixDown, options->colorGroup(Options::ButtonBg, + drawButtonFrame(btnPixDown, options->colorGroup(Options::Frame, true)); iBtnPixDown = new KPixmap; iBtnPixDown->resize(14, 14); bitBlt(iBtnPixDown, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(iBtnPixDown, options->colorGroup(Options::ButtonBg, + drawButtonFrame(iBtnPixDown, options->colorGroup(Options::Frame, false)); } if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128) btnForeground = Qt::black; else btnForeground = Qt::white; - warning("Done creating pixmaps"); } @@ -194,7 +192,7 @@ QSize SystemButton::sizeHint() const void SystemButton::reset() { - repaint(); + repaint(false); } void SystemButton::setBitmap(const unsigned char *bitmap) @@ -213,9 +211,8 @@ void SystemButton::drawButton(QPainter *p) p->drawPixmap(0, 0, isDown() ? *iBtnPixDown : *iBtnPix); } else{ - QColorGroup g = options->colorGroup(Options::ButtonBg, + QColorGroup g = options->colorGroup(Options::Frame, client->isActive()); - p->fillRect(0, 0, width(), height(), g.background()); int x2 = width()-1; int y2 = height()-1; // outer frame @@ -228,6 +225,8 @@ void SystemButton::drawButton(QPainter *p) p->setPen(g.dark()); p->drawRect(1, 1, width()-2, height()-2); // inner frame + g = options->colorGroup(Options::ButtonBg, client->isActive()); + p->fillRect(3, 3, width()-6, height()-6, g.background()); p->setPen(isDown() ? g.mid() : g.light()); p->drawLine(2, 2, x2-2, 2); p->drawLine(2, 2, 2, y2-2); @@ -486,4 +485,15 @@ void SystemClient::init() // } +void SystemClient::activeChange(bool) +{ + repaint(false); + button[0]->reset(); + button[1]->reset(); + button[2]->reset(); + button[3]->reset(); + if(button[4]) + button[4]->reset(); +} + diff --git a/clients/system/systemclient.h b/clients/system/systemclient.h index d39e1508f8..4b3fc6277a 100644 --- a/clients/system/systemclient.h +++ b/clients/system/systemclient.h @@ -44,6 +44,7 @@ protected: void maximizeChange(bool m); void doShape(); void recalcTitleBuffer(); + void activeChange(bool); protected slots: void slotReset(); private: