- Follows stickyChange(bool) now - I should be shot for basing quartz on win2k

- Uses its own config file "kwinquartzrc" not to clutter kwinrc
- Fixed an unpainted area problem when windows are shaded

svn path=/trunk/kdebase/kwin/; revision=100337
icc-effect-5.14.5
Karol Szwed 2001-06-04 09:51:23 +00:00
parent e2b6a56386
commit ea93dcc2a4
4 changed files with 93 additions and 62 deletions

View File

@ -1,17 +1,18 @@
/* /*
This file contains the quartz configuration widget... * $Id$
*
Copyright (c) 2001 * This file contains the quartz configuration widget
Karol Szwed (gallium) <karlmail@usa.net> *
http://gallium.n3.net/ * Copyright (c) 2001
*/ * Karol Szwed <gallium@kde.org>
* http://gallium.n3.net/
*/
#include "config.h" #include "config.h"
#include <qwhatsthis.h> #include <qwhatsthis.h>
#include <klocale.h> #include <klocale.h>
// KWin client config plugin interface
extern "C" extern "C"
{ {
QObject* allocate_config( KConfig* conf, QWidget* parent ) QObject* allocate_config( KConfig* conf, QWidget* parent )
@ -21,22 +22,26 @@ extern "C"
} }
// NOTE: /* NOTE:
// 'conf' is a pointer to the kwindecoration modules open kwin config, * 'conf' is a pointer to the kwindecoration modules open kwin config,
// and is by default set to the "Style" group. * and is by default set to the "Style" group.
// *
// 'parent' is the parent of the QObject, which is a VBox inside the * 'parent' is the parent of the QObject, which is a VBox inside the
// Configure tab in kwindecoration * Configure tab in kwindecoration
*/
QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent ) QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent )
: QObject( parent ) : QObject( parent )
{ {
gb = new QGroupBox( 1, Qt::Horizontal, i18n("Quartz Decoration Settings"), parent ); quartzConfig = new KConfig("kwinquartzrc");
gb = new QGroupBox( 1, Qt::Horizontal,
cbColorBorder = new QCheckBox( i18n("Draw window frames using &titlebar colors"), gb ); i18n("Quartz Decoration Settings"), parent );
QWhatsThis::add( cbColorBorder, i18n("When selected, the window decoration borders " cbColorBorder = new QCheckBox(
"are drawn using the titlebar colors. Otherwise, they are " i18n("Draw window frames using &titlebar colors"), gb );
"drawn using normal border colors instead.") ); QWhatsThis::add( cbColorBorder,
i18n("When selected, the window decoration borders "
"are drawn using the titlebar colors. Otherwise, they are "
"drawn using normal border colors instead.") );
// Load configuration options // Load configuration options
load( conf ); load( conf );
@ -52,6 +57,7 @@ QuartzConfig::~QuartzConfig()
{ {
delete cbColorBorder; delete cbColorBorder;
delete gb; delete gb;
delete quartzConfig;
} }
@ -65,8 +71,8 @@ void QuartzConfig::slotSelectionChanged()
// It is passed the open config from kwindecoration to improve efficiency // It is passed the open config from kwindecoration to improve efficiency
void QuartzConfig::load( KConfig* conf ) void QuartzConfig::load( KConfig* conf )
{ {
conf->setGroup("Quartz"); quartzConfig->setGroup("General");
bool override = conf->readBoolEntry( "UseTitleBarBorderColors", true ); bool override = quartzConfig->readBoolEntry( "UseTitleBarBorderColors", true );
cbColorBorder->setChecked( override ); cbColorBorder->setChecked( override );
} }
@ -74,8 +80,10 @@ void QuartzConfig::load( KConfig* conf )
// Saves the configurable options to the kwinrc config file // Saves the configurable options to the kwinrc config file
void QuartzConfig::save( KConfig* conf ) void QuartzConfig::save( KConfig* conf )
{ {
conf->setGroup("Quartz"); quartzConfig->setGroup("General");
conf->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() ); quartzConfig->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
// Ensure others trying to read this config get updated
quartzConfig->sync();
} }
@ -86,5 +94,4 @@ void QuartzConfig::defaults()
} }
#include "config.moc" #include "config.moc"
// vim: ts=4 // vim: ts=4

View File

@ -1,10 +1,12 @@
/* /*
This file contains the quartz configuration widget... * $Id$
*
Copyright (c) 2001 * This file contains the quartz configuration widget
Karol Szwed (gallium) <karlmail@usa.net> *
http://gallium.n3.net/ * Copyright (c) 2001
*/ * Karol Szwed <gallium@kde.org>
* http://gallium.n3.net/
*/
#ifndef __KDE_QUARTZCONFIG_H #ifndef __KDE_QUARTZCONFIG_H
#define __KDE_QUARTZCONFIG_H #define __KDE_QUARTZCONFIG_H
@ -34,6 +36,7 @@ class QuartzConfig: public QObject
void slotSelectionChanged(); // Internal use void slotSelectionChanged(); // Internal use
private: private:
KConfig* quartzConfig;
QCheckBox* cbColorBorder; QCheckBox* cbColorBorder;
QGroupBox* gb; QGroupBox* gb;
}; };

View File

