diff --git a/clients/quartz/config/config.cpp b/clients/quartz/config/config.cpp index ee4c1d47c8..c6be58bc94 100644 --- a/clients/quartz/config/config.cpp +++ b/clients/quartz/config/config.cpp @@ -1,17 +1,18 @@ /* - This file contains the quartz configuration widget... - - Copyright (c) 2001 - Karol Szwed (gallium) - http://gallium.n3.net/ -*/ + * $Id$ + * + * This file contains the quartz configuration widget + * + * Copyright (c) 2001 + * Karol Szwed + * http://gallium.n3.net/ + */ #include "config.h" #include #include -// 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 diff --git a/clients/quartz/config/config.h b/clients/quartz/config/config.h index 8ea2eccdd9..93064fa018 100644 --- a/clients/quartz/config/config.h +++ b/clients/quartz/config/config.h @@ -1,10 +1,12 @@ /* - This file contains the quartz configuration widget... - - Copyright (c) 2001 - Karol Szwed (gallium) - http://gallium.n3.net/ -*/ + * $Id$ + * + * This file contains the quartz configuration widget + * + * Copyright (c) 2001 + * Karol Szwed + * 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; }; diff --git a/clients/quartz/quartz.cpp b/clients/quartz/quartz.cpp index e80ad0d7fc..6a78b20cdd 100644 --- a/clients/quartz/quartz.cpp +++ b/clients/quartz/quartz.cpp @@ -1,17 +1,19 @@ -// $Id$ /* - Gallium-Quartz KWin client - - Copyright 2001 - Karol Szwed - 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 + * 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 #include @@ -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 ); diff --git a/clients/quartz/quartz.h b/clients/quartz/quartz.h index 5e14790298..3b746fb12a 100644 --- a/clients/quartz/quartz.h +++ b/clients/quartz/quartz.h @@ -1,17 +1,19 @@ -// $Id$ /* - Gallium-Quartz KWin client - - Copyright 2001 - Karol Szwed - 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 + * 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;