diff --git a/clients/riscos/Button.cpp b/clients/riscos/Button.cpp index 5daa5bd110..f4beb60c41 100644 --- a/clients/riscos/Button.cpp +++ b/clients/riscos/Button.cpp @@ -33,7 +33,7 @@ namespace RiscOS { Button::Button(QWidget * parent, Manager * client, SymbolType t) - : QWidget (parent, "Button"), + : QWidget (parent, "Button", WRepaintNoErase | WPaintUnclipped), client_ (client), type_ (t), align_ (Left), @@ -51,6 +51,7 @@ Button::~Button() Button::updateDisplay() { setBackgroundPixmap(Static::instance()->button(type_, client_->isActive(), down_)); + repaint(true); } } // End namespace diff --git a/clients/riscos/Makefile.am b/clients/riscos/Makefile.am index 5e88845559..3ff7bc6a8f 100644 --- a/clients/riscos/Makefile.am +++ b/clients/riscos/Makefile.am @@ -1,5 +1,3 @@ -KDE_CXXFLAGS = -O0 -g3 -W -Wall - INCLUDES = $(all_includes) lib_LTLIBRARIES = libkwinriscos.la @@ -17,7 +15,6 @@ ResizeMid.cpp \ ResizeSide.cpp \ TitleBar.cpp \ TitleText.cpp \ -Utils.cpp \ Static.cpp METASOURCES = AUTO @@ -34,7 +31,6 @@ ResizeMid.h \ ResizeSide.h \ TitleBar.h \ TitleText.h \ -Utils.h \ Static.h lnkdir = $(kde_datadir)/kwin/ @@ -42,6 +38,5 @@ lnk_DATA = riscos.desktop EXTRA_DIST = $(lnk_DATA) -libkwinriscos_la_LIBADD = ../../kwin.la -lqt -lX11 -libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic -no-undefined +libkwinriscos_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module -rdynamic diff --git a/clients/riscos/Manager.cpp b/clients/riscos/Manager.cpp index 2d51e3e232..99e9d49711 100644 --- a/clients/riscos/Manager.cpp +++ b/clients/riscos/Manager.cpp @@ -48,9 +48,9 @@ Manager::Manager( QWidget * parent, const char * name ) - : Client(workSpace, id, parent, name, WResizeNoErase | WRepaintNoErase | WPaintUnclipped) + : Client(workSpace, id, parent, name) { - Static::instance()->update(); + Static::instance(); setBackgroundMode(NoBackground); @@ -59,24 +59,21 @@ Manager::Manager( titleBar_ = new TitleBar(this, this); resizeBar_ = new ResizeBar(this, this); - // Layout - - // Border - // Window - // Border + // Border Window Border QHBoxLayout * windowLayout = new QHBoxLayout(0, "windowLayout"); windowLayout->addSpacing(1); windowLayout->addWidget(windowWrapper(), 1); windowLayout->addSpacing(1); - // Border - // Titlebar - // Window layout - // Resize bar + // Titlebar (has own single pixel border) + // Window + // Resize bar (has own single pixel border) QVBoxLayout * mainLayout = new QVBoxLayout(this, 0, 0, "mainLayout"); mainLayout->addWidget(titleBar_); mainLayout->addLayout(windowLayout, 1); mainLayout->addWidget(resizeBar_); + + updateDisplay(); } Manager::~Manager() diff --git a/clients/riscos/MaximiseButton.cpp b/clients/riscos/MaximiseButton.cpp index 1c46d33781..ff29ed37fc 100644 --- a/clients/riscos/MaximiseButton.cpp +++ b/clients/riscos/MaximiseButton.cpp @@ -35,10 +35,8 @@ MaximiseButton::MaximiseButton(QWidget * parent, Manager * client) void MaximiseButton::setOn(bool on) { - if (on) - setType(Unmax); - else - setType(Max); + setType(on ? Unmax: Max); + updateDisplay(); } void diff --git a/clients/riscos/ResizeLeft.cpp b/clients/riscos/ResizeLeft.cpp index 3d0fe82b79..7b1a4b3278 100644 --- a/clients/riscos/ResizeLeft.cpp +++ b/clients/riscos/ResizeLeft.cpp @@ -25,13 +25,12 @@ #include "ResizeSide.h" #include "Manager.h" #include "Static.h" -#include "Utils.h" namespace RiscOS { ResizeSide::ResizeSide(QWidget * parent, Manager * client, Side s) - : QWidget (parent, "ResizeSide"), + : QWidget (parent, "ResizeSide", WRepaintNoErase | WPaintUnclipped) client_ (client), side_ (s) { diff --git a/clients/riscos/ResizeMid.cpp b/clients/riscos/ResizeMid.cpp index 8f614d0546..5429c94710 100644 --- a/clients/riscos/ResizeMid.cpp +++ b/clients/riscos/ResizeMid.cpp @@ -25,7 +25,6 @@ #include "ResizeMid.h" #include "Manager.h" #include "Static.h" -#include "Utils.h" namespace RiscOS { diff --git a/clients/riscos/ResizeRight.cpp b/clients/riscos/ResizeRight.cpp index c9b29488f0..f9e3cac6e7 100644 --- a/clients/riscos/ResizeRight.cpp +++ b/clients/riscos/ResizeRight.cpp @@ -25,7 +25,6 @@ #include "ResizeRight.h" #include "Manager.h" #include "Static.h" -#include "Utils.h" namespace RiscOS { diff --git a/clients/riscos/ResizeSide.cpp b/clients/riscos/ResizeSide.cpp index 9f6e0c6c5a..f06e4d7a02 100644 --- a/clients/riscos/ResizeSide.cpp +++ b/clients/riscos/ResizeSide.cpp @@ -25,7 +25,6 @@ #include "ResizeSide.h" #include "Manager.h" #include "Static.h" -#include "Utils.h" namespace RiscOS { diff --git a/clients/riscos/Static.cpp b/clients/riscos/Static.cpp index 97083fb15d..8874f1a311 100644 --- a/clients/riscos/Static.cpp +++ b/clients/riscos/Static.cpp @@ -27,7 +27,6 @@ #include "../../options.h" #include "Static.h" -#include "Utils.h" namespace RiscOS { @@ -99,35 +98,6 @@ Static::_drawBorder(QPixmap & pix, int w, int h) painter_.end(); } - QPixmap -recolour(const QImage & inputImage, const Palette & newPalette) -{ - QImage image(inputImage); - Palette & standard = Static::instance()->standardPalette(); - - int ncols = image.numColors(); - - QRgb r; - - for (int i = 0; i < ncols; i++) { - - r = image.color(i); - - for (int c = 0; c < 8; c++) { - - if (r == standard[c]) - { - image.setColor(i, newPalette[c]); - continue; - } - } - } - - QPixmap output; - output.convertFromImage(image); - return output; -} - void Static::_drawCloseSymbol(QPixmap & pixmap) { @@ -191,7 +161,7 @@ Static::_drawLowerSymbol(QPixmap & pixmap) painter_.translate(transx, transy); painter_.fillRect(1, 1, 6, 6, QColor(palette_[6])); - painter_.fillRect(5, 5, 6, 6, QColor(palette_[6])); + painter_.fillRect(5, 5, 6, 6, QColor(palette_[3])); painter_.setPen(QColor(palette_[1])); painter_.drawRect(0, 0, 8, 8); @@ -247,7 +217,7 @@ Static::_drawUnmaxSymbol(QPixmap & pixmap) painter_.translate(transx, transy); painter_.setPen(QColor(palette_[1])); - painter_.drawRect(0, 0, 11, 11); + painter_.drawRect(0, 0, 12, 12); painter_.setPen(QColor(palette_[3])); painter_.drawPoint(0, 0); @@ -263,10 +233,17 @@ Static::_drawUnmaxSymbol(QPixmap & pixmap) void setPalette(Palette & pal, QColor c) { + pal[3] = c.rgb(); + + int h, s, v; + c.hsv(&h, &s, &v); + + if (v < 72) + c.setHsv(h, s, 72); + pal[0] = c.light(200).rgb(); pal[1] = c.light(166).rgb(); pal[2] = c.light(125).rgb(); - pal[3] = c.rgb(); pal[4] = c.dark(133).rgb(); pal[5] = c.dark(166).rgb(); pal[6] = c.dark(200).rgb(); @@ -276,10 +253,17 @@ setPalette(Palette & pal, QColor c) void setInversePalette(Palette & pal, QColor c) { + pal[4] = c.rgb(); + + int h, s, v; + c.hsv(&h, &s, &v); + + if (v < 72) + c.setHsv(h, s, 72); + pal[7] = c.light(200).rgb(); pal[6] = c.light(166).rgb(); pal[5] = c.light(125).rgb(); - pal[4] = c.rgb(); pal[3] = c.dark(133).rgb(); pal[2] = c.dark(166).rgb(); pal[1] = c.dark(200).rgb(); @@ -326,34 +310,51 @@ Static::_init() aResize_.fill(Qt::black); iResize_.fill(Qt::black); - aTitleTextLeft_.resize(3, 20); - aTitleTextRight_.resize(3, 20); - aTitleTextLeft_.fill(Qt::black); - aTitleTextRight_.fill(Qt::black); - - iTitleTextLeft_.resize(3, 20); - iTitleTextRight_.resize(3, 20); - iTitleTextLeft_.fill(Qt::black); - iTitleTextRight_.fill(Qt::black); - - aTitleTextMid_.resize(128, 20); - iTitleTextMid_.resize(128, 20); - aTitleTextMid_.fill(Qt::black); - iTitleTextMid_.fill(Qt::black); - - aResizeMidLeft_.resize(3, 12); - aResizeMidRight_.resize(3, 12); - aResizeMidLeft_.fill(Qt::black); - aResizeMidRight_.fill(Qt::black); - iResizeMidLeft_.resize(3, 12); - iResizeMidRight_.resize(3, 12); - iResizeMidLeft_.fill(Qt::black); - iResizeMidRight_.fill(Qt::black); + aTitleTextLeft_ .setOptimization(QPixmap::BestOptim); + aTitleTextRight_ .setOptimization(QPixmap::BestOptim); + aTitleTextMid_ .setOptimization(QPixmap::BestOptim); - aResizeMid_.resize(128, 10); - iResizeMid_.resize(128, 10); - aResizeMid_.fill(Qt::black); - iResizeMid_.fill(Qt::black); + iTitleTextLeft_ .setOptimization(QPixmap::BestOptim); + iTitleTextRight_ .setOptimization(QPixmap::BestOptim); + iTitleTextMid_ .setOptimization(QPixmap::BestOptim); + + aResizeMidLeft_ .setOptimization(QPixmap::BestOptim); + aResizeMidRight_ .setOptimization(QPixmap::BestOptim); + aResizeMid_ .setOptimization(QPixmap::BestOptim); + + iResizeMidLeft_ .setOptimization(QPixmap::BestOptim); + iResizeMidRight_ .setOptimization(QPixmap::BestOptim); + iResizeMid_ .setOptimization(QPixmap::BestOptim); + + aTitleTextLeft_ .resize(3, 20); + aTitleTextRight_ .resize(3, 20); + aTitleTextLeft_ .fill(Qt::black); + aTitleTextRight_ .fill(Qt::black); + + iTitleTextLeft_ .resize(3, 20); + iTitleTextRight_ .resize(3, 20); + iTitleTextLeft_ .fill(Qt::black); + iTitleTextRight_ .fill(Qt::black); + + aTitleTextMid_ .resize(128, 20); + iTitleTextMid_ .resize(128, 20); + aTitleTextMid_ .fill(Qt::black); + iTitleTextMid_ .fill(Qt::black); + + aResizeMidLeft_ .resize(3, 12); + aResizeMidRight_ .resize(3, 12); + aResizeMidLeft_ .fill(Qt::black); + aResizeMidRight_ .fill(Qt::black); + + iResizeMidLeft_ .resize(3, 12); + iResizeMidRight_ .resize(3, 12); + iResizeMidLeft_ .fill(Qt::black); + iResizeMidRight_ .fill(Qt::black); + + aResizeMid_ .resize(128, 10); + iResizeMid_ .resize(128, 10); + aResizeMid_ .fill(Qt::black); + iResizeMid_ .fill(Qt::black); update(); } diff --git a/clients/riscos/Static.h b/clients/riscos/Static.h index d5c4081804..1078b6bd9b 100644 --- a/clients/riscos/Static.h +++ b/clients/riscos/Static.h @@ -88,14 +88,15 @@ class Static private: - void _drawButtonBorder(QPixmap &); - void _drawBorder(QPixmap &, int w, int h); + void _drawButtonBorder (QPixmap &); + void _drawBorder (QPixmap &, int, int); + void _drawCloseSymbol (QPixmap &); + void _drawIconifySymbol(QPixmap &); + void _drawLowerSymbol (QPixmap &); + void _drawMaxSymbol (QPixmap &); + void _drawUnmaxSymbol (QPixmap &); + void _init(); - void _drawCloseSymbol(QPixmap & pixmap); - void _drawIconifySymbol(QPixmap & pixmap); - void _drawLowerSymbol(QPixmap & pixmap); - void _drawMaxSymbol(QPixmap & pixmap); - void _drawUnmaxSymbol(QPixmap & pixmap); static Static * instance_; @@ -125,5 +126,5 @@ class Static } // End namespace #endif - + // vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/TitleText.cpp b/clients/riscos/TitleText.cpp index 83e59d9202..45cecc18ec 100644 --- a/clients/riscos/TitleText.cpp +++ b/clients/riscos/TitleText.cpp @@ -28,7 +28,6 @@ #include "TitleText.h" #include "Manager.h" #include "Static.h" -#include "Utils.h" namespace RiscOS { @@ -38,7 +37,6 @@ TitleText::TitleText(QWidget * parent, Manager * client) client_(client) { setFixedHeight(20); - updatePixmap(); } TitleText::~TitleText() diff --git a/clients/riscos/Utils.cpp b/clients/riscos/Utils.cpp deleted file mode 100644 index 781a7ba7ca..0000000000 --- a/clients/riscos/Utils.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - RISC OS KWin client - - Copyright 2000 - Rik Hemsley - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include -#include - -#include "../../options.h" - -#include "Utils.h" -#include "Static.h" - -namespace RiscOS -{ - -} // End namespace - -// vim:ts=2:sw=2:tw=78 diff --git a/clients/riscos/Utils.h b/clients/riscos/Utils.h deleted file mode 100644 index 59a36f474e..0000000000 --- a/clients/riscos/Utils.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - RISC OS KWin client - - Copyright 2000 - Rik Hemsley - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef RISC_OS_UTILS_H -#define RISC_OS_UTILS_H - -#include -#include - -#include "Palette.h" - -namespace RiscOS { - -void drawBorder( - QPixmap & pix, - int x, int y, - int w, int h, - const Palette & pal, - bool down = false -); - -QPixmap recolour(const QImage &, const Palette &); - -} // End namespace - -#endif - -// vim:ts=2:sw=2:tw=78