@ -1,17 +1,19 @@
// $Id$
/* /*
Gallium-Quartz KWin client * $Id$
*
Copyright 2001 * Gallium-Quartz KWin client
Karol Szwed <karlmail@usa.net> *
http://gallium.n3.net/ * Copyright 2001
* Karol Szwed <karlmail@usa.net>
Based upon the Win2K kwin client, which is based on the * http://gallium.n3.net/
KDE default client. *
* Based upon the Win2K kwin client, which is based on the
Includes mini titlebars for ToolWindow Support. * KDE default client.
Button positions are now customizable. *
*/ * Includes mini titlebars for ToolWindow Support.
* Button positions are now customizable.
*
*/
#include <kconfig.h> #include <kconfig.h>
#include <kglobal.h> #include <kglobal.h>
@ -129,9 +131,9 @@ void QuartzHandler::slotReset()
void QuartzHandler::readConfig() void QuartzHandler::readConfig()
{ {
KConfig* conf = KGlobal::config(); KConfig conf("kwinquartzrc");
conf->setGroup("Quartz"); conf.setGroup("General");
coloredFrame = conf->readBoolEntry( "UseTitleBarBorderColors", true ); coloredFrame = conf.readBoolEntry( "UseTitleBarBorderColors", true );
// A small hack to make the sticky button look nicer // A small hack to make the sticky button look nicer
stickyButtonOnLeft = (bool)options->titleButtonsLeft().contains( 'S' ); stickyButtonOnLeft = (bool)options->titleButtonsLeft().contains( 'S' );
@ -543,6 +545,16 @@ void QuartzClient::iconChange()
} }
void QuartzClient::stickyChange(bool on)
{
if (button[BtnSticky])
{
button[BtnSticky]->turnOn(on);
button[BtnSticky]->repaint(false);
}
}
void QuartzClient::slotMaximize() void QuartzClient::slotMaximize()
{ {
if ( button[BtnMax]->last_button == MidButton ) if ( button[BtnMax]->last_button == MidButton )
@ -639,6 +651,9 @@ void QuartzClient::paintEvent( QPaintEvent* )
p.setPen( g.background() ); p.setPen( g.background() );
p.drawRect( x+3, y + titleHeight + 3, w-6, h-titleHeight-6 ); p.drawRect( x+3, y + titleHeight + 3, w-6, h-titleHeight-6 );
// Drawing this extra line removes non-drawn areas when shaded
p.drawLine( x+4, y2-4, x2-4, y2-4);
// Highlight top corner // Highlight top corner
p.setPen( g.light().light(160) ); p.setPen( g.light().light(160) );
p.drawPoint( x, y ); p.drawPoint( x, y );

View File

@ -1,17 +1,19 @@
// $Id$
/* /*
Gallium-Quartz KWin client * $Id$
*
Copyright 2001 * Gallium-Quartz KWin client
Karol Szwed <karlmail@usa.net> *
http://gallium.n3.net/ * Copyright 2001
* Karol Szwed <karlmail@usa.net>
Based upon the Win2K kwin client, which is based on the * http://gallium.n3.net/
KDE default client. *
* Based upon the Win2K kwin client, which is based on the
Includes mini titlebars for ToolWindow Support. * KDE default client.
Button positions are now customizable. *
*/ * Includes mini titlebars for ToolWindow Support.
* Button positions are now customizable.
*
*/
#ifndef __KDEGALLIUM_QUARTZ_H #ifndef __KDEGALLIUM_QUARTZ_H
#define __KDEGALLIUM_QUARTZ_H #define __KDEGALLIUM_QUARTZ_H
@ -49,7 +51,8 @@ class QuartzButton : public QButton
{ {
public: public:
QuartzButton(Client *parent=0, const char *name=0, bool largeButton=true, QuartzButton(Client *parent=0, const char *name=0, bool largeButton=true,
bool isLeftButton=true, bool isStickyButton=false, const unsigned char *bitmap=NULL); bool isLeftButton=true, bool isStickyButton=false,
const unsigned char *bitmap=NULL);
~QuartzButton(); ~QuartzButton();
void setBitmap(const unsigned char *bitmap); void setBitmap(const unsigned char *bitmap);
QSize sizeHint() const; QSize sizeHint() const;
@ -75,7 +78,8 @@ class QuartzClient : public KWinInternal::Client
Q_OBJECT Q_OBJECT
public: public:
QuartzClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); QuartzClient( Workspace *ws, WId w, QWidget *parent=0,
const char *name=0 );
~QuartzClient() {;} ~QuartzClient() {;}
protected: protected:
@ -87,6 +91,7 @@ class QuartzClient : public KWinInternal::Client
void maximizeChange(bool m); void maximizeChange(bool m);
void activeChange(bool); void activeChange(bool);
void iconChange(); void iconChange();
void stickyChange(bool on);
protected slots: protected slots:
void slotMaximize(); void slotMaximize();
@ -96,7 +101,8 @@ class QuartzClient : public KWinInternal::Client
void calcHiddenButtons(); void calcHiddenButtons();
void addClientButtons( const QString& s, bool isLeft=true ); void addClientButtons( const QString& s, bool isLeft=true );
enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose, BtnMenu, BtnSticky, BtnCount }; enum Buttons{ BtnHelp=0, BtnMax, BtnIconify, BtnClose,
BtnMenu, BtnSticky, BtnCount };
QuartzButton* button[ QuartzClient::BtnCount ]; QuartzButton* button[ QuartzClient::BtnCount ];
int lastButtonWidth; int lastButtonWidth;
int titleHeight; int titleHeight;