Importing the Keramik KWin style.
svn path=/trunk/kdebase/kwin/; revision=156002
32
clients/keramik/Makefile.am
Normal file
|
@ -0,0 +1,32 @@
|
|||
INCLUDES = $(all_includes) -I$(kde_includes)/kwin
|
||||
|
||||
SUBDIRS = . config
|
||||
|
||||
KDE_CXXFLAGS = -UQT_NO_ASCII_CAST
|
||||
|
||||
kde_module_LTLIBRARIES = kwin_keramik.la
|
||||
|
||||
kwin_keramik_la_SOURCES = keramik.cpp
|
||||
kwin_keramik_la_LIBADD = ../../kwin.la
|
||||
kwin_keramik_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
|
||||
|
||||
METASOURCES = AUTO
|
||||
noinst_headers = keramik.h tiles.h
|
||||
|
||||
lnkdir = $(kde_datadir)/kwin
|
||||
lnk_DATA = keramik.desktop
|
||||
|
||||
EXTRA_DIST = $(lnk_DATA)
|
||||
|
||||
QEMBED = $(QTDIR)/tools/qembed/qembed
|
||||
|
||||
keramik.cpp: tiles.h
|
||||
|
||||
PICS := $(shell ls $(srcdir)/pics/*.png 2>/dev/null)
|
||||
|
||||
.PHONY: make-embed
|
||||
|
||||
make-embed: $(PICS)
|
||||
$(QEMBED) --images $^ | \
|
||||
sed -e 's,static QDict<QImage> dict;,,' | \
|
||||
sed -e 's,dict\.find,imageDict.find,' > $(srcdir)/tiles.h
|
19
clients/keramik/config/Makefile.am
Normal file
|
@ -0,0 +1,19 @@
|
|||
INCLUDES = $(all_includes)
|
||||
|
||||
kde_module_LTLIBRARIES = kwin_keramik_config.la
|
||||
|
||||
kwin_keramik_config_la_SOURCES = config.cpp keramikconfig.ui
|
||||
kwin_keramik_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
|
||||
kwin_keramik_config_la_LIBADD = $(LIB_KDEUI)
|
||||
|
||||
METASOURCES = AUTO
|
||||
noinst_HEADERS = config.h keramikconfig.h
|
||||
|
||||
lnkdir = $(kde_datadir)/kwin
|
||||
|
||||
messages:
|
||||
$(XGETTEXT) *.cpp -o $(podir)/kwin_keramik_config.pot
|
||||
|
||||
###KMAKE-start (don't edit or delete this block)
|
||||
|
||||
###KMAKE-end
|
107
clients/keramik/config/config.cpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Keramik KWin client configuration module
|
||||
*
|
||||
* Copyright (C) 2002 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* Based on the Quartz configuration module,
|
||||
* Copyright (c) 2001 Karol Szwed <gallium@kde.org>
|
||||
*
|
||||
* 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 <kglobal.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include <qcheckbox.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "config.moc"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
QObject* allocate_config( KConfig* conf, QWidget* parent )
|
||||
{
|
||||
return ( new KeramikConfig( conf, parent ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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
|
||||
*/
|
||||
|
||||
KeramikConfig::KeramikConfig( KConfig* conf, QWidget* parent )
|
||||
: QObject( parent )
|
||||
{
|
||||
KGlobal::locale()->insertCatalogue("kwin_keramik_config");
|
||||
c = new KConfig( "kwinkeramikrc" );
|
||||
|
||||
ui = new KeramikConfigUI( parent );
|
||||
connect( ui->showAppIcons, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( ui->smallCaptions, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( ui->useShadowedText, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
|
||||
load( conf );
|
||||
ui->show();
|
||||
}
|
||||
|
||||
|
||||
KeramikConfig::~KeramikConfig()
|
||||
{
|
||||
delete ui;
|
||||
delete c;
|
||||
}
|
||||
|
||||
|
||||
// Loads the configurable options from the kwinrc config file
|
||||
// It is passed the open config from kwindecoration to improve efficiency
|
||||
void KeramikConfig::load( KConfig* )
|
||||
{
|
||||
c->setGroup("General");
|
||||
ui->showAppIcons->setChecked( c->readBoolEntry("ShowAppIcons", true) );
|
||||
ui->smallCaptions->setChecked( c->readBoolEntry("SmallCaptionBubbles", false) );
|
||||
ui->useShadowedText->setChecked( c->readBoolEntry("UseShadowedText", true) );
|
||||
}
|
||||
|
||||
|
||||
// Saves the configurable options to the kwinrc config file
|
||||
void KeramikConfig::save( KConfig* )
|
||||
{
|
||||
c->setGroup( "General" );
|
||||
c->writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() );
|
||||
c->writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() );
|
||||
c->writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() );
|
||||
c->sync();
|
||||
}
|
||||
|
||||
|
||||
// Sets UI widget defaults which must correspond to style defaults
|
||||
void KeramikConfig::defaults()
|
||||
{
|
||||
ui->showAppIcons->setChecked( true );
|
||||
ui->smallCaptions->setChecked( false );
|
||||
ui->useShadowedText->setChecked( true );
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
||||
// vim: set noet ts=4 sw=4:
|
59
clients/keramik/config/config.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Keramik KWin client configuration module
|
||||
*
|
||||
* Copyright (C) 2002 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* Based on the Quartz configuration module,
|
||||
* Copyright (c) 2001 Karol Szwed <gallium@kde.org>
|
||||
*
|
||||
* 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 __KWIN_KERAMIK_CONFIG_H
|
||||
#define __KWIN_KERAMIK_CONFIG_H
|
||||
|
||||
#include <kconfig.h>
|
||||
|
||||
#include "keramikconfig.h"
|
||||
|
||||
class KeramikConfig: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KeramikConfig( KConfig* conf, QWidget* parent );
|
||||
~KeramikConfig();
|
||||
|
||||
// These public signals/slots work similar to KCM modules
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
public slots:
|
||||
void load( KConfig* conf );
|
||||
void save( KConfig* conf );
|
||||
void defaults();
|
||||
|
||||
private:
|
||||
KeramikConfigUI *ui;
|
||||
KConfig *c;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// vim: set noet ts=4 sw=4:
|
99
clients/keramik/config/keramikconfig.ui
Normal file
|
@ -0,0 +1,99 @@
|
|||
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
|
||||
<class>KeramikConfigUI</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>KeramikConfigUI</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>470</width>
|
||||
<height>333</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Keramik</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>decorationBox</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Decoration Settings</string>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>Layout4</cstring>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>showAppIcons</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display the window &icon in the caption bubble</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Check this option if you want the window icon to be displayed in the caption bubble next to the titlebar text.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>smallCaptions</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Draw &small caption bubbles on active windows</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Check this option if you want the caption bubble to have the same size on active windows that it has on inactive ones. This option is useful for laptops or low resolution displays where you want maximize the amount of space available to the window contents.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>useShadowedText</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use shadowed &text</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Check this option if you want the titlebar text to have a 3D look with a shadow behind it.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
3
clients/keramik/configure.in.in
Normal file
|
@ -0,0 +1,3 @@
|
|||
dnl Check for the X shaped windows extension
|
||||
AC_CHECK_HEADERS(X11/extensions/shape.h)
|
||||
|
1227
clients/keramik/keramik.cpp
Normal file
4
clients/keramik/keramik.desktop
Normal file
|
@ -0,0 +1,4 @@
|
|||
[Desktop Entry]
|
||||
Name=Keramik
|
||||
X-KDE-Library=kwin_keramik
|
||||
|
177
clients/keramik/keramik.h
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Keramik KWin client (version 0.6)
|
||||
*
|
||||
* Copyright (C) 2002 Fredrik Höglund <fredrik@kde.org>
|
||||
*
|
||||
* 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 __KERAMIK_H
|
||||
#define __KERAMIK_H
|
||||
|
||||
#include <qdict.h>
|
||||
|
||||
#include "../../client.h"
|
||||
#include "../../kwinbutton.h"
|
||||
|
||||
static QDict< QImage > imageDict;
|
||||
|
||||
#include "tiles.h"
|
||||
|
||||
|
||||
class QSpacerItem;
|
||||
|
||||
namespace KWinInternal {
|
||||
|
||||
enum TilePixmap { TitleLeft=0, TitleCenter, TitleRight,
|
||||
CaptionLeft, CaptionCenter, CaptionRight, GrabBarLeft,
|
||||
BorderLeft, BorderRight, GrabBarCenter, GrabBarRight,
|
||||
NumTiles };
|
||||
|
||||
enum Button { MenuButton=0, StickyButton, HelpButton, MinButton,
|
||||
MaxButton, CloseButton, NumButtons };
|
||||
|
||||
enum ButtonDeco { Menu=0, Sticky, Unsticky, Help, Iconify, Maximize,
|
||||
Restore, Close, NumButtonDecos };
|
||||
|
||||
struct SettingsCache
|
||||
{
|
||||
QColor titleColor;
|
||||
QColor buttonColor;
|
||||
QString buttonsLeft;
|
||||
QString buttonsRight;
|
||||
bool smallCaptionBubbles:1;
|
||||
};
|
||||
|
||||
class KeramikHandler : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KeramikHandler();
|
||||
~KeramikHandler();
|
||||
|
||||
void reset();
|
||||
|
||||
bool showAppIcons() const { return showIcons; }
|
||||
bool useShadowedText() const { return shadowedText; }
|
||||
int titleBarHeight() const { return activeTiles[CaptionCenter]->height(); }
|
||||
int titleBarBaseHeight() const { return activeTiles[TitleCenter]->height(); }
|
||||
|
||||
const QPixmap *roundButton() const { return titleButtonRound; }
|
||||
const QPixmap *squareButton() const { return titleButtonSquare; }
|
||||
const QBitmap *buttonDeco( ButtonDeco deco ) const
|
||||
{ return buttonDecos[ deco ]; }
|
||||
|
||||
inline const QPixmap *tile( TilePixmap tilePix, bool active ) const;
|
||||
|
||||
signals:
|
||||
void softReset();
|
||||
|
||||
private:
|
||||
void readConfig();
|
||||
void createPixmaps();
|
||||
void destroyPixmaps();
|
||||
|
||||
void flip( QPixmap *&, QPixmap *& );
|
||||
void flip( QPixmap *& );
|
||||
void recolor( QImage &, const QColor & );
|
||||
QPixmap *loadPixmap( const QString &, const QColor & );
|
||||
|
||||
private:
|
||||
bool showIcons, shadowedText, smallCaptionBubbles;
|
||||
SettingsCache *settings_cache;
|
||||
|
||||
QPixmap *activeTiles[ NumTiles ];
|
||||
QPixmap *inactiveTiles[ NumTiles ];
|
||||
QBitmap *buttonDecos[ NumButtonDecos ];
|
||||
|
||||
QPixmap *titleButtonRound, *titleButtonSquare;
|
||||
|
||||
}; // class KeramikHandler
|
||||
|
||||
|
||||
class KeramikButton : public KWinInternal::KWinButton
|
||||
{
|
||||
public:
|
||||
KeramikButton( Client *, const char *, Button, const QString & );
|
||||
~KeramikButton();
|
||||
|
||||
int lastButton() const { return lastbutton; }
|
||||
|
||||
private:
|
||||
void enterEvent( QEvent * );
|
||||
void leaveEvent( QEvent * );
|
||||
void mousePressEvent( QMouseEvent * );
|
||||
void mouseReleaseEvent( QMouseEvent * );
|
||||
void drawButton( QPainter * );
|
||||
|
||||
private:
|
||||
Client *client;
|
||||
Button button;
|
||||
bool hover;
|
||||
int lastbutton;
|
||||
}; // class KeramikButton
|
||||
|
||||
|
||||
class KeramikClient : public KWinInternal::Client
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
KeramikClient( Workspace *, WId, QWidget *parent = 0L, const char *name = 0L );
|
||||
~KeramikClient();
|
||||
|
||||
private:
|
||||
void addButtons( QHBoxLayout*, const QString & );
|
||||
void updateMask();
|
||||
void updateCaptionBuffer();
|
||||
void captionChange( const QString& );
|
||||
void iconChange();
|
||||
void activeChange( bool );
|
||||
void maximizeChange( bool );
|
||||
void stickyChange( bool );
|
||||
void resizeEvent( QResizeEvent *);
|
||||
void paintEvent( QPaintEvent *);
|
||||
void mouseDoubleClickEvent( QMouseEvent * );
|
||||
MousePosition mousePosition( const QPoint & ) const;
|
||||
|
||||
void calculateCaptionRect();
|
||||
|
||||
private slots:
|
||||
void menuButtonPressed();
|
||||
void slotMaximize();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
QSpacerItem *titlebar;
|
||||
KeramikButton *button[ NumButtons ];
|
||||
QRect captionRect;
|
||||
QPixmap captionBuffer;
|
||||
QPixmap *activeIcon, *inactiveIcon;
|
||||
bool captionBufferDirty, maskDirty;
|
||||
|
||||
}; // class KeramikClient
|
||||
|
||||
} // namespace KWinInternal
|
||||
|
||||
#endif // ___KERAMIK_H
|
||||
|
||||
// vim: set noet ts=4 sw=4:
|
BIN
clients/keramik/pics/border-active-left.png
Normal file
After Width: | Height: | Size: 157 B |
BIN
clients/keramik/pics/border-active-right.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
clients/keramik/pics/border-inactive-left.png
Normal file
After Width: | Height: | Size: 157 B |
BIN
clients/keramik/pics/border-inactive-right.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
clients/keramik/pics/caption-active-large-center.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
clients/keramik/pics/caption-active-large-left.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
clients/keramik/pics/caption-active-large-right.png
Normal file
After Width: | Height: | Size: 949 B |
BIN
clients/keramik/pics/caption-active-small-center.png
Normal file
After Width: | Height: | Size: 300 B |
BIN
clients/keramik/pics/caption-active-small-left.png
Normal file
After Width: | Height: | Size: 724 B |
BIN
clients/keramik/pics/caption-active-small-right.png
Normal file
After Width: | Height: | Size: 854 B |
BIN
clients/keramik/pics/caption-inactive-center.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
clients/keramik/pics/caption-inactive-left.png
Normal file
After Width: | Height: | Size: 656 B |
BIN
clients/keramik/pics/caption-inactive-right.png
Normal file
After Width: | Height: | Size: 814 B |
BIN
clients/keramik/pics/grabbar-active-center.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
clients/keramik/pics/grabbar-active-left.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
clients/keramik/pics/grabbar-active-right.png
Normal file
After Width: | Height: | Size: 284 B |
BIN
clients/keramik/pics/grabbar-inactive-center.png
Normal file
After Width: | Height: | Size: 192 B |
BIN
clients/keramik/pics/grabbar-inactive-left.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
clients/keramik/pics/grabbar-inactive-right.png
Normal file
After Width: | Height: | Size: 286 B |
BIN
clients/keramik/pics/titlebar-active-center.png
Normal file
After Width: | Height: | Size: 295 B |
BIN
clients/keramik/pics/titlebar-active-left.png
Normal file
After Width: | Height: | Size: 706 B |
BIN
clients/keramik/pics/titlebar-active-right.png
Normal file
After Width: | Height: | Size: 760 B |
BIN
clients/keramik/pics/titlebar-inactive-center.png
Normal file
After Width: | Height: | Size: 295 B |
BIN
clients/keramik/pics/titlebar-inactive-left.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
clients/keramik/pics/titlebar-inactive-right.png
Normal file
After Width: | Height: | Size: 656 B |
BIN
clients/keramik/pics/titlebutton-round.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
clients/keramik/pics/titlebutton-square.png
Normal file
After Width: | Height: | Size: 1.1 KiB |