summaryrefslogtreecommitdiffstats
path: root/kwin/clients/web
diff options
context:
space:
mode:
Diffstat (limited to 'kwin/clients/web')
-rw-r--r--kwin/clients/web/Makefile.am15
-rw-r--r--kwin/clients/web/Web.cpp385
-rw-r--r--kwin/clients/web/Web.h87
-rw-r--r--kwin/clients/web/WebButton.cpp287
-rw-r--r--kwin/clients/web/WebButton.h70
-rw-r--r--kwin/clients/web/web.desktop47
6 files changed, 891 insertions, 0 deletions
diff --git a/kwin/clients/web/Makefile.am b/kwin/clients/web/Makefile.am
new file mode 100644
index 000000000..3619301f4
--- /dev/null
+++ b/kwin/clients/web/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir) $(all_includes)
+kde_module_LTLIBRARIES = kwin3_web.la
+
+kwin3_web_la_SOURCES = Web.cpp WebButton.cpp
+
+noinst_HEADERS = Web.h WebButton.h
+
+kwin3_web_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+kwin3_web_la_LIBADD = $(LIB_KDEUI) ../../lib/libkdecorations.la
+METASOURCES = AUTO
+
+linkdir = $(kde_datadir)/kwin/
+link_DATA = web.desktop
+EXTRA_DIST = $(link_DATA)
+
diff --git a/kwin/clients/web/Web.cpp b/kwin/clients/web/Web.cpp
new file mode 100644
index 000000000..7d63b7d72
--- /dev/null
+++ b/kwin/clients/web/Web.cpp
@@ -0,0 +1,385 @@
+/*
+ 'Web' kwin client
+
+ Copyright (C) 2005 Sandro Giessl <sandro@giessl.com>
+ Copyright (C) 2001 Rik Hemsley (rikkus) <rik@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <qpainter.h>
+
+#include <kconfig.h>
+
+#include "Web.h"
+#include "WebButton.h"
+
+extern "C"
+{
+ KDE_EXPORT KDecorationFactory *create_factory()
+ {
+ return new Web::WebFactory();
+ }
+}
+
+namespace Web {
+
+WebClient::WebClient(KDecorationBridge* bridge, KDecorationFactory* factory)
+ : KCommonDecoration(bridge, factory)
+{
+ // Empty.
+}
+
+WebClient::~WebClient()
+{
+ // Empty.
+}
+
+QString WebClient::visibleName() const
+{
+ return i18n("Web");
+}
+
+QString WebClient::defaultButtonsLeft() const
+{
+ return "S";
+}
+
+QString WebClient::defaultButtonsRight() const
+{
+ return "HIAX";
+}
+
+bool WebClient::decorationBehaviour(DecorationBehaviour behaviour) const
+{
+ switch (behaviour) {
+ case DB_MenuClose:
+ return false;
+
+ case DB_WindowMask:
+ return true;
+
+ case DB_ButtonHide:
+ return true;
+
+ default:
+ return KCommonDecoration::decorationBehaviour(behaviour);
+ }
+}
+
+int WebClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
+{
+// bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows();
+
+ switch (lm) {
+ case LM_BorderLeft:
+ case LM_BorderRight:
+ case LM_BorderBottom:
+ return borderSize_;
+
+ case LM_TitleEdgeLeft:
+ case LM_TitleEdgeRight:
+ case LM_TitleEdgeTop:
+ case LM_TitleEdgeBottom:
+ return 0;
+
+ case LM_TitleBorderLeft:
+ case LM_TitleBorderRight:
+ return 0;
+
+ case LM_TitleHeight:
+ case LM_ButtonWidth:
+ case LM_ButtonHeight:
+ return titleHeight_;
+
+ case LM_ButtonSpacing:
+ return 0;
+
+ case LM_ExplicitButtonSpacer:
+ return 0;
+
+ default:
+ return KCommonDecoration::layoutMetric(lm, respectWindowState, btn);
+ }
+}
+
+KCommonDecorationButton *WebClient::createButton(ButtonType type)
+{
+ switch (type) {
+ case MenuButton:
+ return new WebButton(MenuButton, this, "menu", shape_);
+
+ case OnAllDesktopsButton:
+ return new WebButton(OnAllDesktopsButton, this, "on_all_desktops", shape_);
+
+ case HelpButton:
+ return new WebButton(HelpButton, this, "help", shape_);
+
+ case MinButton:
+ return new WebButton(MinButton, this, "minimize", shape_);
+
+ case MaxButton:
+ return new WebButton(MaxButton, this, "maximize", shape_);
+
+ case CloseButton:
+ return new WebButton(CloseButton, this, "close", shape_);
+
+ case AboveButton:
+ return new WebButton(AboveButton, this, "above", shape_);
+
+ case BelowButton:
+ return new WebButton(BelowButton, this, "below", shape_);
+
+ case ShadeButton:
+ return new WebButton(ShadeButton, this, "shade", shape_);
+
+ default:
+ return 0;
+ }
+}
+
+ void
+WebClient::init()
+{
+ // title height
+ const int textVMargin = 2;
+ QFontMetrics fm(options()->font(isActive(), isToolWindow()));
+
+ // border size
+ switch(options()->preferredBorderSize( factory())) {
+ case BorderLarge:
+ borderSize_ = 8;
+ break;
+ case BorderVeryLarge:
+ borderSize_ = 12;
+ break;
+ case BorderHuge:
+ borderSize_ = 18;
+ break;
+ case BorderVeryHuge:
+ borderSize_ = 27;
+ break;
+ case BorderOversized:
+ borderSize_ = 40;
+ break;
+ case BorderNormal:
+ default:
+ borderSize_ = 4;
+ }
+ titleHeight_ = QMAX(QMAX(14, fm.height() + textVMargin * 2), borderSize_);
+ if (0 != titleHeight_ % 2)
+ titleHeight_ += 1;
+
+ KConfig c("kwinwebrc");
+ c.setGroup("General");
+ shape_ = c.readBoolEntry("Shape", true);
+
+ KCommonDecoration::init();
+}
+
+ void
+WebClient::reset( unsigned long changed )
+{
+ if (changed & SettingColors)
+ {
+ // repaint the whole thing
+ widget()->repaint(false);
+ } else if (changed & SettingFont) {
+ // font has changed -- update title height
+ // title height
+ const int textVMargin = 2;
+ QFontMetrics fm(options()->font(isActive(), isToolWindow()));
+ titleHeight_ = QMAX(QMAX(14, fm.height() + textVMargin * 2), borderSize_);
+ if (0 != titleHeight_ % 2)
+ titleHeight_ += 1;
+
+ widget()->repaint(false);
+ }
+
+ KCommonDecoration::reset(changed);
+}
+
+ void
+WebClient::paintEvent(QPaintEvent * pe)
+{
+ int r_x, r_y, r_x2, r_y2;
+ widget()->rect().coords(&r_x, &r_y, &r_x2, &r_y2);
+ const int titleEdgeLeft = layoutMetric(LM_TitleEdgeLeft);
+ const int titleEdgeTop = layoutMetric(LM_TitleEdgeTop);
+ const int titleEdgeRight = layoutMetric(LM_TitleEdgeRight);
+ const int titleEdgeBottom = layoutMetric(LM_TitleEdgeBottom);
+ const int ttlHeight = layoutMetric(LM_TitleHeight);
+ const int titleEdgeBottomBottom = r_y+titleEdgeTop+ttlHeight+titleEdgeBottom-1;
+ QRect titleRect = QRect(r_x+titleEdgeLeft+buttonsLeftWidth(), r_y+titleEdgeTop,
+ r_x2-titleEdgeRight-buttonsRightWidth()-(r_x+titleEdgeLeft+buttonsLeftWidth()),
+ titleEdgeBottomBottom-(r_y+titleEdgeTop) );
+ titleRect.setTop(1);
+
+ QPainter p(widget());
+
+ p.setPen(Qt::black);
+ p.setBrush(options()->colorGroup(ColorFrame, isActive()).background());
+
+ p.setClipRegion(pe->region() - titleRect);
+
+ p.drawRect(widget()->rect());
+
+ p.setClipRegion(pe->region());
+
+ p.fillRect(titleRect, options()->color(ColorTitleBar, isActive()));
+
+ if (shape_)
+ {
+ int r(width());
+ int b(height());
+
+ // Draw edge of top-left corner inside the area removed by the mask.
+
+ p.drawPoint(3, 1);
+ p.drawPoint(4, 1);
+ p.drawPoint(2, 2);
+ p.drawPoint(1, 3);
+ p.drawPoint(1, 4);
+
+ // Draw edge of top-right corner inside the area removed by the mask.
+
+ p.drawPoint(r - 5, 1);
+ p.drawPoint(r - 4, 1);
+ p.drawPoint(r - 3, 2);
+ p.drawPoint(r - 2, 3);
+ p.drawPoint(r - 2, 4);
+
+ // Draw edge of bottom-left corner inside the area removed by the mask.
+
+ p.drawPoint(1, b - 5);
+ p.drawPoint(1, b - 4);
+ p.drawPoint(2, b - 3);
+ p.drawPoint(3, b - 2);
+ p.drawPoint(4, b - 2);
+
+ // Draw edge of bottom-right corner inside the area removed by the mask.
+
+ p.drawPoint(r - 2, b - 5);
+ p.drawPoint(r - 2, b - 4);
+ p.drawPoint(r - 3, b - 3);
+ p.drawPoint(r - 4, b - 2);
+ p.drawPoint(r - 5, b - 2);
+ }
+
+ p.setFont(options()->font(isActive(), isToolWindow()));
+
+ p.setPen(options()->color(ColorFont, isActive()));
+
+ p.drawText(titleRect, AlignCenter, caption());
+}
+
+void WebClient::updateWindowShape()
+{
+ if (!shape_)
+ return;
+
+ QRegion mask(0, 0, width(), height());
+
+ int r(width());
+ int b(height());
+
+ // Remove top-left corner.
+
+ mask -= QRegion(0, 0, 5, 1);
+ mask -= QRegion(0, 1, 3, 1);
+ mask -= QRegion(0, 2, 2, 1);
+ mask -= QRegion(0, 3, 1, 2);
+
+ // Remove top-right corner.
+
+ mask -= QRegion(r - 5, 0, 5, 1);
+ mask -= QRegion(r - 3, 1, 3, 1);
+ mask -= QRegion(r - 2, 2, 2, 1);
+ mask -= QRegion(r - 1, 3, 1, 2);
+
+ // Remove bottom-left corner.
+
+ mask -= QRegion(0, b - 5, 1, 3);
+ mask -= QRegion(0, b - 3, 2, 1);
+ mask -= QRegion(0, b - 2, 3, 1);
+ mask -= QRegion(0, b - 1, 5, 1);
+
+ // Remove bottom-right corner.
+
+ mask -= QRegion(r - 5, b - 1, 5, 1);
+ mask -= QRegion(r - 3, b - 2, 3, 1);
+ mask -= QRegion(r - 2, b - 3, 2, 1);
+ mask -= QRegion(r - 1, b - 5, 1, 2);
+
+ setMask(mask);
+}
+
+KDecoration* WebFactory::createDecoration( KDecorationBridge* b )
+{
+ return(new WebClient(b, this));
+}
+
+bool WebFactory::reset(unsigned long changed)
+{
+ // Do we need to "hit the wooden hammer" ?
+ bool needHardReset = true;
+ if (changed & SettingColors || changed & SettingFont)
+ {
+ needHardReset = false;
+ } else if (changed & SettingButtons) {
+ // handled by KCommonDecoration
+ needHardReset = false;
+ }
+
+ if (needHardReset) {
+ return true;
+ } else {
+ resetDecorations(changed);
+ return false;
+ }
+}
+
+bool WebFactory::supports( Ability ability )
+{
+ switch( ability )
+ {
+ case AbilityAnnounceButtons:
+ case AbilityButtonOnAllDesktops:
+ case AbilityButtonHelp:
+ case AbilityButtonMinimize:
+ case AbilityButtonMaximize:
+ case AbilityButtonClose:
+ case AbilityButtonMenu:
+ case AbilityButtonAboveOthers:
+ case AbilityButtonBelowOthers:
+ case AbilityButtonShade:
+ return true;
+ default:
+ return false;
+ };
+}
+
+QValueList< WebFactory::BorderSize > WebFactory::borderSizes() const
+{ // the list must be sorted
+ return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
+ BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
+}
+
+}
+
+#include "Web.moc"
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/kwin/clients/web/Web.h b/kwin/clients/web/Web.h
new file mode 100644
index 000000000..183829e8d
--- /dev/null
+++ b/kwin/clients/web/Web.h
@@ -0,0 +1,87 @@
+/*
+ 'Web' kwin client
+
+ Copyright (C) 2005 Sandro Giessl <sandro@giessl.com>
+ Copyright (C) 2001 Rik Hemsley (rikkus) <rik@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KWIN_WEB_H
+#define KWIN_WEB_H
+
+#include "../../lib/kcommondecoration.h"
+#include "../../lib/kdecorationfactory.h"
+
+class QLabel;
+class QSpacerItem;
+class QBoxLayout;
+
+namespace Web
+{
+
+ class WebButton;
+
+ class WebClient : public KCommonDecoration
+ {
+ public:
+
+ WebClient(KDecorationBridge* bridge, KDecorationFactory* factory);
+ ~WebClient();
+
+ virtual QString visibleName() const;
+ virtual QString defaultButtonsLeft() const;
+ virtual QString defaultButtonsRight() const;
+ virtual bool decorationBehaviour(DecorationBehaviour behaviour) const;
+ virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const;
+ virtual KCommonDecorationButton *createButton(ButtonType type);
+
+ virtual void updateWindowShape();
+
+ virtual void init();
+
+ protected:
+ virtual void reset( unsigned long changed );
+
+ virtual void paintEvent(QPaintEvent *);
+
+ private:
+
+ int titleHeight_, borderSize_;
+
+ bool shape_;
+
+ QBitmap _buttonBitmap(ButtonType t) const;
+ };
+
+ class WebFactory : public QObject, public KDecorationFactory
+ {
+ Q_OBJECT
+
+ public:
+
+ WebFactory() {};
+ virtual ~WebFactory() {};
+ virtual KDecoration* createDecoration( KDecorationBridge* );
+ virtual bool reset( unsigned long changed );
+ virtual bool supports( Ability ability );
+ virtual QValueList< BorderSize > borderSizes() const;
+ };
+}
+
+#endif
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/kwin/clients/web/WebButton.cpp b/kwin/clients/web/WebButton.cpp
new file mode 100644
index 000000000..66bedc19f
--- /dev/null
+++ b/kwin/clients/web/WebButton.cpp
@@ -0,0 +1,287 @@
+/*
+ 'Web' kwin client
+
+ Copyright (C) 2001 Rik Hemsley (rikkus) <rik@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <qpainter.h>
+
+#include "WebButton.h"
+#include "Web.h"
+
+namespace Web {
+
+ static unsigned char close_bits[] = {
+ 0x42, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0x42
+ };
+ static unsigned char iconify_bits[] = {
+ 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x3c, 0x18, 0x00
+ };
+ static unsigned char maximize_bits[] = {
+ 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00
+ };
+ static unsigned char unmaximize_bits[] = {
+ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f
+ };
+ static unsigned char sticky_bits[] = {
+ 0x20, 0x70, 0xfa, 0x7e, 0x3c, 0x1c, 0x32, 0x01
+ };
+ static unsigned char unsticky_bits[] = {
+ 0x1c, 0x1c, 0x1c, 0x3e, 0x7f, 0x08, 0x08, 0x08
+ };
+ static unsigned char help_bits[] = {
+ 0x18, 0x18, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x3c
+ };
+ static unsigned char shade_on_bits[] = {
+ 0xff, 0xff, 0x81, 0x81, 0x99, 0xbd, 0x81, 0xff
+ };
+ static unsigned char shade_off_bits[] = {
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ static unsigned char above_on_bits[] = {
+ 0xff, 0x7e, 0x3c, 0x18, 0x00, 0xff, 0xff, 0x00
+ };
+ static unsigned char above_off_bits[] = {
+ 0x18, 0x3c, 0x7e, 0xff, 0x00, 0xff, 0xff, 0x00
+ };
+ static unsigned char below_on_bits[] = {
+ 0x00, 0xff, 0xff, 0x00, 0x18, 0x3c, 0x7e, 0xff
+ };
+ static unsigned char below_off_bits[] = {
+ 0x00, 0xff, 0xff, 0x00, 0xff, 0x7e, 0x3c, 0x18
+ };
+ static unsigned char menu_bits[] = {
+ 0xff, 0x81, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff
+ };
+
+WebButton::WebButton(ButtonType type, WebClient *parent, const char *name, bool shape)
+ : KCommonDecorationButton (type, parent, name),
+ mouseOver_ (false),
+ shape_ (shape),
+ deco_ (parent)
+{
+ setBackgroundMode(NoBackground);
+}
+
+WebButton::~WebButton()
+{
+ // Empty.
+}
+
+void WebButton::reset(unsigned long changed)
+{
+ if (changed&DecorationReset || changed&ManualReset || changed&SizeChange || changed&StateChange) {
+ switch (type() ) {
+ case CloseButton:
+ setBitmap(close_bits);
+ break;
+ case HelpButton:
+ setBitmap(help_bits);
+ break;
+ case MinButton:
+ setBitmap(iconify_bits);
+ break;
+ case MaxButton:
+ setBitmap( isOn() ? unmaximize_bits : maximize_bits );
+ break;
+ case OnAllDesktopsButton:
+ setBitmap( isOn() ? unsticky_bits : sticky_bits );
+ break;
+ case ShadeButton:
+ setBitmap( isOn() ? shade_on_bits : shade_off_bits );
+ break;
+ case AboveButton:
+ setBitmap( isOn() ? above_on_bits : above_off_bits );
+ break;
+ case BelowButton:
+ setBitmap( isOn() ? below_on_bits : below_off_bits );
+ break;
+ case MenuButton:
+ setBitmap(menu_bits);
+ break;
+ default:
+ setBitmap(0);
+ break;
+ }
+
+ this->update();
+ }
+}
+
+ void
+WebButton::enterEvent(QEvent * e)
+{
+ mouseOver_ = true;
+ repaint();
+ QButton::enterEvent(e);
+}
+
+ void
+WebButton::leaveEvent(QEvent * e)
+{
+ mouseOver_ = false;
+ repaint();
+ QButton::leaveEvent(e);
+}
+
+ void
+WebButton::drawButton(QPainter *p)
+{
+ QPen highlightPen;
+
+ if (isDown() )
+ highlightPen = QPen(colorGroup().light());
+
+ else
+ {
+ if (mouseOver_)
+ highlightPen = QPen(colorGroup().highlight());
+ else
+ highlightPen = QPen(NoPen);
+ }
+
+ p->fillRect(rect(), colorGroup().background());
+
+ Position position_;
+ if (0 == mapToParent(rect().topLeft() ).x() )
+ position_ = Left;
+ else if (deco_->width()-1 == mapToParent(rect().topRight() ).x() )
+ position_ = Right;
+ else
+ position_ = Mid;
+ switch ( position_ )
+ {
+ case Left:
+ {
+ // Draw edge.
+
+ p->setPen(Qt::black);
+
+ p->drawLine(0, 0, width(), 0);
+ p->drawLine(0, 1, 0, height() - 1);
+ if (shape_)
+ {
+ p->drawPoint(3, 1);
+ p->drawPoint(4, 1);
+ p->drawPoint(2, 2);
+ p->drawPoint(1, 3);
+ p->drawPoint(1, 4);
+ }
+ // Draw highlight.
+
+ p->setBrush(NoBrush);
+ p->setPen(highlightPen);
+
+ if (shape_)
+ p->setClipRegion(QRegion(rect()) - QRect(0, 0, 6, 6));
+
+ p->drawRect(2, 2, width() - 4, height() - 4);
+ if (shape_)
+ {
+ p->setClipRect(rect());
+ p->drawPoint(4, 3);
+ p->drawPoint(5, 3);
+ p->drawPoint(3, 4);
+ p->drawPoint(3, 5);
+ }
+ }
+
+ break;
+
+ case Right:
+ {
+ // Draw edge.
+
+ p->setPen(Qt::black);
+ p->drawLine(0, 0, width(), 0);
+ p->drawLine(width() - 1, 1, width() - 1, height() - 1);
+ if (shape_)
+ {
+ p->drawPoint(width() - 5, 1);
+ p->drawPoint(width() - 4, 1);
+ p->drawPoint(width() - 3, 2);
+ p->drawPoint(width() - 2, 3);
+ p->drawPoint(width() - 2, 4);
+ }
+ // Draw highlight.
+
+ p->setBrush(NoBrush);
+ p->setPen(highlightPen);
+
+ if (shape_)
+ p->setClipRegion(QRegion(rect()) - QRect(width() - 6, 0, 6, 6));
+
+ p->drawRect(2, 2, width() - 4, height() - 4);
+ if (shape_)
+ {
+ p->setClipRect(rect());
+ p->drawPoint(width() - 5, 3);
+ p->drawPoint(width() - 6, 3);
+ p->drawPoint(width() - 4, 4);
+ p->drawPoint(width() - 4, 5);
+ }
+ }
+
+ break;
+
+ case Mid:
+ default:
+ {
+ // Draw edge.
+
+ p->setPen(Qt::black);
+ p->drawLine(0, 0, width(), 0);
+
+ // Draw highlight.
+
+ p->setBrush(NoBrush);
+ p->setPen(highlightPen);
+
+ p->drawRect(2, 2, width() - 4, height() - 4);
+ }
+
+ break;
+ }
+
+ // Draw icon.
+
+ QPoint center(rect().center());
+
+ int bwby2(bitmap_.width() / 2); // Bitmap Width BY 2
+ int bhby2(bitmap_.height() / 2); // Bitmap Height BY 2
+
+ p->setBrush(NoBrush);
+ p->setPen(Qt::black);
+
+ p->drawPixmap(center.x() - bwby2 + 1, center.y() - bhby2 + 1, bitmap_);
+}
+
+ void
+WebButton::setBitmap(const unsigned char *bitmap)
+{
+ if (bitmap)
+ bitmap_ = QBitmap(8,8, bitmap, true);
+ else
+ bitmap_ = QBitmap(8,8);
+ bitmap_.setMask(bitmap_);
+}
+
+}
+
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/kwin/clients/web/WebButton.h b/kwin/clients/web/WebButton.h
new file mode 100644
index 000000000..6c1530f42
--- /dev/null
+++ b/kwin/clients/web/WebButton.h
@@ -0,0 +1,70 @@
+/*
+ 'Web' kwin client
+
+ Copyright (C) 2001 Rik Hemsley (rikkus) <rik@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KWIN_WEB_BUTTON_H
+#define KWIN_WEB_BUTTON_H
+
+#include <qwidget.h>
+#include <qbitmap.h>
+#include <klocale.h>
+
+#include "../../lib/kcommondecoration.h"
+
+namespace Web
+{
+ class WebClient;
+
+ class WebButton : public KCommonDecorationButton
+ {
+ public:
+
+ enum Position
+ {
+ Left, Mid, Right
+ };
+
+ WebButton(ButtonType type, WebClient *parent, const char *name, bool shape);
+
+ virtual ~WebButton();
+
+ virtual void reset(unsigned long changed);
+
+ protected:
+ void setBitmap(const unsigned char *bitmap);
+
+ void enterEvent(QEvent *);
+ void leaveEvent(QEvent *);
+ void drawButton(QPainter *p);
+
+ private:
+ QBitmap bitmap_;
+
+ bool mouseOver_;
+
+ bool shape_;
+ WebClient* deco_;
+ };
+}
+
+#endif
+
+// vim:ts=2:sw=2:tw=78:set et:
+// kate: indent-width 2; replace-tabs on; tab-width 2; space-indent on;
diff --git a/kwin/clients/web/web.desktop b/kwin/clients/web/web.desktop
new file mode 100644
index 000000000..12ced34f4
--- /dev/null
+++ b/kwin/clients/web/web.desktop
@@ -0,0 +1,47 @@
+[Desktop Entry]
+Name=Web
+Name[ar]=الشبكة
+Name[az]=Veb
+Name[be]=Сеціва
+Name[bn]=ওয়েব
+Name[br]=Gwiad
+Name[csb]=Séc
+Name[cy]=Gwe
+Name[da]=Net
+Name[el]=Ιστός
+Name[eo]=TTT
+Name[et]=Veeb
+Name[fa]=وب
+Name[ga]=Gréasán
+Name[hi]=वेब
+Name[hr]=Internet
+Name[is]=Vefur
+Name[km]=បណ្ដាញ
+Name[lo]=ແບບເວ໊ບ
+Name[lv]=Tīmekļa
+Name[mk]=Веб
+Name[mn]=Веб
+Name[nb]=Nett
+Name[ne]=वेब
+Name[nn]=Vev
+Name[pa]=ਵੈੱਬ
+Name[pl]=Sieć
+Name[rw]=Urubugamakuru
+Name[se]=Fierpmádat
+Name[sl]=Splet
+Name[sr]=Веб
+Name[sr@Latn]=Veb
+Name[sv]=Webb
+Name[ta]=வலை
+Name[te]=వెబ్
+Name[tg]=Вэб
+Name[th]=แบบเว็บ
+Name[uk]=Тенета
+Name[uz]=Veb
+Name[uz@cyrillic]=Веб
+Name[ven]=Webu
+Name[vi]=Mạng
+Name[wa]=Waibe
+Name[zh_TW]=網頁
+Name[zu]=I-Web
+X-KDE-Library=kwin3_web