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

View File

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

View File

@ -1,17 +1,19 @@
// $Id$
/*
Gallium-Quartz KWin client
Copyright 2001
Karol Szwed <karlmail@usa.net>
http://gallium.n3.net/
Based upon the Win2K kwin client, which is based on the
KDE default client.
Includes mini titlebars for ToolWindow Support.
Button positions are now customizable.
*/
* $Id$
*
* Gallium-Quartz KWin client
*
* Copyright 2001
* Karol Szwed <karlmail@usa.net>
* http://gallium.n3.net/
*
* Based upon the Win2K kwin client, which is based on the
* KDE default client.
*
* Includes mini titlebars for ToolWindow Support.
* Button positions are now customizable.
*
*/
#include <kconfig.h>
#include <kglobal.h>
@ -129,9 +131,9 @@ void QuartzHandler::slotReset()
void QuartzHandler::readConfig()
{
KConfig* conf = KGlobal::config();
conf->setGroup("Quartz");
coloredFrame = conf->readBoolEntry( "UseTitleBarBorderColors", true );
KConfig conf("kwinquartzrc");
conf.setGroup("General");
coloredFrame = conf.readBoolEntry( "UseTitleBarBorderColors", true );
// A small hack to make the sticky button look nicer
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()
{
if ( button[BtnMax]->last_button == MidButton )
@ -639,6 +651,9 @@ void QuartzClient::paintEvent( QPaintEvent* )
p.setPen( g.background() );
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
p.setPen( g.light().light(160) );
p.drawPoint( x, y );

View File

@ -1,17 +1,19 @@
// $Id$
/*
Gallium-Quartz KWin client
Copyright 2001
Karol Szwed <karlmail@usa.net>
http://gallium.n3.net/
Based upon the Win2K kwin client, which is based on the
KDE default client.
Includes mini titlebars for ToolWindow Support.
Button positions are now customizable.
*/
* $Id$
*
* Gallium-Quartz KWin client
*
* Copyright 2001
* Karol Szwed <karlmail@usa.net>
* http://gallium.n3.net/
*
* Based upon the Win2K kwin client, which is based on the
* KDE default client.
*
* Includes mini titlebars for ToolWindow Support.
* Button positions are now customizable.
*
*/
#ifndef __KDEGALLIUM_QUARTZ_H
#define __KDEGALLIUM_QUARTZ_H
@ -49,7 +51,8 @@ class QuartzButton : public QButton
{
public:
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();
void setBitmap(const unsigned char *bitmap);
QSize sizeHint() const;
@ -75,7 +78,8 @@ class QuartzClient : public KWinInternal::Client
Q_OBJECT
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() {;}
protected:
@ -87,6 +91,7 @@ class QuartzClient : public KWinInternal::Client
void maximizeChange(bool m);
void activeChange(bool);
void iconChange();
void stickyChange(bool on);
protected slots:
void slotMaximize();
@ -96,7 +101,8 @@ class QuartzClient : public KWinInternal::Client
void calcHiddenButtons();
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 ];
int lastButtonWidth;
int titleHeight;