From 29af54215b5c9a4abeb8fb222e077a9675659123 Mon Sep 17 00:00:00 2001 From: "Daniel M. Duley" Date: Sat, 16 Jun 2001 00:48:49 +0000 Subject: [PATCH] Removing the styles I wrote except the default one, and will be maintaining them outside of CVS. svn path=/trunk/kdebase/kwin/; revision=102431 --- clients/Makefile.am | 2 +- clients/b2/Makefile.am | 21 - clients/b2/b2.desktop | 3 - clients/b2/b2client.cpp | 1065 -------------------- clients/b2/b2client.h | 120 --- clients/b2/bitmaps.h | 98 -- clients/kstep/Makefile.am | 21 - clients/kstep/kstep.desktop | 9 - clients/kstep/nextclient.cpp | 391 ------- clients/kstep/nextclient.h | 56 - clients/kwmtheme/Makefile.am | 11 - clients/kwmtheme/cli_installer/Makefile.am | 18 - clients/kwmtheme/cli_installer/main.cpp | 165 --- clients/kwmtheme/kwmtheme.desktop | 41 - clients/kwmtheme/kwmthemeclient.cpp | 833 --------------- clients/kwmtheme/kwmthemeclient.h | 58 -- clients/laptop/Makefile.am | 21 - clients/laptop/laptop.desktop | 28 - clients/laptop/laptopclient.cpp | 704 ------------- clients/laptop/laptopclient.h | 86 -- clients/modernsystem/Makefile.am | 20 - clients/modernsystem/btnhighcolor.h | 93 -- clients/modernsystem/buttondata.h | 42 - clients/modernsystem/config/Makefile.am | 15 - clients/modernsystem/config/config.cpp | 77 -- clients/modernsystem/config/config.h | 38 - clients/modernsystem/modernsys.cpp | 646 ------------ clients/modernsystem/modernsys.h | 70 -- clients/modernsystem/modernsystem.desktop | 3 - clients/system/Makefile.am | 21 - clients/system/system.desktop | 20 - clients/system/systemclient.cpp | 555 ---------- clients/system/systemclient.h | 79 -- 33 files changed, 1 insertion(+), 5429 deletions(-) delete mode 100644 clients/b2/Makefile.am delete mode 100644 clients/b2/b2.desktop delete mode 100644 clients/b2/b2client.cpp delete mode 100644 clients/b2/b2client.h delete mode 100644 clients/b2/bitmaps.h delete mode 100644 clients/kstep/Makefile.am delete mode 100644 clients/kstep/kstep.desktop delete mode 100644 clients/kstep/nextclient.cpp delete mode 100644 clients/kstep/nextclient.h delete mode 100644 clients/kwmtheme/Makefile.am delete mode 100644 clients/kwmtheme/cli_installer/Makefile.am delete mode 100644 clients/kwmtheme/cli_installer/main.cpp delete mode 100644 clients/kwmtheme/kwmtheme.desktop delete mode 100644 clients/kwmtheme/kwmthemeclient.cpp delete mode 100644 clients/kwmtheme/kwmthemeclient.h delete mode 100644 clients/laptop/Makefile.am delete mode 100644 clients/laptop/laptop.desktop delete mode 100644 clients/laptop/laptopclient.cpp delete mode 100644 clients/laptop/laptopclient.h delete mode 100644 clients/modernsystem/Makefile.am delete mode 100644 clients/modernsystem/btnhighcolor.h delete mode 100644 clients/modernsystem/buttondata.h delete mode 100644 clients/modernsystem/config/Makefile.am delete mode 100644 clients/modernsystem/config/config.cpp delete mode 100644 clients/modernsystem/config/config.h delete mode 100644 clients/modernsystem/modernsys.cpp delete mode 100644 clients/modernsystem/modernsys.h delete mode 100644 clients/modernsystem/modernsystem.desktop delete mode 100644 clients/system/Makefile.am delete mode 100644 clients/system/system.desktop delete mode 100644 clients/system/systemclient.cpp delete mode 100644 clients/system/systemclient.h diff --git a/clients/Makefile.am b/clients/Makefile.am index 086e92ccdf..40a49e355d 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -1 +1 @@ -SUBDIRS = default kde1 kstep system b2 laptop riscos modernsystem win2k kwmtheme quartz icewm web mwm +SUBDIRS = default kde1 riscos win2k quartz icewm web mwm diff --git a/clients/b2/Makefile.am b/clients/b2/Makefile.am deleted file mode 100644 index 049d88d20a..0000000000 --- a/clients/b2/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ - -INCLUDES = $(all_includes) - -kde_module_LTLIBRARIES = libkwinb2.la - -libkwinb2_la_SOURCES = b2client.cpp -libkwinb2_la_LIBADD = ../../kwin.la -libkwinb2_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) - -METASOURCES = AUTO -noinst_HEADERS = b2client.h - -lnkdir = $(kde_datadir)/kwin/ -lnk_DATA = b2.desktop - -EXTRA_DIST = $(lnk_DATA) - - -###KMAKE-start (don't edit or delete this block) - -###KMAKE-end diff --git a/clients/b2/b2.desktop b/clients/b2/b2.desktop deleted file mode 100644 index 475f13111b..0000000000 --- a/clients/b2/b2.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name=B II -X-KDE-Library=libkwinb2 diff --git a/clients/b2/b2client.cpp b/clients/b2/b2client.cpp deleted file mode 100644 index b26e9b4733..0000000000 --- a/clients/b2/b2client.cpp +++ /dev/null @@ -1,1065 +0,0 @@ -#include "b2client.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../workspace.h" -#include "../../options.h" -#include "bitmaps.h" - -using namespace KWinInternal; - - -// TODO: stick all these in an array -static KPixmap *aClosePix, *aClosePixDown; -static KPixmap *iClosePix, *iClosePixDown; -static KPixmap *aMaxPix, *aMaxPixDown; -static KPixmap *iMaxPix, *iMaxPixDown; -static KPixmap *aNormalizePix, *aNormalizePixDown; -static KPixmap *iNormalizePix, *iNormalizePixDown; -static KPixmap *aIconifyPix, *aIconifyPixDown; -static KPixmap *iIconifyPix, *iIconifyPixDown; -static KPixmap *aPinupPix, *aPinupPixDown; -static KPixmap *iPinupPix, *iPinupPixDown; -static KPixmap *aMenuPix, *aMenuPixDown; -static KPixmap *iMenuPix, *iMenuPixDown; -static KPixmap *aHelpPix, *aHelpPixDown; -static KPixmap *iHelpPix, *iHelpPixDown; - -static bool pixmaps_created = false; - -static void drawB2Rect(KPixmap *pix, const QColor &primary, bool down) -{ - QPainter p; - QColor hColor = primary.light(150); - QColor lColor = primary.dark(150); - - if(QPixmap::defaultDepth() > 8){ - if(down) - KPixmapEffect::gradient(*pix, lColor, hColor, - KPixmapEffect::DiagonalGradient); - else - KPixmapEffect::gradient(*pix, hColor, lColor, - KPixmapEffect::DiagonalGradient); - } - else - pix->fill(primary); - int x2 = pix->width()-1; - int y2 = pix->height()-1; - p.begin(pix); - p.setPen(down ? hColor : lColor); - p.drawLine(0, 0, x2, 0); - p.drawLine(0, 0, 0, y2); - p.drawLine(1, x2-1, y2-1, x2-1); - p.drawLine(x2-1, 1, x2-1, y2-1); - p.setPen(down ? lColor : hColor); - p.drawRect(1, 1, x2, y2); - p.end(); - -} - -static void create_pixmaps(); -static void redraw_pixmaps(); - -QPixmap* kwin_get_menu_pix_hack() -{ - //return menu_pix; FIXME - return aMenuPix; -} - -static void create_pixmaps() -{ - if ( pixmaps_created ) - return; - pixmaps_created = true; - - // TODO: Stick all these in an array - aClosePix = new KPixmap; - aClosePix->resize(16, 16); - aClosePixDown = new KPixmap; - aClosePixDown->resize(16, 16); - - iClosePix = new KPixmap; - iClosePix->resize(16, 16); - iClosePixDown = new KPixmap; - iClosePixDown->resize(16, 16); - - aMaxPix = new KPixmap; - aMaxPixDown = new KPixmap; - iMaxPix = new KPixmap; - iMaxPixDown = new KPixmap; - - aNormalizePix = new KPixmap(); - aNormalizePix->resize(16, 16); - aNormalizePixDown = new KPixmap(); - aNormalizePixDown->resize(16, 16); - - aIconifyPix = new KPixmap; - aIconifyPix->resize(10, 10); - aIconifyPixDown = new KPixmap; - aIconifyPixDown->resize(10, 10); - - iNormalizePix = new KPixmap(); - iNormalizePix->resize(16, 16); - iNormalizePixDown = new KPixmap(); - iNormalizePixDown->resize(16, 16); - - iIconifyPix = new KPixmap; - iIconifyPix->resize(10, 10); - iIconifyPixDown = new KPixmap; - iIconifyPixDown->resize(10, 10); - - aPinupPix = new KPixmap; - aPinupPix->resize(16, 16); - aPinupPixDown = new KPixmap; - aPinupPixDown->resize(16, 16); - - iPinupPix = new KPixmap; - iPinupPix->resize(16, 16); - iPinupPixDown = new KPixmap; - iPinupPixDown->resize(16, 16); - - aMenuPix = new KPixmap; - aMenuPix->resize(16, 16); - aMenuPixDown = new KPixmap; - aMenuPixDown->resize(16, 16); - - iMenuPix = new KPixmap; - iMenuPix->resize(16, 16); - iMenuPixDown = new KPixmap; - iMenuPixDown->resize(16, 16); - - aHelpPix = new KPixmap; - aHelpPix->resize(16, 16); - aHelpPixDown = new KPixmap; - aHelpPixDown->resize(16, 16); - iHelpPix = new KPixmap; - iHelpPix->resize(16, 16); - iHelpPixDown = new KPixmap; - iHelpPixDown->resize(16, 16); - - // there seems to be no way to load X bitmaps from data properly, so - // we need to create new ones for each mask :P - QBitmap pinupMask(16, 16, pinup_mask_bits, true); - aPinupPix->setMask(pinupMask); - iPinupPix->setMask(pinupMask); - QBitmap pindownMask(16, 16, pindown_mask_bits, true); - aPinupPixDown->setMask(pindownMask); - iPinupPixDown->setMask(pindownMask); - - QBitmap menuMask(16, 16, menu_mask_bits, true); - aMenuPix->setMask(menuMask); - iMenuPix->setMask(menuMask); - aMenuPixDown->setMask(menuMask); - iMenuPixDown->setMask(menuMask); - - QBitmap helpMask(16, 16, help_mask_bits, true); - aHelpPix->setMask(helpMask); - iHelpPix->setMask(helpMask); - aHelpPixDown->setMask(helpMask); - iHelpPixDown->setMask(helpMask); - redraw_pixmaps(); -} - -static void delete_pixmaps() -{ - delete aClosePix; - delete aClosePixDown; - delete iClosePix; - delete iClosePixDown; - delete aMaxPix; - delete aMaxPixDown; - delete iMaxPix; - delete iMaxPixDown; - delete aNormalizePix; - delete aNormalizePixDown; - delete iNormalizePix; - delete iNormalizePixDown; - delete aIconifyPix; - delete aIconifyPixDown; - delete iIconifyPix; - delete iIconifyPixDown; - delete aPinupPix; - delete aPinupPixDown; - delete iPinupPix; - delete iPinupPixDown; - delete aMenuPix; - delete aMenuPixDown; - delete iMenuPix; - delete iMenuPixDown; - delete aHelpPix; - delete aHelpPixDown; - delete iHelpPix; - delete iHelpPixDown; - - pixmaps_created = false; -} - -B2Button::B2Button(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix, - KPixmap *iPixDown, Client *_client, QWidget *parent, - const char *name) - : QButton(parent, name) -{ - client = _client; - pNorm = pix; - pDown = pixDown; - iNorm = iPix; - iDown = iPixDown; - setFixedSize(16, 16); - setFocusPolicy(NoFocus); - resize(16, 16); -} - -QSize B2Button::sizeHint() const -{ - return(QSize(16, 16)); -} - -QSizePolicy B2Button::sizePolicy() const -{ - return(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); -} - - -void B2Button::drawButton(QPainter *p) -{ - p->fillRect(rect(), bg); - if(useMiniIcon && !client->miniIcon().isNull()){ - QPixmap miniIcon = client->miniIcon(); - p->drawPixmap((width()-miniIcon.width())/2, - (height()-miniIcon.height())/2, miniIcon); - } - else{ - if(client->isActive()){ - if(isOn() || isDown()) - p->drawPixmap((width()-pDown->width())/2, - (height()-pDown->height())/2, *pDown); - else - p->drawPixmap((width()-pNorm->width())/2, - (height()-pNorm->height())/2, *pNorm); - } - else{ - if(isOn() || isDown()) - p->drawPixmap((width()-pDown->width())/2, - (height()-pDown->height())/2, *iDown); - else - p->drawPixmap((width()-pNorm->width())/2, - (height()-pNorm->height())/2, *iNorm); - } - } -} - -void B2Button::setPixmaps(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix, - KPixmap *iPixDown) -{ - pNorm = pix; - pDown = pixDown; - iNorm = iPix; - iDown = iPixDown; - repaint(false); -} - -void B2Button::mousePressEvent( QMouseEvent* e ) -{ - last_button = e->button(); - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QButton::mousePressEvent( &me ); -} - -void B2Button::mouseReleaseEvent( QMouseEvent* e ) -{ - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QButton::mouseReleaseEvent( &me ); -} - -B2Titlebar::B2Titlebar(B2Client *parent) - : QWidget(parent) -{ - set_x11mask = false; - isfullyobscured = false; - shift_move = false; - client = parent; -} - -bool B2Titlebar::x11Event(XEvent *e) -{ - if (!set_x11mask) { - set_x11mask = true; - XSelectInput(qt_xdisplay(), winId(), - KeyPressMask | KeyReleaseMask | - ButtonPressMask | ButtonReleaseMask | - KeymapStateMask | - ButtonMotionMask | - EnterWindowMask | LeaveWindowMask | - FocusChangeMask | - ExposureMask | - PropertyChangeMask | - StructureNotifyMask | SubstructureRedirectMask | - VisibilityChangeMask); - } - switch( e->type ) { - case VisibilityNotify: - isfullyobscured = false; - if (e->xvisibility.state == VisibilityFullyObscured) { - isfullyobscured = true; - client->unobscureTitlebar(); - } - break; - default: - break; - } - return QWidget::x11Event(e); -} - -void B2Titlebar::recalcBuffer() -{ - QFontMetrics fm(options->font(true)); - titleBuffer.resize(width(), height()); - - QPainter p; - p.begin(&titleBuffer); - QRect t=rect(); - - // black titlebar frame - p.setPen(Qt::black); - p.drawLine(0, 0, 0, t.bottom() ); - p.drawLine(0, 0, t.right(), 0); - p.drawLine(t.right(), 0, t.right(), t.bottom()); - - // titlebar fill - qDrawShadeRect(&p, 1, 1, t.right()-1, t.height()-1, - options->colorGroup(Options::TitleBar, true), - false, 1, 0, - &options->colorGroup(Options::TitleBar, true). - brush(QColorGroup::Background)); - - // and the caption - p.setPen(options->color(Options::Font, true)); - p.setFont(options->font(true)); - - QLayoutIterator it=layout()->iterator(); - ++it; - ++it; - ++it; - t=(++it)->geometry(); - - p.drawText(t, AlignLeft | AlignVCenter, client->caption()); - p.end(); - - oldTitle = caption(); -} - -void B2Titlebar::resizeEvent(QResizeEvent *) -{ - recalcBuffer(); - repaint(false); -} - - -void B2Titlebar::paintEvent(QPaintEvent * /*e*/) -{ - if(client->isActive()) - bitBlt(this, 0, 0, &titleBuffer, 0, 0, titleBuffer.width(), - titleBuffer.height(), Qt::CopyROP, true); - else{ - QPainter p(this); - QRect t=rect(); - // black titlebar frame - p.setPen(Qt::black); - p.drawLine(0, 0, 0, t.bottom() ); - p.drawLine(0, 0, t.right(), 0); - p.drawLine(t.right(), 0, t.right(), t.bottom()); - - // titlebar fill - qDrawShadeRect(&p, 1, 1, t.right()-1, t.height()-1, - options->colorGroup(Options::TitleBar, false), - false, 1, 0, - &options->colorGroup(Options::TitleBar, false). - brush(QColorGroup::Button)); - - // and the caption - p.setPen(options->color(Options::Font, false)); - p.setFont(options->font(false)); - - QLayoutIterator it=layout()->iterator(); - ++it; - ++it; - ++it; - t=(++it)->geometry(); - - p.drawText(t, AlignLeft | AlignVCenter, client->caption()); - } -} - -void B2Titlebar::mouseDoubleClickEvent( QMouseEvent * ) -{ - client->workspace()->performWindowOperation( client, options->operationTitlebarDblClick() ); - client->workspace()->requestFocus( client ); -} - -void B2Titlebar::mousePressEvent( QMouseEvent * e ) -{ - shift_move = e->state() & ShiftButton; - if (shift_move ) { - moveOffset = e->globalPos(); - } - QMouseEvent _e(QEvent::MouseButtonPress, mapToParent(e->pos()), - e->globalPos(), e->button(), e->state()); - //QWidget::mousePressEvent( e ); - client->mousePressEvent( &_e); -} - -void B2Titlebar::mouseReleaseEvent( QMouseEvent * e ) -{ - shift_move = false; - QMouseEvent _e(QEvent::MouseButtonRelease, mapToParent(e->pos()), - e->globalPos(), e->button(), e->state()); - //QWidget::mouseReleaseEvent( e ); - client->mouseReleaseEvent( &_e); -} - -void B2Titlebar::mouseMoveEvent( QMouseEvent * e ) -{ - if (shift_move) { - int oldx = mapFromGlobal(moveOffset).x(); - int xdiff = e->globalPos().x() - moveOffset.x(); - moveOffset = e->globalPos(); - if (oldx >= 0 && oldx <= rect().right()) { - client->titleMoveRel(xdiff); - } - } else { - QMouseEvent _e(QEvent::MouseMove, mapToParent(e->pos()), - e->globalPos(), e->button(), e->state()); - client->mouseMoveEvent( &_e); - } -} - -void B2Client::maxButtonClicked( ) -{ - switch ( button[BtnMax]->last_button ) { - case MidButton: - maximize( MaximizeVertical ); - break; - case RightButton: - maximize( MaximizeHorizontal ); - break; - default: //LeftButton: - maximize( MaximizeFull ); - break; - } -} - -B2Client::B2Client( Workspace *ws, WId w, QWidget *parent, - const char *name ) - : Client( ws, w, parent, name, WResizeNoErase ) -{ - bar_x_ofs = 0; - in_unobs = 0; - - g = new QGridLayout( this, 0, 0); - g->addMultiCellWidget(windowWrapper(), 1, 1, 1, 2); - - g->addColSpacing(0, 4); - - g->addColSpacing(1, 16); - - g->setColStretch(2, 1); - - g->setRowStretch(1, 1); - g->addColSpacing(3, 4); - g->addRowSpacing(2, 8); - - // titlebar - g->addRowSpacing(0, 20); - - titlebar = new B2Titlebar(this); - titlebar->setMinimumWidth(16); - titlebar->setFixedHeight(20); - - int i; - for(i=0; i < 6; ++i){ - button[i] = new B2Button(this, titlebar/*this*/); - button[i]->setFixedSize(16, 16); - } - - QHBoxLayout *titleLayout=new QHBoxLayout(titlebar); - titleLayout->setSpacing(1); - - titleLayout->addSpacing(3); - titleLayout->addWidget(button[BtnMenu]); - titleLayout->addWidget(button[BtnSticky]); - titleLayout->addWidget(button[BtnHelp]); - titleLayout->addStretch(1); - titleLayout->addWidget(button[BtnIconify]); - titleLayout->addWidget(button[BtnMax]); - titleLayout->addWidget(button[BtnClose]); - titleLayout->addSpacing(3); - - button[BtnSticky]->setToggle(); - button[BtnSticky]->setDown(isSticky()); - button[BtnMenu]->setUseMiniIcon(); - - if(!providesContextHelp()) - button[BtnHelp]->hide(); - - button[BtnMenu]->setPixmaps(aMenuPix, aMenuPixDown, iMenuPix, - iMenuPixDown); - button[BtnSticky]->setPixmaps(aPinupPix, aPinupPixDown, iPinupPix, - iPinupPixDown); - button[BtnIconify]->setPixmaps(aIconifyPix, aIconifyPixDown, - iIconifyPix, iIconifyPixDown); - button[BtnClose]->setPixmaps(aClosePix, aClosePixDown, iClosePix, - iClosePixDown); - button[BtnHelp]->setPixmaps(aHelpPix, aHelpPixDown, iHelpPix, - iHelpPixDown); - - if(isMaximized()) - button[BtnMax]->setPixmaps(aNormalizePix, aNormalizePixDown, - iNormalizePix, iNormalizePixDown); - else - button[BtnMax]->setPixmaps(aMaxPix, aMaxPixDown, iMaxPix, - iMaxPixDown); - - QColor c = options->colorGroup(Options::TitleBar, isActive()). - color(QColorGroup::Button); - titlebar->setBackgroundColor(c); - titlebar->recalcBuffer(); - for(i=0; i < 6; ++i) - button[i]->setBg(c); - - positionButtons(); - connect(button[BtnMenu], SIGNAL(clicked()), this, SLOT(menuButtonPressed())); - connect(button[BtnSticky], SIGNAL(clicked()), this, SLOT(toggleSticky())); - connect(button[BtnIconify], SIGNAL(clicked()), this, SLOT(iconify())); - connect(button[BtnMax], SIGNAL( clicked() ), this, SLOT( maxButtonClicked())); - connect(button[BtnClose], SIGNAL(clicked()), this, SLOT(closeWindow())); - connect(button[BtnHelp], SIGNAL(clicked()), this, SLOT(contextHelp())); - - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); -} - -void B2Client::iconChange() -{ - button[BtnMenu]->repaint( false ); -} - -void B2Client::resizeEvent( QResizeEvent* e) -{ - Client::resizeEvent( e ); - - int sizeProblem = 0; - - if (width() < 45) sizeProblem = 3; - else if (width() < 70) sizeProblem = 2; - else if (width() < 120) sizeProblem = 1; - - switch (sizeProblem) { - - case 1: - button[BtnMenu] ->show(); - button[BtnClose] ->show(); - button[BtnSticky] ->hide(); - button[BtnIconify] ->show(); - button[BtnMax] ->hide(); - button[BtnHelp] ->hide(); - break; - - case 2: - button[BtnMenu] ->show(); - button[BtnClose] ->show(); - button[BtnSticky] ->hide(); - button[BtnIconify] ->hide(); - button[BtnMax] ->hide(); - button[BtnHelp] ->hide(); - break; - - case 3: - button[BtnMenu] ->hide(); - button[BtnClose] ->hide(); - button[BtnSticky] ->hide(); - button[BtnIconify] ->hide(); - button[BtnMax] ->hide(); - button[BtnHelp] ->hide(); - break; - - case 0: - default: - button[BtnMenu] ->show(); - button[BtnClose] ->show(); - button[BtnSticky] ->show(); - button[BtnIconify] ->show(); - button[BtnMax] ->show(); - if(providesContextHelp()) - button[BtnHelp]->show(); - break; - } - - titlebar->layout()->activate(); - - positionButtons(); - /* may be the resize cuted off some space occupied by titlebar, which - was moved, so instead of reducing it, we first try to move it */ - titleMoveAbs(bar_x_ofs); - doShape(); - - /* - What does this? (MM) - if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) { - QPainter p( this ); - QRect t = titlebar->geometry(); - QRegion r = rect(); - r = r.subtract( t ); - p.setClipRegion( r ); - p.eraseRect( rect() ); - } - */ - repaint(); //there is some strange wrong repaint of the frame without -} - -void B2Client::captionChange( const QString &) -{ - positionButtons(); - titleMoveAbs(bar_x_ofs); - doShape(); - //repaint(); - titlebar->recalcBuffer(); - titlebar->repaint(false); -} - -void B2Client::paintEvent( QPaintEvent* e) -{ - QPainter p( this ); - - QRect t = titlebar->geometry(); - - // inner window rect - p.drawRect(3, t.bottom(), width()-6, height()-t.height()-6); - - // outer frame rect - p.drawRect(0, t.bottom()-3, width(), height()-t.height()); - - // frame shade panel - qDrawShadePanel(&p, 1, t.bottom()-2, width()-2, height()-t.height()-2, - options->colorGroup(Options::Frame, isActive()), - false); - - //bottom handle rect - int hx = width()-40; - int hw = 40; - - //p.drawRect(hx, height()-8, hw, 8); - p.drawLine(width()-1, height()-8, width()-1, height()-1); - p.drawLine(hx, height()-1, width()-1, height()-1); - p.drawLine(hx, height()-4, hx, height()-1); - - p.fillRect(hx+1, height()-7, hw-2, 6, - options->colorGroup(Options::Frame, isActive()) - .brush(QColorGroup::Button)); - - p.setPen(options->colorGroup(Options::Frame, isActive()).dark()); - p.drawLine(width()-2, height()-8, width()-2, height()-2); - p.drawLine(hx+1, height()-2, width()-2, height()-2); - p.setPen(options->colorGroup(Options::Frame, isActive()).light()); - p.drawLine(hx+1, height()-6, hx+1, height()-3); - p.drawLine(hx+1, height()-7, width()-3, height()-7); - - /* OK, we got a paint event, which means parts of us are now visible - which were not before. We try the titlebar if it is currently fully - obscured, and if yes, try to unobscure it, in the hope that some - of the parts which we just painted were in the titlebar area. - It can happen, that the titlebar, as it got the FullyObscured event - had no chance of becoming partly visible. The problem is, that - we now might have the space available, but the titlebar gets no - visibilitinotify events until its state changes, so we just try - */ - if (titlebar->isFullyObscured()) { - /* We first see, if our repaint contained the titlebar area */ - QRegion reg(QRect(0,0,width(),20)); - reg = reg.intersect(e->region()); - if (!reg.isEmpty()) - unobscureTitlebar(); - } -} - -#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) - -void B2Client::doShape() -{ - QRect t = titlebar->geometry(); - QRegion mask(rect()); - // top to the tilebar right - if (bar_x_ofs) { - mask -= QRect(0, 0, bar_x_ofs, t.height()-4); //left from bar - mask -= QRect(0, t.height()-4, 1, 1); //top left point - } - if (t.right() < width()-1) { - mask -= QRect(width()-1, t.height()-4, 1, 1); // top right point - mask -= QRect(t.right()+1, 0, width()-t.right()-1, t.height()-4); - } - mask -= QRect(width()-1, height()-1, 1, 1); // bottom right point - mask -= QRect(0, height()-5, 1, 1); // bottom left point - mask -= QRect(width()-1, height()-1, 1, 1); // bottom right point - mask -= QRect(width()-40, height()-1, 1, 1); // handle left point - mask -= QRect(0, height()-4, width()-40, 4); // bottom left - - setMask(mask); -} - -void B2Client::showEvent(QShowEvent *ev) -{ - Client::showEvent(ev); - doShape(); - repaint(); - titlebar->repaint(); -} - -void B2Client::windowWrapperShowEvent( QShowEvent* ) -{ - doShape(); -} - -Client::MousePosition B2Client::mousePosition( const QPoint& p ) const -{ - const int range = 16; - const int border = 4; - /*QRect t = g->cellGeometry(0, 1); - t.setRight(button[BtnClose]->x()+17); - */ - QRect t = titlebar->geometry(); - t.setHeight(20-border); - int ly = t.bottom(); - int lx = t.right(); - - if ( p.x() > t.right() ) { - if ( p.y() <= ly + range && p.x() >= width()-range) - return TopRight; - else if ( p.y() <= ly + border ) - return Top; - } else if ( p.x() < bar_x_ofs ) { - if ( p.y() <= ly + range && p.x() <= range ) - return TopLeft; - else if ( p.y() <= ly+border ) - return Top; - } else if ( p.y() < ly ) { - if ( p.x() > bar_x_ofs+border && p.x() < lx-border && p.y() > border ) - return Client::mousePosition( p ); - if ( p.x() > bar_x_ofs+range && p.x() < lx - range) - return Top; - if ( p.y() <= range ) { - if ( p.x() <= bar_x_ofs+range ) - return TopLeft; - else return TopRight; - } else { - if ( p.x() <= bar_x_ofs+range ) - return Left; - else return Right; - } - } - - if (p.y() >= height() - 8) { - /* the normal Client:: only wants border of 4 pixels */ - if (p.x() <= range) return BottomLeft; - if (p.x() >= width()-range) return BottomRight; - return Bottom; - } - - return Client::mousePosition( p ); -} - - -void B2Client::titleMoveAbs(int new_ofs) -{ - if (new_ofs < 0) new_ofs = 0; - if (new_ofs + titlebar->width() > width()) { - new_ofs = width() - titlebar->width(); - } - if (bar_x_ofs != new_ofs) { - bar_x_ofs = new_ofs; - positionButtons(); - doShape(); - repaint( 0, 0, width(), 20, false ); - titlebar->repaint(false); - } -} - -void B2Client::titleMoveRel(int xdiff) -{ - titleMoveAbs(bar_x_ofs + xdiff); -} - -void B2Client::stickyChange(bool on) -{ - button[1]->setDown(on); -} - -void B2Client::maximizeChange(bool m) -{ - if(m){ - button[BtnMax]->setPixmaps(aNormalizePix, aNormalizePixDown, - iNormalizePix, iNormalizePixDown); - } - else{ - button[BtnMax]->setPixmaps(aMaxPix, aMaxPixDown, iMaxPix, - iMaxPixDown); - } - button[BtnMax]->repaint(); -} - - -void B2Client::activeChange(bool on) -{ - int i; - repaint(false); - titlebar->repaint(false); - QColor c = options->colorGroup(Options::TitleBar, on). - color(QColorGroup::Button); - for(i=0; i < 6; ++i){ - button[i]->setBg(c); - button[i]->repaint(); - } -} - -void B2Client::init() -{ - // -} - -void B2Client::menuButtonPressed() -{ - workspace()->clientPopup(this)-> - popup(button[BtnMenu]->mapToGlobal(button[BtnMenu]-> - rect().bottomLeft())); -} - -void B2Client::slotReset() -{ - redraw_pixmaps(); - QColor c = options->colorGroup(Options::TitleBar, isActive()). - color(QColorGroup::Button); - int i; - for(i=0; i < 6; ++i){ - button[i]->setBg(c); - button[i]->repaint(false); - } - repaint(); - titlebar->recalcBuffer(); - titlebar->repaint(false); -} - -void B2Client::unobscureTitlebar() -{ - /* we just noticed, that we got obscured by other windows - so we look at all windows above us (stacking_order) merging their - masks, intersecting it with our titlebar area, and see if we can - find a place not covered by any window */ - if (in_unobs) { - return; - } - in_unobs = 1; - QRegion reg(QRect(0,0,width(),20)); - ClientList::ConstIterator it = workspace()->stackingOrder().find(this); - ++it; - while (it != workspace()->stackingOrder().end()) { - /* the clients all have their mask-regions in local coords - so we have to translate them to a shared coord system - we choose ours */ - int dx = (*it)->x() - x(); - int dy = (*it)->y() - y(); - QRegion creg = (*it)->getMask(); - creg.translate(dx, dy); - reg -= creg; - if (reg.isEmpty()) { - // early out, we are completely obscured - break; - } - ++it; - } - if (!reg.isEmpty()) { - // there is at least _one_ pixel from our title area, which is not - // obscured, we use the first rect we find - // for a first test, we use boundingRect(), later we may refine - // to rect(), and search for the nearest, or biggest, or smthg. - titleMoveAbs(reg.boundingRect().x()); - } - in_unobs = 0; -} - -static void redraw_pixmaps() -{ - QColorGroup aGrp = options->colorGroup(Options::ButtonBg, true); - QColorGroup iGrp = options->colorGroup(Options::ButtonBg, false); - - // close - drawB2Rect(aClosePix, aGrp.button(), false); - drawB2Rect(aClosePixDown, aGrp.button(), true); - - drawB2Rect(iClosePix, iGrp.button(), false); - drawB2Rect(iClosePixDown, iGrp.button(), true); - - // maximize - *aMaxPix = *aClosePix; - aMaxPix->detach(); - *aMaxPixDown = *aClosePixDown; - aMaxPixDown->detach(); - *iMaxPix = *iClosePix; - iMaxPix->detach(); - *iMaxPixDown = *iClosePixDown; - iMaxPixDown->detach(); - - // normalize - KPixmap smallBox; - smallBox.resize(10, 10); - KPixmap largeBox; - largeBox.resize(12, 12); - - drawB2Rect(&smallBox, aGrp.button(), false); - drawB2Rect(&largeBox, aGrp.button(), false); - aNormalizePix->fill(options->color(Options::TitleBar, true)); - bitBlt(aNormalizePix, 3, 3, &largeBox, 0, 0, 12, 12, Qt::CopyROP, true); - bitBlt(aNormalizePix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - bitBlt(aIconifyPix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - drawB2Rect(&smallBox, aGrp.button(), true); - drawB2Rect(&largeBox, aGrp.button(), true); - aNormalizePixDown->fill(options->color(Options::TitleBar, true)); - bitBlt(aNormalizePixDown, 3, 3, &largeBox, 0, 0, 12, 12, Qt::CopyROP, true); - bitBlt(aNormalizePixDown, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - bitBlt(aIconifyPixDown, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - drawB2Rect(&smallBox, iGrp.button(), false); - drawB2Rect(&largeBox, iGrp.button(), false); - iNormalizePix->fill(options->color(Options::TitleBar, false)); - bitBlt(iNormalizePix, 3, 3, &largeBox, 0, 0, 12, 12, Qt::CopyROP, true); - bitBlt(iNormalizePix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - bitBlt(iIconifyPix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - drawB2Rect(&smallBox, iGrp.button(), true); - drawB2Rect(&largeBox, iGrp.button(), true); - iNormalizePixDown->fill(options->color(Options::TitleBar, false)); - bitBlt(iNormalizePixDown, 3, 3, &largeBox, 0, 0, 12, 12, Qt::CopyROP, true); - bitBlt(iNormalizePixDown, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - bitBlt(iIconifyPixDown, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true); - - QPainter p; - // x for close - p.begin(aClosePix); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, close_white_bits, - NULL, NULL, close_dgray_bits, NULL, NULL); - p.end(); - p.begin(aClosePixDown); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, close_white_bits, - NULL, NULL, close_dgray_bits, NULL, NULL); - p.end(); - p.begin(iClosePix); - kColorBitmaps(&p, iGrp, 0, 0, 16, 16, true, close_white_bits, - NULL, NULL, close_dgray_bits, NULL, NULL); - p.end(); - p.begin(iClosePixDown); - kColorBitmaps(&p, iGrp, 0, 0, 16, 16, true, close_white_bits, - NULL, NULL, close_dgray_bits, NULL, NULL); - p.end(); - - // pin - p.begin(aPinupPix); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, pinup_white_bits, - pinup_gray_bits, NULL, pinup_dgray_bits, NULL, NULL); - p.end(); - p.begin(aPinupPixDown); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, pindown_white_bits, - pindown_gray_bits, NULL, pindown_dgray_bits, NULL, NULL); - p.end(); - p.begin(iPinupPix); - kColorBitmaps(&p, iGrp, 0, 0, 16, 16, true, pinup_white_bits, - pinup_gray_bits, NULL, pinup_dgray_bits, NULL, NULL); - p.end(); - p.begin(iPinupPixDown); - kColorBitmaps(&p, iGrp, 0, 0, 16, 16, true, pindown_white_bits, - pindown_gray_bits, NULL, pindown_dgray_bits, NULL, NULL); - p.end(); - - // menu - p.begin(aMenuPix); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, menu_white_bits, - NULL, NULL, menu_dgray_bits, NULL, NULL); - p.end(); - p.begin(aMenuPixDown); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, menu_white_bits, - NULL, NULL, menu_dgray_bits, NULL, NULL); - p.end(); - p.begin(iMenuPix); - kColorBitmaps(&p, iGrp, 0, 0, 16, 16, true, menu_white_bits, - NULL, NULL, menu_dgray_bits, NULL, NULL); - p.end(); - p.begin(iMenuPixDown); - kColorBitmaps(&p, iGrp, 0, 0, 16, 16, true, menu_white_bits, - NULL, NULL, menu_dgray_bits, NULL, NULL); - p.end(); - - // help - p.begin(aHelpPix); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, help_light_bits, - NULL, NULL, help_dark_bits, NULL, NULL); - p.end(); - p.begin(aHelpPixDown); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, help_light_bits, - NULL, NULL, help_dark_bits, NULL, NULL); - p.end(); - p.begin(iHelpPix); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, help_light_bits, - NULL, NULL, help_dark_bits, NULL, NULL); - p.end(); - p.begin(iHelpPixDown); - kColorBitmaps(&p, aGrp, 0, 0, 16, 16, true, help_light_bits, - NULL, NULL, help_dark_bits, NULL, NULL); - p.end(); -} - -void B2Client::positionButtons() -{ - QFontMetrics fm(options->font(isActive())); - - int textLen = fm.width(caption()); - QLayoutIterator it=titlebar->layout()->iterator(); - ++it; - ++it; - ++it; - - int titleWidth=titlebar->width()-(++it)->geometry().width()+textLen+2; - - if( titleWidth > width()) titleWidth=width(); - - titlebar->resize(titleWidth,20); - titlebar->move(bar_x_ofs, 0); -} - -extern "C" -{ - Client *allocate(Workspace *ws, WId w, int) - { - return(new B2Client(ws, w)); - } - void init() - { - create_pixmaps(); - } - void reset() - { - redraw_pixmaps(); - } - void deinit() - { - delete_pixmaps(); - } -} - -#include "b2client.moc" diff --git a/clients/b2/b2client.h b/clients/b2/b2client.h deleted file mode 100644 index b3328fc6c5..0000000000 --- a/clients/b2/b2client.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef __B2CLIENT_H -#define __B2CLIENT_H - -#include -#include -#include -#include "../../client.h" -class QLabel; -//class QSpacerItem; -//class QHBoxLayout; -class QGridLayout; - -namespace KWinInternal { - -class B2Button : public QButton -{ - Q_OBJECT -public: - B2Button(Client *_client=0, QWidget *parent=0, const char *name=0) - : QButton(parent, name){useMiniIcon = false; client = _client;} - B2Button(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix, KPixmap *iPixDown, - Client *_client=0, QWidget *parent=0, const char *name=0); - void setBg(const QColor &c){bg = c;} - void setPixmaps(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix, - KPixmap *iPixDown); - void setToggle(){setToggleType(Toggle);} - void setActive(bool on){setOn(on);} - void setUseMiniIcon(){useMiniIcon = true;} - QSize sizeHint() const; - QSizePolicy sizePolicy() const; -protected: - virtual void drawButton(QPainter *p); - void drawButtonLabel(QPainter *){;} - - bool useMiniIcon; - KPixmap *pNorm, *pDown, *iNorm, *iDown; - QColor bg; //only use one color (the rest is pixmap) so forget QPalette ;) - Client *client; - - void mousePressEvent( QMouseEvent* e ); - void mouseReleaseEvent( QMouseEvent* e ); - -public: - int last_button; -}; - -class B2Client; - -class B2Titlebar : public QWidget -{ - Q_OBJECT -public: - B2Titlebar(B2Client *parent); - ~B2Titlebar(){;} - bool isFullyObscured() const {return isfullyobscured;} - void recalcBuffer(); -protected: - void paintEvent( QPaintEvent* ); - bool x11Event(XEvent *e); - void mouseDoubleClickEvent( QMouseEvent * ); - void mousePressEvent( QMouseEvent * ); - void mouseReleaseEvent( QMouseEvent * ); - void mouseMoveEvent(QMouseEvent *); - void init(); - void resizeEvent(QResizeEvent *ev); - - QString oldTitle; - KPixmap titleBuffer; - bool set_x11mask; - bool isfullyobscured; - bool shift_move; - QPoint moveOffset; - B2Client *client; -}; - -class B2Client : public KWinInternal::Client -{ - Q_OBJECT - friend class B2Titlebar; -public: - B2Client( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); - ~B2Client(){;} - void unobscureTitlebar(); - void titleMoveAbs(int new_ofs); - void titleMoveRel(int xdiff); -protected: - void resizeEvent( QResizeEvent* ); - void paintEvent( QPaintEvent* ); - void showEvent( QShowEvent* ); - void windowWrapperShowEvent( QShowEvent* ); - void init(); - void captionChange( const QString& name ); - void stickyChange(bool on); - void activeChange(bool on); - void maximizeChange(bool m); - void iconChange(); - void doShape(); - MousePosition mousePosition( const QPoint& p ) const; -private slots: - void menuButtonPressed(); - void slotReset(); - void maxButtonClicked(); -private: - void positionButtons(); - enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose, - BtnHelp}; - //B2Button* button[5]; - B2Button* button[6]; - //QSpacerItem* titlebar; - //QHBoxLayout *tLayout; - QGridLayout *g; - int bar_x_ofs; - B2Titlebar *titlebar; - int in_unobs; - -}; - -}; - -#endif diff --git a/clients/b2/bitmaps.h b/clients/b2/bitmaps.h deleted file mode 100644 index 9b7c31f7cc..0000000000 --- a/clients/b2/bitmaps.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __STDCLIENT_BITMAPS_H -#define __STDCLIENT_BITMAPS_H - -/** - * The standard client has the capability to color it's titlebar buttons - * according to the new color scheme. In order to do this it needs a bitmap - * for each shade which it draws into a pixmap with the appropriate color. - * These are all the bitmaps. - */ - -static unsigned char close_white_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x04, 0x10, 0x04, 0x08, 0x08, 0x04, 0x10, 0x02, - 0x20, 0x01, 0x40, 0x00, 0x40, 0x00, 0x20, 0x01, 0x10, 0x02, 0x08, 0x04, - 0x04, 0x08, 0x04, 0x10, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char close_dgray_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x18, 0x30, 0x30, 0x18, 0x60, 0x0c, - 0xc0, 0x06, 0x80, 0x03, 0x80, 0x03, 0xc0, 0x06, 0x60, 0x0c, 0x30, 0x18, - 0x18, 0x30, 0x08, 0x20, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char menu_white_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0x3f, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char menu_dgray_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char menu_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0x3f, 0x04, 0x20, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pindown_white_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x1f, 0xa0, 0x03, - 0xb0, 0x01, 0x30, 0x01, 0xf0, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pindown_gray_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, - 0x00, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x80, 0x07, 0xc0, 0x03, 0xe0, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pindown_dgray_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x10, 0x70, 0x20, 0x50, 0x20, - 0x48, 0x30, 0xc8, 0x38, 0x08, 0x1f, 0x08, 0x18, 0x10, 0x1c, 0x10, 0x0e, - 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pindown_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x1f, 0xf0, 0x3f, 0xf0, 0x3f, - 0xf8, 0x3f, 0xf8, 0x3f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf0, 0x1f, 0xf0, 0x0f, - 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pinup_white_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x11, - 0x3f, 0x15, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pinup_gray_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x0a, 0xbf, 0x0a, 0x80, 0x15, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pinup_dgray_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x40, 0x31, 0x40, 0x2e, - 0x40, 0x20, 0x40, 0x20, 0x7f, 0x2a, 0x40, 0x3f, 0xc0, 0x31, 0xc0, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char pinup_mask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0xc0, 0x31, 0xc0, 0x3f, - 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xc0, 0x3f, 0xc0, 0x31, 0xc0, 0x20, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static unsigned char help_mask_bits[] = { - 0x00,0x00,0x00,0x00,0xe0,0x03,0xf0,0x07,0x70,0x0e,0x60,0x0e,0x00,0x0f,0x80, - 0x07,0xc0,0x03,0xc0,0x01,0x80,0x01,0xc0,0x00,0xc0,0x01,0x80,0x01,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x4c,0x0b,0x08,0x58,0x65,0x09,0x08,0x90,0x00,0x00, - 0x00,0x09,0x04,0x00,0x00,0x72,0x6f,0x6f,0x74,0x00,0x24,0x31,0x24,0x47,0x6b, - 0x65,0x44,0x78,0x63 }; - -static unsigned char help_dark_bits[] = { - 0x00,0x00,0x00,0x00,0xe0,0x03,0x30,0x06,0x30,0x06,0x00,0x06,0x00,0x03,0x80, - 0x01,0xc0,0x00,0xc0,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x65,0x64,0x28,0x29,0x00,0x00,0x00,0x00,0x90,0x00,0x00, - 0x00,0x21,0x00,0x00,0x00,0x34,0xfe,0x12,0x2b,0x00,0x00,0xff,0xff,0x58,0xc0, - 0x01,0x2b,0x45,0xfe }; - -static unsigned char help_light_bits[] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x40,0x08,0x60,0x08,0x00,0x0c,0x00, - 0x06,0x00,0x03,0x00,0x01,0x80,0x01,0x00,0x00,0x00,0x01,0x80,0x01,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x4c,0x0b,0x08,0x58,0x65,0x09,0x08,0x90,0x00,0x00, - 0x00,0x09,0x04,0x00,0x00,0x72,0x6f,0x6f,0x74,0x00,0x24,0x31,0x24,0x47,0x6b, - 0x65,0x44,0x78,0x63 }; - -#endif - diff --git a/clients/kstep/Makefile.am b/clients/kstep/Makefile.am deleted file mode 100644 index 970e90ced2..0000000000 --- a/clients/kstep/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ - -INCLUDES = $(all_includes) - -kde_module_LTLIBRARIES = libkwinkstep.la - -libkwinkstep_la_SOURCES = nextclient.cpp -libkwinkstep_la_LIBADD = ../../kwin.la -libkwinkstep_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) - -METASOURCES = AUTO -noinst_HEADERS = nextclient.h - -lnkdir = $(kde_datadir)/kwin/ -lnk_DATA = kstep.desktop - -EXTRA_DIST = $(lnk_DATA) - - -###KMAKE-start (don't edit or delete this block) - -###KMAKE-end diff --git a/clients/kstep/kstep.desktop b/clients/kstep/kstep.desktop deleted file mode 100644 index 1c89050a8e..0000000000 --- a/clients/kstep/kstep.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=KStep -Name[da]=KDE Trin -Name[eo]=Paŝo -Name[mi]=KHïkoi -Name[no]=KSteg -Name[pt]=Step -Name[sk]=Kkrok -X-KDE-Library=libkwinkstep diff --git a/clients/kstep/nextclient.cpp b/clients/kstep/nextclient.cpp deleted file mode 100644 index eac411ca34..0000000000 --- a/clients/kstep/nextclient.cpp +++ /dev/null @@ -1,391 +0,0 @@ -#include "nextclient.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../workspace.h" -#include "../../options.h" - -using namespace KWinInternal; - - - -static unsigned char close_bits[] = { - 0x03, 0x03, 0x87, 0x03, 0xce, 0x01, 0xfc, 0x00, 0x78, 0x00, 0x78, 0x00, - 0xfc, 0x00, 0xce, 0x01, 0x87, 0x03, 0x03, 0x03}; - -static unsigned char iconify_bits[] = { - 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0xff, 0x03, 0xff, 0x03}; - -static unsigned char sticky_bits[] = { - 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xfe, 0x01, 0xfe, 0x01, - 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00}; - -static unsigned char unsticky_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0xfe, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static KPixmap *aTitlePix=0; -static KPixmap *iTitlePix=0; -static KPixmap *aFramePix=0; -static KPixmap *iFramePix=0; -static KPixmap *aHandlePix=0; -static KPixmap *iHandlePix=0; -static KPixmap *aBtn=0; -static KPixmap *aBtnDown=0; -static KPixmap *iBtn=0; -static KPixmap *iBtnDown=0; -static bool pixmaps_created = false; -static QColor *btnForeground; - -static void create_pixmaps() -{ - if(pixmaps_created) - return; - pixmaps_created = true; - - aTitlePix = new KPixmap(); - aTitlePix->resize(32, 14); - KPixmapEffect::gradient(*aTitlePix, - options->color(Options::TitleBar, true), - options->color(Options::TitleBlend, true), - KPixmapEffect::VerticalGradient); - iTitlePix = new KPixmap(); - iTitlePix->resize(32, 14); - KPixmapEffect::gradient(*iTitlePix, - options->color(Options::TitleBar, false), - options->color(Options::TitleBlend, false), - KPixmapEffect::VerticalGradient); - // Bottom frame gradient - aFramePix = new KPixmap(); - aFramePix->resize(32, 6); - KPixmapEffect::gradient(*aFramePix, - options->color(Options::Frame, true).light(150), - options->color(Options::Frame, true).dark(120), - KPixmapEffect::VerticalGradient); - iFramePix = new KPixmap(); - iFramePix->resize(32, 6); - KPixmapEffect::gradient(*iFramePix, - options->color(Options::Frame, false).light(150), - options->color(Options::Frame, false).dark(120), - KPixmapEffect::VerticalGradient); - - // Handle gradient - aHandlePix = new KPixmap(); - aHandlePix->resize(32, 6); - KPixmapEffect::gradient(*aHandlePix, - options->color(Options::Handle, true).light(150), - options->color(Options::Handle, true).dark(120), - KPixmapEffect::VerticalGradient); - iHandlePix = new KPixmap(); - iHandlePix->resize(32, 6); - KPixmapEffect::gradient(*iHandlePix, - options->color(Options::Handle, false).light(150), - options->color(Options::Handle, false).dark(120), - KPixmapEffect::VerticalGradient); - - iBtn = new KPixmap; - iBtn->resize(18, 18); - iBtnDown = new KPixmap; - iBtnDown->resize(18, 18); - aBtn = new KPixmap; - aBtn->resize(18, 18); - aBtnDown = new KPixmap; - aBtnDown->resize(18, 18); - KPixmap internal; - internal.resize(12, 12); - - // inactive buttons - QColor c(options->color(Options::ButtonBg, false)); - KPixmapEffect::gradient(*iBtn, c.light(120), c.dark(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(internal, c.dark(120), c.light(120), - KPixmapEffect::DiagonalGradient); - bitBlt(iBtn, 3, 3, &internal, 0, 0, 12, 12, Qt::CopyROP, true); - - KPixmapEffect::gradient(*iBtnDown, c.dark(120), c.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(internal, c.light(120), c.dark(120), - KPixmapEffect::DiagonalGradient); - bitBlt(iBtnDown, 3, 3, &internal, 0, 0, 12, 12, Qt::CopyROP, true); - - // active buttons - c = options->color(Options::ButtonBg, true); - KPixmapEffect::gradient(*aBtn, c.light(120), c.dark(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(internal, c.dark(120), c.light(120), - KPixmapEffect::DiagonalGradient); - bitBlt(aBtn, 3, 3, &internal, 0, 0, 12, 12, Qt::CopyROP, true); - - KPixmapEffect::gradient(*aBtnDown, c.dark(120), c.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(internal, c.light(120), c.dark(120), - KPixmapEffect::DiagonalGradient); - bitBlt(aBtnDown, 3, 3, &internal, 0, 0, 12, 12, Qt::CopyROP, true); - - QPainter p; - p.begin(aBtn); - p.setPen(Qt::black); - p.drawRect(0, 0, 18, 18); - p.end(); - p.begin(iBtn); - p.setPen(Qt::black); - p.drawRect(0, 0, 18, 18); - p.end(); - p.begin(aBtnDown); - p.setPen(Qt::black); - p.drawRect(0, 0, 18, 18); - p.end(); - p.begin(iBtnDown); - p.setPen(Qt::black); - p.drawRect(0, 0, 18, 18); - p.end(); - - if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128) - btnForeground = new QColor(Qt::black); - else - btnForeground = new QColor(Qt::white); -} - -static void delete_pixmaps() -{ - delete aTitlePix; - delete iTitlePix; - delete aFramePix; - delete iFramePix; - delete aHandlePix; - delete iHandlePix; - delete aBtn; - delete iBtn; - delete aBtnDown; - delete iBtnDown; - delete btnForeground; - - pixmaps_created = false; -} - -void NextClient::slotReset() -{ - button[0]->reset(); - button[1]->reset(); - button[2]->reset(); -} - -NextButton::NextButton(Client *parent, const char *name, - const unsigned char *bitmap, int bw, int bh) - : QButton(parent, name) -{ - setBackgroundMode( NoBackground ); - client = parent; - resize(18, 18); - - if(bitmap) - setBitmap(bitmap, bw, bh); -} - -void NextButton::reset() -{ - repaint(false); -} - -void NextButton::setBitmap(const unsigned char *bitmap, int w, int h) -{ - deco = QBitmap(w, h, bitmap, true); - deco.setMask(deco); - repaint(); -} - -void NextButton::drawButton(QPainter *p) -{ - if(client->isActive()) - p->drawPixmap(0, 0, isDown() ? *aBtnDown : *aBtn); - else - p->drawPixmap(0, 0, isDown() ? *iBtnDown : *iBtn); - - p->setPen(*btnForeground); - p->drawPixmap(isDown()? 5 : 4, isDown() ? 5 : 4, deco); -} - -NextClient::NextClient( Workspace *ws, WId w, QWidget *parent, - const char *name ) - : Client( ws, w, parent, name, WResizeNoErase ) -{ - setBackgroundMode( NoBackground ); - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - QHBoxLayout *titleLayout = new QHBoxLayout(); - QHBoxLayout *windowLayout = new QHBoxLayout(); - - mainLayout->addLayout(titleLayout); - mainLayout->addLayout(windowLayout, 1); - mainLayout->addSpacing(6); - - windowLayout->addSpacing(1); - windowLayout->addWidget(windowWrapper(), 1); - windowLayout->addSpacing(1); - - - button[0] = new NextButton(this, "close", close_bits, 10, 10); - button[1] = new NextButton(this, "sticky"); - stickyChange(isSticky()); - button[2] = new NextButton(this, "iconify", iconify_bits, 10, 10); - - connect( button[0], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) ); - connect( button[1], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) ); - connect( button[2], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) ); - titleLayout->addWidget( button[2] ); - titlebar = new QSpacerItem(10, 16, QSizePolicy::Expanding, - QSizePolicy::Minimum ); - titleLayout->addItem(titlebar); - titleLayout->addWidget( button[1] ); - titleLayout->addWidget( button[0] ); - for ( int i = 0; i < 3; i++) { - button[i]->setMouseTracking( TRUE ); - button[i]->setFixedSize( 18, 18 ); - } - -} - -void NextClient::resizeEvent( QResizeEvent* e) -{ - Client::resizeEvent( e ); - - if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) { - QPainter p( this ); - QRect t = titlebar->geometry(); - t.setTop( 0 ); - QRegion r = rect(); - r = r.subtract( t ); - p.setClipRegion( r ); - p.eraseRect( rect() ); - } -} - -void NextClient::captionChange( const QString& ) -{ - repaint( titlebar->geometry(), false ); -} - - -void NextClient::paintEvent( QPaintEvent* ) -{ - QPainter p( this ); - p.setPen(Qt::black); - p.drawRect(rect()); - - QRect t = titlebar->geometry(); - t.setTop(1); - p.drawTiledPixmap(t.x()+1, t.y()+1, t.width()-2, t.height()-2, - isActive() ? *aTitlePix : *iTitlePix); - qDrawShadePanel(&p, t.x(), t.y(), t.width(), t.height()-1, - options->colorGroup(Options::TitleBar, isActive())); - p.drawLine(t.x(), t.bottom(), t.right(), t.bottom()); - QRegion r = rect(); - r = r.subtract( t ); - p.setClipRegion( r ); - p.setClipping( FALSE ); - - t.setTop( 2 ); - t.setHeight(t.height()-4); - t.setLeft( t.left() + 4 ); - t.setRight( t.right() - 2 ); - - p.setPen(options->color(Options::Font, isActive())); - p.setFont(options->font(isActive())); - p.drawText( t, AlignCenter, caption() ); - - - qDrawShadePanel(&p, rect().x()+1, rect().bottom()-6, 24, 6, - options->colorGroup(Options::Handle, isActive()), false); - p.drawTiledPixmap(rect().x()+2, rect().bottom()-5, 22, 4, - isActive() ? *aHandlePix : *iHandlePix); - - qDrawShadePanel(&p, rect().x()+25, rect().bottom()-6, rect().width()-50, 6, - options->colorGroup(Options::Frame, isActive()), false); - p.drawTiledPixmap(rect().x()+26, rect().bottom()-5, rect().width()-52, 4, - isActive() ? *aFramePix : *iFramePix); - - qDrawShadePanel(&p, rect().right()-24, rect().bottom()-6, 24, 6, - options->colorGroup(Options::Handle, isActive()), false); - p.drawTiledPixmap(rect().right()-23, rect().bottom()-5, 22, 4, - isActive() ? *aHandlePix : *iHandlePix); -} - -void NextClient::mouseDoubleClickEvent( QMouseEvent * e ) -{ - if (titlebar->geometry().contains( e->pos() ) ) - workspace()->performWindowOperation( this, options->operationTitlebarDblClick() ); - workspace()->requestFocus( this ); -} - -void NextClient::stickyChange(bool on) -{ - if(on) - button[1]->setBitmap(unsticky_bits, 10, 10); - else - button[1]->setBitmap(sticky_bits, 10, 10); -} - - -void NextClient::init() -{ - Client::init(); -} - -void NextClient::activeChange(bool) -{ - repaint(false); - button[0]->reset(); - button[1]->reset(); - button[2]->reset(); -} - - Client::MousePosition -NextClient::mousePosition( const QPoint& p ) const -{ - MousePosition m = Nowhere; - - if (p.y() < (height() - 6)) - m = Client::mousePosition(p); - - else { - if (p.x() >= (width() - 25)) - m = BottomRight; - else if (p.x() <= 25) - m = BottomLeft; - else - m = Bottom; - } - - return m; -} - -extern "C" -{ - Client *allocate(Workspace *ws, WId w, int ) - { - return(new NextClient(ws, w)); - } - void init() - { - create_pixmaps(); - } - void reset() - { - delete_pixmaps(); - create_pixmaps(); - } - void deinit() - { - delete_pixmaps(); - } -} - -#include "nextclient.moc" diff --git a/clients/kstep/nextclient.h b/clients/kstep/nextclient.h deleted file mode 100644 index ad0ca28781..0000000000 --- a/clients/kstep/nextclient.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __NEXTCLIENT_H -#define __NEXTCLIENT_H - -#include -#include -#include -#include "../../client.h" -class QLabel; -class QSpacerItem; - -namespace KWinInternal { - -// get rid of autohide :P -class NextButton : public QButton -{ -public: - NextButton(Client *parent=0, const char *name=0, - const unsigned char *bitmap=NULL, int bw=0, int bh=0); - void setBitmap(const unsigned char *bitmap, int bw, int bh); - void reset(); -protected: - virtual void drawButton(QPainter *p); - void drawButtonLabel(QPainter *){;} - KPixmap aBackground, iBackground; - QBitmap deco; - Client *client; -}; - -class NextClient : public KWinInternal::Client -{ - Q_OBJECT -public: - NextClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); - ~NextClient(){;} -protected: - void resizeEvent( QResizeEvent* ); - void paintEvent( QPaintEvent* ); - - void mouseDoubleClickEvent( QMouseEvent * ); - void init(); - void captionChange( const QString& name ); - void stickyChange(bool on); - void activeChange(bool); - - MousePosition mousePosition(const QPoint &) const; - -protected slots: - void slotReset(); -private: - NextButton* button[3]; - QSpacerItem* titlebar; -}; - -}; - -#endif diff --git a/clients/kwmtheme/Makefile.am b/clients/kwmtheme/Makefile.am deleted file mode 100644 index 8ea3d19975..0000000000 --- a/clients/kwmtheme/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -SUBDIRS=cli_installer -INCLUDES = $(all_includes) - -kde_module_LTLIBRARIES = libkwinkwmtheme.la - -libkwinkwmtheme_la_SOURCES = kwmthemeclient.cpp -libkwinkwmtheme_la_LIBADD = ../../kwin.la -libkwinkwmtheme_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) - -METASOURCES = AUTO -noinst_HEADERS = kwmthemeclient.h diff --git a/clients/kwmtheme/cli_installer/Makefile.am b/clients/kwmtheme/cli_installer/Makefile.am deleted file mode 100644 index feb31c424b..0000000000 --- a/clients/kwmtheme/cli_installer/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ - -# set the include path for X, qt and KDE -INCLUDES= $(all_includes) - -####### This part is very kwmtheme specific -# you can add here more. This one gets installed -bin_PROGRAMS = kwmtheme - -# Which sources should be compiled for kwmtheme. -kwmtheme_SOURCES = main.cpp - -# the library search path. -kwmtheme_LDFLAGS = $(all_libraries) $(KDE_RPATH) - -# the libraries to link against. Be aware of the order. First the libraries, -# that depend on the following ones. -kwmtheme_LDADD = $(LIB_KDECORE) - diff --git a/clients/kwmtheme/cli_installer/main.cpp b/clients/kwmtheme/cli_installer/main.cpp deleted file mode 100644 index 25806a49ad..0000000000 --- a/clients/kwmtheme/cli_installer/main.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -static const char *description = - I18N_NOOP("Installs a KWM theme"); - -static KCmdLineOptions options[] = -{ - { "+[file]", I18N_NOOP("Path to a theme config file"), 0 }, - { 0, 0, 0 } -}; - -void copy(const QString &src, const QString &dest) -{ - QFile copyInput(src); - QFile copyOutput(dest); - if(!copyInput.open(IO_ReadOnly)){ - qWarning("Couldn't open %s", src.latin1()); - return; - } - if(!copyOutput.open(IO_WriteOnly)){ - qWarning("Couldn't open %s", dest.latin1()); - copyInput.close(); - return; - } - while(!copyInput.atEnd()){ - copyOutput.putch(copyInput.getch()); - } - copyInput.close(); - copyOutput.close(); -} - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc, argv, "kwmtheme", description, "0.1"); - KCmdLineArgs::addCmdLineOptions( options ); - KApplication app(argc, argv); - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if(!args->count()){ - qWarning("You need to specify the path to a theme config file!"); - return(1); - } - - QString srcStr = QString(QFile::decodeName(args->arg(0))); - QFile f(srcStr); - QString tmpStr; - - if(!f.exists()){ - qWarning("Specified theme config file doesn't exist!"); - return(2); - } - - QStringList appDirs = KGlobal::dirs()->findDirs("data", "kwin"); - QString localDirStr = *(appDirs.end()); - if(localDirStr.isEmpty()){ - localDirStr = KGlobal::dirs()->saveLocation("data", "kwin"); - } - localDirStr += "/pics/"; - if(!QFile::exists(localDirStr)) - QDir().mkdir(localDirStr); - - QFileInfo fi(f); - KSimpleConfig input(fi.absFilePath()); - srcStr = fi.dirPath(true) + "/"; - KConfig *output = KGlobal::config(); - input.setGroup("Window Border"); - output->setGroup("General"); - - tmpStr = input.readEntry("shapePixmapTop"); - if(!tmpStr.isEmpty()){ - copy(srcStr+tmpStr, localDirStr+tmpStr); - } - output->writeEntry("wm_top", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapBottom"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_bottom", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapLeft"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_left", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapRight"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_right", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapTopLeft"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_topleft", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapTopRight"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_topright", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapBottomLeft"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_bottomleft", tmpStr, true, true); - tmpStr = input.readEntry("shapePixmapBottomRight"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("wm_bottomright", tmpStr, true, true); - - - input.setGroup("Window Titlebar"); - output->writeEntry("TitleAlignment", input.readEntry("TitleAlignment"), true, true); - output->writeEntry("PixmapUnderTitleText", input.readEntry("PixmapUnderTitleText"), true, true); - output->writeEntry("TitleFrameShaded", input.readEntry("TitleFrameShaded"), true, true); - - tmpStr = input.readEntry("MenuButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("menu", tmpStr, true, true); - tmpStr = input.readEntry("PinUpButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("pinup", tmpStr, true, true); - tmpStr = input.readEntry("PinDownButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("pindown", tmpStr, true, true); - tmpStr = input.readEntry("CloseButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("close", tmpStr, true, true); - tmpStr = input.readEntry("MaximizeButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("maximize", tmpStr, true, true); - tmpStr = input.readEntry("MaximizeDownButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("maximizedown", tmpStr, true, true); - tmpStr = input.readEntry("MinimizeButton"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("iconify", tmpStr, true, true); - tmpStr = input.readEntry("TitlebarPixmapActive"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("TitlebarPixmapActive", tmpStr, true, true); - tmpStr = input.readEntry("TitlebarPixmapInactive"); - if(!tmpStr.isEmpty()) - copy(srcStr+tmpStr, localDirStr+tmpStr); - output->writeEntry("TitlebarPixmapInactive", tmpStr, true, true); - - input.setGroup("Window Button Layout"); - output->setGroup("Buttons"); - output->writeEntry("ButtonA", input.readEntry("ButtonA"), true, true); - output->writeEntry("ButtonB", input.readEntry("ButtonB"), true, true); - output->writeEntry("ButtonC", input.readEntry("ButtonC"), true, true); - output->writeEntry("ButtonD", input.readEntry("ButtonD"), true, true); - output->writeEntry("ButtonE", input.readEntry("ButtonE"), true, true); - output->writeEntry("ButtonF", input.readEntry("ButtonF"), true, true); - - output->sync(); - - return(0); -} - diff --git a/clients/kwmtheme/kwmtheme.desktop b/clients/kwmtheme/kwmtheme.desktop deleted file mode 100644 index a81efde064..0000000000 --- a/clients/kwmtheme/kwmtheme.desktop +++ /dev/null @@ -1,41 +0,0 @@ -[Desktop Entry] -Name=KWM Theme -Name[ca]=Tema KWM -Name[cs]=Téma KWM -Name[da]=KWM tema -Name[de]=KWM-Design -Name[el]=Θέμα KWM -Name[eo]=KWM-etoso -Name[es]=Tema KWM -Name[et]=KWM teema -Name[fi]=KWM-teema -Name[fr]=Thème KWM -Name[gl]=Tema do KWM -Name[hr]=KWM Tema -Name[hu]=KWM téma -Name[is]=KWM þema -Name[it]=Tema KWM -Name[ja]=KWMテーマ -Name[ko]=KWM 테마 -Name[lt]=KWM Tema -Name[lv]=KWM Tēma -Name[mi]=Kaupapa KWM -Name[mk]=KWM тема -Name[nl]=KWM-thema -Name[no]=KWM-tema -Name[no_NY]=KWM-tema -Name[oc]=Tema KWM -Name[pl]=Motyw KWM -Name[pt]=Tema do kwm -Name[pt_BR]=Tema KWM -Name[ro]=Temă KWM -Name[ru]=Стиль KWM -Name[sk]=Témy KWM -Name[sl]=Tema za KWM -Name[sr]=KWM Tema -Name[sv]=KWM-tema -Name[tr]=KWM Teması -Name[uk]=Тема KWM -Name[zh_CN.GB2312]=KWM 主题 -Name[zh_TW.Big5]=KWM 佈景 -X-KDE-Library=libkwinkwmtheme diff --git a/clients/kwmtheme/kwmthemeclient.cpp b/clients/kwmtheme/kwmthemeclient.cpp deleted file mode 100644 index bbc3055030..0000000000 --- a/clients/kwmtheme/kwmthemeclient.cpp +++ /dev/null @@ -1,833 +0,0 @@ -#include -#include "kwmthemeclient.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../workspace.h" -#include "../../options.h" - - -using namespace KWinInternal; - - -static QPixmap stretchPixmap(QPixmap& src, bool stretchVert){ - QPixmap dest; - QBitmap *srcMask, *destMask; - int w, h, w2, h2; - QPainter p; - - if (src.isNull()) return src; - - w = src.width(); - h = src.height(); - - if (stretchVert){ - w2 = w; - for (h2=h; h2<100; h2=h2<<1) - ; - } - else{ - h2 = h; - for (w2=w; w2<100; w2=w2<<1) - ; - } - if (w2==w && h2==h) return src; - - dest = src; - dest.resize(w2, h2); - - p.begin(&dest); - p.drawTiledPixmap(0, 0, w2, h2, src); - p.end(); - - srcMask = (QBitmap*)src.mask(); - if (srcMask){ - destMask = (QBitmap*)dest.mask(); - p.begin(destMask); - p.drawTiledPixmap(0, 0, w2, h2, *srcMask); - p.end(); - } - return dest; -} - - - -enum FramePixmap{FrameTop=0, FrameBottom, FrameLeft, FrameRight, FrameTopLeft, - FrameTopRight, FrameBottomLeft, FrameBottomRight}; - -static QPixmap *framePixmaps[8]; -static QPixmap *menuPix, *iconifyPix, *closePix, *maxPix, *minmaxPix, - *pinupPix, *pindownPix; -static KPixmap *aTitlePix = 0; -static KPixmap *iTitlePix = 0; -static KPixmapEffect::GradientType grType; -static int maxExtent, titleAlign; -static bool titleGradient = true; -static bool pixmaps_created = false; -static bool titleSunken = false; -static bool titleTransparent; - -static void create_pixmaps() -{ - const char *keys[] = {"wm_top", "wm_bottom", "wm_left", "wm_right", - "wm_topleft", "wm_topright", "wm_bottomleft", "wm_bottomright"}; - - if(pixmaps_created) - return; - pixmaps_created = true; - - KConfig *config = KGlobal::config(); - config->setGroup("General"); - QString tmpStr; - - for(int i=0; i < 8; ++i) - { - framePixmaps[i] = new QPixmap(locate("appdata", - "pics/"+config->readEntry(keys[i], " "))); - if(framePixmaps[i]->isNull()) - qWarning("Unable to load frame pixmap for %s", keys[i]); - } - - *framePixmaps[FrameTop] = stretchPixmap(*framePixmaps[FrameTop], false); - *framePixmaps[FrameBottom] = stretchPixmap(*framePixmaps[FrameBottom], false); - *framePixmaps[FrameLeft] = stretchPixmap(*framePixmaps[FrameLeft], true); - *framePixmaps[FrameRight] = stretchPixmap(*framePixmaps[FrameRight], true); - - maxExtent = framePixmaps[FrameTop]->height(); - if(framePixmaps[FrameBottom]->height() > maxExtent) - maxExtent = framePixmaps[FrameBottom]->height(); - if(framePixmaps[FrameLeft]->width() > maxExtent) - maxExtent = framePixmaps[FrameLeft]->width(); - if(framePixmaps[FrameRight]->width() > maxExtent) - maxExtent = framePixmaps[FrameRight]->width(); - - menuPix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("menu", " "))); - iconifyPix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("iconify", " "))); - maxPix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("maximize", " "))); - minmaxPix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("maximizedown", " "))); - closePix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("close", " "))); - pinupPix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("pinup", " "))); - pindownPix = new QPixmap(locate("appdata", - "pics/"+config->readEntry("pindown", " "))); - if(menuPix->isNull()) - menuPix->load(locate("appdata", "pics/menu.png")); - if(iconifyPix->isNull()) - iconifyPix->load(locate("appdata", "pics/iconify.png")); - if(maxPix->isNull()) - maxPix->load(locate("appdata", "pics/maximize.png")); - if(minmaxPix->isNull()) - minmaxPix->load(locate("appdata", "pics/maximizedown.png")); - if(closePix->isNull()) - closePix->load(locate("appdata", "pics/close.png")); - if(pinupPix->isNull()) - pinupPix->load(locate("appdata", "pics/pinup.png")); - if(pindownPix->isNull()) - pindownPix->load(locate("appdata", "pics/pindown.png")); - - tmpStr = config->readEntry("TitleAlignment"); - if(tmpStr == "right") - titleAlign = Qt::AlignRight | Qt::AlignVCenter; - else if(tmpStr == "middle") - titleAlign = Qt::AlignCenter; - else - titleAlign = Qt::AlignLeft | Qt::AlignVCenter; - titleSunken = config->readBoolEntry("TitleFrameShaded", true); - // titleSunken = true; // is this fixed? - titleTransparent = config->readBoolEntry("PixmapUnderTitleText", true); - - tmpStr = config->readEntry("TitlebarLook"); - if(tmpStr == "shadedVertical"){ - aTitlePix = new KPixmap; - aTitlePix->resize(32, 20); - KPixmapEffect::gradient(*aTitlePix, - options->color(Options::TitleBar, true), - options->color(Options::TitleBlend, true), - KPixmapEffect::VerticalGradient); - iTitlePix = new KPixmap; - iTitlePix->resize(32, 20); - KPixmapEffect::gradient(*iTitlePix, - options->color(Options::TitleBar, false), - options->color(Options::TitleBlend, false), - KPixmapEffect::VerticalGradient); - titleGradient = false; // we can just tile this - - } - else if(tmpStr == "shadedHorizontal") - grType = KPixmapEffect::HorizontalGradient; - else if(tmpStr == "shadedDiagonal") - grType = KPixmapEffect::DiagonalGradient; - else if(tmpStr == "shadedCrossDiagonal") - grType = KPixmapEffect::CrossDiagonalGradient; - else if(tmpStr == "shadedPyramid") - grType = KPixmapEffect::PyramidGradient; - else if(tmpStr == "shadedRectangle") - grType = KPixmapEffect::RectangleGradient; - else if(tmpStr == "shadedPipeCross") - grType = KPixmapEffect::PipeCrossGradient; - else if(tmpStr == "shadedElliptic") - grType = KPixmapEffect::EllipticGradient; - else{ - titleGradient = false; - tmpStr = config->readEntry("TitlebarPixmapActive", ""); - if(!tmpStr.isEmpty()){ - aTitlePix = new KPixmap; - aTitlePix->load(locate("appdata", "pics/" + tmpStr)); - } - else - aTitlePix = NULL; - tmpStr = config->readEntry("TitlebarPixmapInactive", ""); - if(!tmpStr.isEmpty()){ - iTitlePix = new KPixmap; - iTitlePix->load(locate("appdata", "pics/" + tmpStr)); - } - else - iTitlePix = NULL; - } -} - -static void delete_pixmaps() -{ - for(int i=0; i < 8; ++i) - delete framePixmaps[i]; - - delete menuPix; - delete iconifyPix; - delete closePix; - delete maxPix; - delete minmaxPix; - delete pinupPix; - delete pindownPix; - delete aTitlePix; - aTitlePix = 0; - delete iTitlePix; - iTitlePix = 0; - - titleGradient = true; - pixmaps_created = false; - titleSunken = false; -} - -void KWMThemeClient::slotReset() -{ - -} - -void MyButton::drawButtonLabel(QPainter *p) -{ - if(pixmap()){ - // If we have a theme who's button covers the entire width or - // entire height, we shift down/right by 1 pixel so we have - // some visual notification of button presses. i.e. for MGBriezh - int offset = (isDown() && ((pixmap()->width() >= width()) || - (pixmap()->height() >= height()))) ? 1 : 0; - style().drawItem(p, offset, offset, width(), height(), - AlignCenter, colorGroup(), - true, pixmap(), QString::null); - } -} - -KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent, - const char *name ) - : Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity) -{ - stickyBtn = maxBtn = mnuBtn = 0; - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - layout = new QGridLayout(this); - layout->addColSpacing(0, maxExtent); - layout->addColSpacing(2, maxExtent); - - layout->addRowSpacing(0, maxExtent); - - layout->addItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, - QSizePolicy::Expanding)); - - layout->addWidget(windowWrapper(), 2, 1); - // Without the next line, shading flickers - layout->addItem( new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding) ); - layout->addRowSpacing(3, maxExtent); - layout->setRowStretch(2, 10); - layout->setColStretch(1, 10); - - QHBoxLayout* hb = new QHBoxLayout; - layout->addLayout( hb, 1, 1 ); - - KConfig *config = KGlobal::config(); - config->setGroup("Buttons"); - QString val; - MyButton *btn; - int i; - static const char *defaultButtons[]={"Menu","Sticky","Off","Iconify", - "Maximize","Close"}; - static const char keyOffsets[]={"ABCDEF"}; - for(i=0; i < 6; ++i){ - if(i == 3){ - titlebar = new QSpacerItem(10, 20, QSizePolicy::Expanding, - QSizePolicy::Minimum ); - hb->addItem( titlebar ); - } - QString key("Button"); - key += QChar(keyOffsets[i]); - val = config->readEntry(key, defaultButtons[i]); - if(val == "Menu"){ - mnuBtn = new MyButton(this, "menu"); - iconChange(); - hb->addWidget(mnuBtn); - mnuBtn->setFixedSize(20, 20); - connect(mnuBtn, SIGNAL(pressed()), this, - SLOT(menuButtonPressed())); - } - else if(val == "Sticky"){ - stickyBtn = new MyButton(this, "sticky"); - if (isSticky()) - stickyBtn->setPixmap(*pindownPix); - else - stickyBtn->setPixmap(*pinupPix); - connect(stickyBtn, SIGNAL( clicked() ), this, SLOT(toggleSticky())); - hb->addWidget(stickyBtn); - stickyBtn->setFixedSize(20, 20); - } - else if((val == "Iconify") && isMinimizable()){ - btn = new MyButton(this, "iconify"); - btn->setPixmap(*iconifyPix); - connect(btn, SIGNAL(clicked()), this, SLOT(iconify())); - hb->addWidget(btn); - btn->setFixedSize(20, 20); - } - else if((val == "Maximize") && isMaximizable()){ - maxBtn = new MyButton(this, "max"); - maxBtn->setPixmap(*maxPix); - connect(maxBtn, SIGNAL(clicked()), this, SLOT(maximize())); - hb->addWidget(maxBtn); - maxBtn->setFixedSize(20, 20); - } - else if(val == "Close"){ - btn = new MyButton(this, "close"); - btn->setPixmap(*closePix); - connect(btn, SIGNAL(clicked()), this, SLOT(closeWindow())); - hb->addWidget(btn); - btn->setFixedSize(20, 20); - } - else{ - if((val != "Off") && - ((val == "Iconify") && !isMinimizable()) && - ((val == "Maximize") && !isMaximizable())) - qWarning("KWin: Unrecognized button value: %s", val.latin1()); - - } - } - if(titleGradient){ - aGradient = new KPixmap; - iGradient = new KPixmap; - } - else{ - aGradient = 0; - iGradient = 0; - } - setBackgroundMode(NoBackground); -} - -void KWMThemeClient::drawTitle(QPainter &dest) -{ - QRect titleRect = titlebar->geometry(); - QRect r(0, 0, titleRect.width(), titleRect.height()); - QPixmap buffer; - - if(buffer.width() == r.width()) - return; - - buffer.resize(r.size()); - QPainter p; - p.begin(&buffer); - - if(titleSunken){ - qDrawShadeRect(&p, r, options->colorGroup(Options::Frame, isActive()), - true, 1, 0); - r.setRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2); - } - - KPixmap *fill = isActive() ? aTitlePix : iTitlePix; - if(fill) - p.drawTiledPixmap(r, *fill); - else if(titleGradient){ - fill = isActive() ? aGradient : iGradient; - if(fill->width() != r.width()){ - fill->resize(r.width(), 20); - KPixmapEffect::gradient(*fill, - options->color(Options::TitleBar, isActive()), - options->color(Options::TitleBlend, isActive()), - grType); - } - p.drawTiledPixmap(r, *fill); - } - else{ - p.fillRect(r, options->colorGroup(Options::TitleBar, isActive()). - brush(QColorGroup::Button)); - } - p.setFont(options->font(isActive())); - p.setPen(options->color(Options::Font, isActive())); - // Add left & right margin - r.setLeft(r.left()+5); - r.setRight(r.right()-5); - p.drawText(r, titleAlign, caption()); - p.end(); - - dest.drawPixmap(titleRect.x(), titleRect.y(), buffer); -} - - -void KWMThemeClient::resizeEvent( QResizeEvent* e) -{ - Client::resizeEvent( e ); - doShape(); - repaint(); -} - -void KWMThemeClient::captionChange( const QString& ) -{ - repaint( titlebar->geometry(), false ); -} - -void KWMThemeClient::paintEvent( QPaintEvent *) -{ - QPainter p; - p.begin(this); - int x,y; - // first the corners - int w1 = framePixmaps[FrameTopLeft]->width(); - int h1 = framePixmaps[FrameTopLeft]->height(); - if (w1 > width()/2) w1 = width()/2; - if (h1 > height()/2) h1 = height()/2; - p.drawPixmap(0,0,*framePixmaps[FrameTopLeft], - 0,0,w1, h1); - int w2 = framePixmaps[FrameTopRight]->width(); - int h2 = framePixmaps[FrameTopRight]->height(); - if (w2 > width()/2) w2 = width()/2; - if (h2 > height()/2) h2 = height()/2; - p.drawPixmap(width()-w2,0,*framePixmaps[FrameTopRight], - framePixmaps[FrameTopRight]->width()-w2,0,w2, h2); - - int w3 = framePixmaps[FrameBottomLeft]->width(); - int h3 = framePixmaps[FrameBottomLeft]->height(); - if (w3 > width()/2) w3 = width()/2; - if (h3 > height()/2) h3 = height()/2; - p.drawPixmap(0,height()-h3,*framePixmaps[FrameBottomLeft], - 0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3); - - int w4 = framePixmaps[FrameBottomRight]->width(); - int h4 = framePixmaps[FrameBottomRight]->height(); - if (w4 > width()/2) w4 = width()/2; - if (h4 > height()/2) h4 = height()/2; - p.drawPixmap(width()-w4,height()-h4,*(framePixmaps[FrameBottomRight]), - framePixmaps[FrameBottomRight]->width()-w4, - framePixmaps[FrameBottomRight]->height()-h4, - w4, h4); - - QPixmap pm; - QWMatrix m; - int n,s,w; - //top - pm = *framePixmaps[FrameTop]; - - if (pm.width() > 0){ - s = width()-w2-w1; - n = s/pm.width(); - w = n>0?s/n:s; - m.reset(); - m.scale(w/(float)pm.width(), 1); - pm = pm.xForm(m); - - x = w1; - while (1){ - if (pm.width() < width()-w2-x){ - p.drawPixmap(x,maxExtent-pm.height()-1, - pm); - x += pm.width(); - } - else { - p.drawPixmap(x,maxExtent-pm.height()-1, - pm, - 0,0,width()-w2-x,pm.height()); - break; - } - } - } - - //bottom - pm = *framePixmaps[FrameBottom]; - - if (pm.width() > 0){ - s = width()-w4-w3; - n = s/pm.width(); - w = n>0?s/n:s; - m.reset(); - m.scale(w/(float)pm.width(), 1); - pm = pm.xForm(m); - - x = w3; - while (1){ - if (pm.width() < width()-w4-x){ - p.drawPixmap(x,height()-maxExtent+1,pm); - x += pm.width(); - } - else { - p.drawPixmap(x,height()-maxExtent+1,pm, - 0,0,width()-w4-x,pm.height()); - break; - } - } - } - - //left - pm = *framePixmaps[FrameLeft]; - - if (pm.height() > 0){ - s = height()-h3-h1; - n = s/pm.height(); - w = n>0?s/n:s; - m.reset(); - m.scale(1, w/(float)pm.height()); - pm = pm.xForm(m); - - y = h1; - while (1){ - if (pm.height() < height()-h3-y){ - p.drawPixmap(maxExtent-pm.width()-1, y, - pm); - y += pm.height(); - } - else { - p.drawPixmap(maxExtent-pm.width()-1, y, - pm, - 0,0, pm.width(), - height()-h3-y); - break; - } - } - } - - //right - pm = *framePixmaps[FrameRight]; - - if (pm.height() > 0){ - s = height()-h4-h2; - n = s/pm.height(); - w = n>0?s/n:s; - m.reset(); - m.scale(1, w/(float)pm.height()); - pm = pm.xForm(m); - - y = h2; - while (1){ - if (pm.height() < height()-h4-y){ - p.drawPixmap(width()-maxExtent+1, y, - pm); - y += pm.height(); - } - else { - p.drawPixmap(width()-maxExtent+1, y, - pm, - 0,0, pm.width(), - height()-h4-y); - break; - } - } - } - drawTitle(p); - - QColor c = colorGroup().background(); - - // KWM evidently had a 1 pixel border around the client window. We - // emulate it here, but should be removed at some point in order to - // seamlessly mesh widget themes - p.setPen(c); - p.drawRect(maxExtent-1, maxExtent-1, width()-(maxExtent-1)*2, - height()-(maxExtent-1)*2); - - // We fill the area behind the wrapped widget to ensure that - // shading animation is drawn as smoothly as possible - QRect r(layout->cellGeometry(2, 1)); - p.fillRect( r.x(), r.y(), r.width(), r.height(), c); - p.end(); -} - -void KWMThemeClient::doShape() -{ - - QBitmap shapemask(width(), height()); - shapemask.fill(color0); - QPainter p; - p.begin(&shapemask); - p.setBrush(color1); - p.setPen(color1); - int x,y; - // first the corners - int w1 = framePixmaps[FrameTopLeft]->width(); - int h1 = framePixmaps[FrameTopLeft]->height(); - if (w1 > width()/2) w1 = width()/2; - if (h1 > height()/2) h1 = height()/2; - p.drawPixmap(0,0,*framePixmaps[FrameTopLeft]->mask(), - 0,0,w1, h1); - int w2 = framePixmaps[FrameTopRight]->width(); - int h2 = framePixmaps[FrameTopRight]->height(); - if (w2 > width()/2) w2 = width()/2; - if (h2 > height()/2) h2 = height()/2; - p.drawPixmap(width()-w2,0,*framePixmaps[FrameTopRight]->mask(), - framePixmaps[FrameTopRight]->width()-w2,0,w2, h2); - - int w3 = framePixmaps[FrameBottomLeft]->width(); - int h3 = framePixmaps[FrameBottomLeft]->height(); - if (w3 > width()/2) w3 = width()/2; - if (h3 > height()/2) h3 = height()/2; - p.drawPixmap(0,height()-h3,*framePixmaps[FrameBottomLeft]->mask(), - 0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3); - - int w4 = framePixmaps[FrameBottomRight]->width(); - int h4 = framePixmaps[FrameBottomRight]->height(); - if (w4 > width()/2) w4 = width()/2; - if (h4 > height()/2) h4 = height()/2; - p.drawPixmap(width()-w4,height()-h4,*framePixmaps[FrameBottomRight]->mask(), - framePixmaps[FrameBottomRight]->width()-w4, - framePixmaps[FrameBottomRight]->height()-h4, - w4, h4); - - QPixmap pm; - QWMatrix m; - int n,s,w; - //top - pm = *framePixmaps[FrameTop]->mask(); - - s = width()-w2-w1; - n = s/pm.width(); - w = n>0?s/n:s; - m.reset(); - m.scale(w/(float)pm.width(), 1); - pm = pm.xForm(m); - - x = w1; - while (1){ - if (pm.width() < width()-w2-x){ - p.drawPixmap(x,maxExtent-pm.height()-1, - pm); - x += pm.width(); - } - else { - p.drawPixmap(x,maxExtent-pm.height()-1, - pm, - 0,0,width()-w2-x,pm.height()); - break; - } - } - - //bottom - pm = *framePixmaps[FrameBottom]->mask(); - - s = width()-w4-w3; - n = s/pm.width(); - w = n>0?s/n:s; - m.reset(); - m.scale(w/(float)pm.width(), 1); - pm = pm.xForm(m); - - x = w3; - while (1){ - if (pm.width() < width()-w4-x){ - p.drawPixmap(x,height()-maxExtent+1,pm); - x += pm.width(); - } - else { - p.drawPixmap(x,height()-maxExtent+1,pm, - 0,0,width()-w4-x,pm.height()); - break; - } - } - - //left - pm = *framePixmaps[FrameLeft]->mask(); - - s = height()-h3-h1; - n = s/pm.height(); - w = n>0?s/n:s; - m.reset(); - m.scale(1, w/(float)pm.height()); - pm = pm.xForm(m); - - y = h1; - while (1){ - if (pm.height() < height()-h3-y){ - p.drawPixmap(maxExtent-pm.width()-1, y, - pm); - y += pm.height(); - } - else { - p.drawPixmap(maxExtent-pm.width()-1, y, - pm, - 0,0, pm.width(), - height()-h3-y); - break; - } - } - - //right - pm = *framePixmaps[FrameRight]->mask(); - - s = height()-h4-h2; - n = s/pm.height(); - w = n>0?s/n:s; - m.reset(); - m.scale(1, w/(float)pm.height()); - pm = pm.xForm(m); - - y = h2; - while (1){ - if (pm.height() < height()-h4-y){ - p.drawPixmap(width()-maxExtent+1, y, - pm); - y += pm.height(); - } - else { - p.drawPixmap(width()-maxExtent+1, y, - pm, - 0,0, pm.width(), - height()-h4-y); - break; - } - } - p.fillRect(maxExtent-1, maxExtent-1, width()-2*maxExtent+2, height()-2*maxExtent+2, color1); - setMask(shapemask); -} - - -void KWMThemeClient::showEvent(QShowEvent *ev) -{ - Client::showEvent(ev); - doShape(); - repaint(false); -} - -void KWMThemeClient::windowWrapperShowEvent( QShowEvent* ) -{ - doShape(); -} - -void KWMThemeClient::mouseDoubleClickEvent( QMouseEvent * e ) -{ - if (titlebar->geometry().contains( e->pos() ) ) - setShade( !isShade() ); - workspace()->requestFocus( this ); -} - -void KWMThemeClient::stickyChange(bool on) -{ - if (stickyBtn) - stickyBtn->setPixmap(on ? *pindownPix : *pinupPix); -} - -void KWMThemeClient::maximizeChange(bool m) -{ - if (maxBtn) - maxBtn->setPixmap(m ? *minmaxPix : *maxPix); -} - -Client::MousePosition KWMThemeClient::mousePosition(const QPoint &p) const -{ - MousePosition m = Client::mousePosition(p); - // corners - if(p.y() < framePixmaps[FrameTop]->height() && - p.x() < framePixmaps[FrameLeft]->width()){ - m = TopLeft; - } - else if(p.y() < framePixmaps[FrameTop]->height() && - p.x() > width()-framePixmaps[FrameRight]->width()){ - m = TopRight; - } - else if(p.y() > height()-framePixmaps[FrameBottom]->height() && - p.x() < framePixmaps[FrameLeft]->width()){ - m = BottomLeft; - } - else if(p.y() > height()-framePixmaps[FrameBottom]->height() && - p.x() > width()-framePixmaps[FrameRight]->width()){ - m = BottomRight; - } // edges - else if(p.y() < framePixmaps[FrameTop]->height()) - m = Top; - else if(p.y() > height()-framePixmaps[FrameBottom]->height()) - m = Bottom; - else if(p.x() < framePixmaps[FrameLeft]->width()) - m = Left; - else if(p.x() > width()-framePixmaps[FrameRight]->width()) - m = Right; - return(m); -} - -void KWMThemeClient::menuButtonPressed() -{ - static QTime* t = 0; - static KWMThemeClient* tc = 0; - if ( !t ) - t = new QTime; - - if ( tc != this || t->elapsed() > QApplication::doubleClickInterval() ){ - mnuBtn->setDown(false); // will stay down if I don't do this - workspace()->clientPopup(this)-> - popup(mnuBtn->mapToGlobal(mnuBtn->rect().bottomLeft())); - } - else { - mnuBtn->setPopup( 0 ); - closeWindow(); - } - t->start(); - tc = this; -} - -void KWMThemeClient::iconChange() -{ - if(mnuBtn){ - if(miniIcon().isNull()){ - mnuBtn->setPixmap(*menuPix); - } - else{ - mnuBtn->setPixmap(miniIcon()); - } - } -} - - - -void KWMThemeClient::init() -{ - // -} - -extern "C" -{ - Client *allocate(Workspace *ws, WId w) - { - return(new KWMThemeClient(ws, w)); - } - void init() - { - create_pixmaps(); - } - void reset() - { - delete_pixmaps(); - create_pixmaps(); - } - void deinit() - { - delete_pixmaps(); - } -} - -#include "kwmthemeclient.moc" diff --git a/clients/kwmtheme/kwmthemeclient.h b/clients/kwmtheme/kwmthemeclient.h deleted file mode 100644 index 29fce426f7..0000000000 --- a/clients/kwmtheme/kwmthemeclient.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __KWMTHEMECLIENT_H -#define __KWMTHEMECLIENT_H - -#include -#include -#include -#include "../../client.h" -class QLabel; -class QSpacerItem; -class QGridLayout; - -namespace KWinInternal{ - -// QToolButton uses a 1 pixel border :P -class MyButton : public QToolButton -{ -public: - MyButton(QWidget *parent=0, const char *name=0) - : QToolButton(parent, name){setAutoRaise(true);} -protected: - void drawButtonLabel(QPainter *p); -}; - -class KWMThemeClient : public KWinInternal::Client -{ - Q_OBJECT -public: - KWMThemeClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); - ~KWMThemeClient(){;} -protected: - void doShape(); - void drawTitle(QPainter &p); - void resizeEvent( QResizeEvent* ); - void paintEvent( QPaintEvent* ); - void showEvent( QShowEvent* ); - void windowWrapperShowEvent( QShowEvent* ); - void mouseDoubleClickEvent( QMouseEvent * ); - void init(); - void captionChange( const QString& name ); - void stickyChange(bool on); - void maximizeChange(bool m); - void iconChange(); - MousePosition mousePosition(const QPoint &) const; -protected slots: - void slotReset(); - void menuButtonPressed(); -private: - QPixmap buffer; - KPixmap *aGradient, *iGradient; - MyButton *maxBtn, *stickyBtn, *mnuBtn; - QSpacerItem *titlebar; - QGridLayout* layout; -}; - -}; - -#endif - diff --git a/clients/laptop/Makefile.am b/clients/laptop/Makefile.am deleted file mode 100644 index 624de53472..0000000000 --- a/clients/laptop/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ - -INCLUDES = $(all_includes) - -kde_module_LTLIBRARIES = libkwinlaptop.la - -libkwinlaptop_la_SOURCES = laptopclient.cpp -libkwinlaptop_la_LIBADD = ../../kwin.la -libkwinlaptop_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) - -METASOURCES = AUTO -noinst_HEADERS = laptopclient.h - -lnkdir = $(kde_datadir)/kwin/ -lnk_DATA = laptop.desktop - -EXTRA_DIST = $(lnk_DATA) - - -###KMAKE-start (don't edit or delete this block) - -###KMAKE-end diff --git a/clients/laptop/laptop.desktop b/clients/laptop/laptop.desktop deleted file mode 100644 index 77bbcac620..0000000000 --- a/clients/laptop/laptop.desktop +++ /dev/null @@ -1,28 +0,0 @@ -[Desktop Entry] -Name=Laptop -Name[ca]=Portàtil -Name[da]=Bærbar -Name[el]=Φορητό -Name[eo]=Portkomputilo -Name[es]=Portátil -Name[fi]=Kannettava -Name[fr]=Ordinateur portable -Name[gl]=Portátil -Name[is]=Ferðavél -Name[it]=Portatile -Name[ja]=ラップトップ -Name[ko]=랩탑 -Name[lv]=Laptops -Name[mk]=Лаптоп -Name[nl]=Schootcomputer -Name[no]=Bærbar -Name[no_NY]=Bærbar -Name[oc]=Portatil -Name[pt]=Portátil -Name[sl]=Prenosnik -Name[sv]=Bärbar dator -Name[tr]=Dizüstü -Name[uk]=Мобільний комп'ютер (лептоп) -Name[zh_CN.GB2312]=膝上计算机 -Name[zh_TW.Big5]=膝上型電腦 -X-KDE-Library=libkwinlaptop diff --git a/clients/laptop/laptopclient.cpp b/clients/laptop/laptopclient.cpp deleted file mode 100644 index 47511ebfb0..0000000000 --- a/clients/laptop/laptopclient.cpp +++ /dev/null @@ -1,704 +0,0 @@ - -#include // up here to avoid X11 header conflict :P -#include "laptopclient.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../workspace.h" -#include "../../options.h" - -using namespace KWinInternal; - - - -static unsigned char iconify_bits[] = { - 0xff, 0xff, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18}; - -static unsigned char close_bits[] = { - 0x42, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0x42}; - -static unsigned char maximize_bits[] = { - 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0xff, 0xff }; - -static unsigned char minmax_bits[] = { - 0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f}; - -static unsigned char question_bits[] = { - 0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}; - -static unsigned char unsticky_bits[] = { - 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42, 0x3c}; - -static unsigned char sticky_bits[] = { - 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c}; - -static QPixmap *titlePix=0; -static KPixmap *aUpperGradient=0; -static KPixmap *iUpperGradient=0; -// buttons active, inactive, up, down, and 2 sizes :P -static KPixmap *btnPix1=0; -static KPixmap *iBtnPix1=0; -static KPixmap *btnDownPix1=0; -static KPixmap *iBtnDownPix1=0; -static KPixmap *btnPix2=0; -static KPixmap *btnDownPix2=0; -static KPixmap *iBtnPix2=0; -static KPixmap *iBtnDownPix2=0; -static QColor btnForeground; - -static bool pixmaps_created = false; - -static int titleHeight = 14; // configurable title height not implemented yet -static int btnWidth1 = 17; -static int btnWidth2 = 27; - - -static void drawButtonFrame(KPixmap *pix, const QColorGroup &g, bool sunken) -{ - QPainter p; - int w = pix->width(); - int h = pix->height(); - int x2 = w-1; - int y2 = h-1; - p.begin(pix); - - if(sunken){ - qDrawShadePanel(&p, 0, 0, w, h, g, true, 2); - } - else{ - p.setPen(g.dark()); - p.drawRect(0, 0, w-1, h-1); - p.setPen(g.light()); - p.drawLine(x2, 0, x2, y2); - p.drawLine(0, y2, x2, y2); - p.drawLine(1, 1, x2-2, 1); - p.drawLine(1, 1, 1, y2-2); - p.end(); - } -} - -static void create_pixmaps() -{ - if(pixmaps_created) - return; - pixmaps_created = true; - - // titlebar - QPainter p; - QPainter maskPainter; - int i, x, y; - titlePix = new QPixmap(33, 12); - QBitmap mask(33, 12); - mask.fill(Qt::color0); - - p.begin(titlePix); - maskPainter.begin(&mask); - maskPainter.setPen(Qt::color1); - for(i=0, y=2; i < 3; ++i, y+=4){ - for(x=1; x <= 33; x+=3){ - p.setPen(options->color(Options::TitleBar, true).light(150)); - p.drawPoint(x, y); - maskPainter.drawPoint(x, y); - p.setPen(options->color(Options::TitleBar, true).dark(150)); - p.drawPoint(x+1, y+1); - maskPainter.drawPoint(x+1, y+1); - } - } - p.end(); - maskPainter.end(); - titlePix->setMask(mask); - - if(QPixmap::defaultDepth() > 8){ - aUpperGradient = new KPixmap; - aUpperGradient->resize(32, titleHeight+2); - iUpperGradient = new KPixmap; - iUpperGradient->resize(32, titleHeight+2); - QColor bgColor = options->color(Options::TitleBar, true); - KPixmapEffect::gradient(*aUpperGradient, - bgColor.light(120), - bgColor.dark(120), - KPixmapEffect::VerticalGradient); - bgColor = options->color(Options::TitleBar, false); - KPixmapEffect::gradient(*iUpperGradient, - bgColor.light(120), - bgColor.dark(120), - KPixmapEffect::VerticalGradient); - } - // buttons (active/inactive, sunken/unsunken, 2 sizes each) - QColorGroup g = options->colorGroup(Options::ButtonBg, true); - QColor c = g.background(); - btnPix1 = new KPixmap; - btnPix1->resize(btnWidth1, titleHeight); - btnDownPix1 = new KPixmap; - btnDownPix1->resize(btnWidth1, titleHeight); - btnPix2 = new KPixmap; - btnPix2->resize(btnWidth2, titleHeight); - btnDownPix2 = new KPixmap; - btnDownPix2->resize(btnWidth2, titleHeight); - iBtnPix1 = new KPixmap; - iBtnPix1->resize(btnWidth1, titleHeight); - iBtnDownPix1 = new KPixmap; - iBtnDownPix1->resize(btnWidth1, titleHeight); - iBtnPix2 = new KPixmap; - iBtnPix2->resize(btnWidth2, titleHeight); - iBtnDownPix2 = new KPixmap; - iBtnDownPix2->resize(btnWidth2, titleHeight); - if(QPixmap::defaultDepth() > 8){ - KPixmapEffect::gradient(*btnPix1, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*btnDownPix1, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*btnPix2, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*btnDownPix2, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); - g = options->colorGroup(Options::ButtonBg, false); - c = g.background(); - KPixmapEffect::gradient(*iBtnPix1, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*iBtnDownPix1, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*iBtnPix2, c.light(120), c.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(*iBtnDownPix2, c.dark(130), c.light(120), - KPixmapEffect::DiagonalGradient); - } - else{ - btnPix1->fill(c.rgb()); - btnDownPix1->fill(c.rgb()); - btnPix2->fill(c.rgb()); - btnDownPix2->fill(c.rgb()); - g = options->colorGroup(Options::ButtonBg, false); - c = g.background(); - iBtnPix1->fill(c.rgb()); - iBtnDownPix1->fill(c.rgb()); - iBtnPix2->fill(c.rgb()); - iBtnDownPix2->fill(c.rgb()); - } - g = options->colorGroup(Options::ButtonBg, true); - c = g.background(); - drawButtonFrame(btnPix1, g, false); - drawButtonFrame(btnDownPix1, g, true); - drawButtonFrame(btnPix2, g, false); - drawButtonFrame(btnDownPix2, g, true); - g = options->colorGroup(Options::ButtonBg, false); - c = g.background(); - drawButtonFrame(iBtnPix1, g, false); - drawButtonFrame(iBtnDownPix1, g, true); - drawButtonFrame(iBtnPix2, g, false); - drawButtonFrame(iBtnDownPix2, g, true); - - if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128) - btnForeground = Qt::black; - else - btnForeground = Qt::white; -} - -static void delete_pixmaps() -{ - delete titlePix; - if(aUpperGradient){ - delete aUpperGradient; - delete iUpperGradient; - delete btnPix1; - delete btnDownPix1; - delete iBtnPix1; - delete iBtnDownPix1; - delete btnPix2; - delete btnDownPix2; - delete iBtnPix2; - delete iBtnDownPix2; - } - pixmaps_created = false; -} - - -LaptopClientButton::LaptopClientButton(int w, int h, Client *parent, const char *name, - const unsigned char *bitmap) - : QButton(parent, name) -{ - client = parent; - defaultSize = QSize(w, h); - setFixedHeight(h); - resize(defaultSize); - if(bitmap) - setBitmap(bitmap); - //setBackgroundMode(QWidget::NoBackground); -} - -QSize LaptopClientButton::sizeHint() const -{ - return(defaultSize); -} - -void LaptopClientButton::reset() -{ - repaint(false); -} - -void LaptopClientButton::setBitmap(const unsigned char *bitmap) -{ - deco = QBitmap(8, 8, bitmap, true); - deco.setMask(deco); - repaint(); -} - -void LaptopClientButton::drawButton(QPainter *p) -{ - bool smallBtn = width() == btnWidth1; - if(btnPix1){ - if(client->isActive()){ - if(isDown()) - p->drawPixmap(0, 0, smallBtn ? *btnDownPix1 : *btnDownPix2); - else - p->drawPixmap(0, 0, smallBtn ? *btnPix1 : *btnPix2); - } - else{ - if(isDown()) - p->drawPixmap(0, 0, smallBtn ? *iBtnDownPix1 : *iBtnDownPix2); - else - p->drawPixmap(0, 0, smallBtn ? *iBtnPix1 : *iBtnPix2); - } - } - else{ - QColorGroup g = options->colorGroup(Options::ButtonBg, - client->isActive()); - int w = width(); - int h = height(); - p->fillRect(1, 1, w-2, h-2, isDown() ? g.mid() : g.button()); - p->setPen(isDown() ? g.dark() : g.light()); - p->drawLine(0, 0, w-1, 0); - p->drawLine(0, 0, 0, w-1); - p->setPen(isDown() ? g.light() : g.dark()); - p->drawLine(w-1, 0, w-1, h-1); - p->drawLine(0, h-1, w-1, h-1); - } - - p->setPen(btnForeground); - int xOff = (width()-8)/2; - int yOff = (height()-8)/2; - p->drawPixmap(isDown() ? xOff+1: xOff, isDown() ? yOff+1 : yOff, deco); -} - -void LaptopClient::slotReset() -{ - int i; - for(i=0; i < 5; ++i){ - if(button[i]) - button[i]->reset(); - } - repaint(); -} - -LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent, - const char *name ) - : Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity ) -{ - lastButtonWidth = 0; - lastBufferWidth = 0; - - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - bool help = providesContextHelp(); - - - QGridLayout* g = new QGridLayout(this, 0, 0, 0); - g->setResizeMode(QLayout::FreeResize); - g->addRowSpacing(0, 3); - g->addRowSpacing(2, 1); - g->addWidget(windowWrapper(), 3, 1); - g->setRowStretch(3, 10); - g->addRowSpacing(4, 8); // bottom handles - g->addColSpacing(0, 4); - g->addColSpacing(2, 4); - - int th = titleHeight; - if ( isTool() ) - th -= 2; - - button[BtnClose] = new LaptopClientButton(27, th, this, "close", close_bits); - button[BtnSticky] = new LaptopClientButton(17, th, this, "sticky"); - if(isSticky()) - button[BtnSticky]->setBitmap(unsticky_bits); - else - button[BtnSticky]->setBitmap(sticky_bits); - button[BtnIconify] = new LaptopClientButton(27, th, this, "iconify", - iconify_bits); - button[BtnMax] = new LaptopClientButton(27, th, this, "maximize", - maximize_bits); - if(help){ - button[BtnHelp] = new LaptopClientButton(17, th, this, "help", - question_bits); - connect(button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) ); - } - else - button[BtnHelp] = NULL; - - connect( button[BtnClose], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) ); - connect( button[BtnSticky], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) ); - connect( button[BtnIconify], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) ); - connect( button[BtnMax], SIGNAL( clicked() ), this, ( SLOT( slotMaximize() ) ) ); - - hb = new QHBoxLayout(); - hb->setResizeMode(QLayout::FreeResize); - g->addLayout( hb, 1, 1 ); - hb->addWidget( button[BtnClose]); - hb->addSpacing(1); - titlebar = new QSpacerItem(10, th, QSizePolicy::Expanding, - QSizePolicy::Minimum); - hb->addItem(titlebar); - hb->addSpacing(1); - if(help){ - hb->addWidget( button[BtnHelp]); - } - hb->addWidget( button[BtnSticky]); - hb->addWidget( button[BtnIconify]); - hb->addWidget( button[BtnMax]); - - if ( isTransient() || isTool() ) - button[BtnSticky]->hide(); - if ( !isMinimizable() ) - button[BtnIconify]->hide(); - if ( !isMaximizable() ) - button[BtnMax]->hide(); - - hiddenItems = false; - bufferDirty = true; -} - -void LaptopClient::slotMaximize() -{ - if ( button[BtnMax]->last_button == MidButton ) - maximize( MaximizeVertical ); - else if ( button[BtnMax]->last_button == RightButton ) - maximize( MaximizeHorizontal ); - else - maximize(); -} - -void LaptopClient::resizeEvent( QResizeEvent* e) -{ - Client::resizeEvent( e ); - - doShape(); - calcHiddenButtons(); - if ( isVisibleToTLW() ) { - int dx = 0; - int dy = 0; - if ( e->oldSize().width() != width() ) - dx = 32 + QABS( e->oldSize().width() - width() ); - if ( e->oldSize().height() != height() ) - dy = 8 + QABS( e->oldSize().height() - height() ); - if ( dy ) - update( 0, height() - dy + 1, width(), dy ); - if ( dx ) { - update( width() - dx + 1, 0, dx, height() ); - update( QRect( QPoint(4,4), titlebar->geometry().bottomLeft() - QPoint(1,0) ) ); - update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4, titlebar->geometry().bottom() ) ) ); - // titlebar needs no background - QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) ); - } - } -} - -void LaptopClient::captionChange( const QString& ) -{ - bufferDirty = true; - repaint( titlebar->geometry(), false ); -} - -void LaptopClient::paintEvent( QPaintEvent* ) -{ - QPainter p(this); - QColorGroup g = options->colorGroup(Options::Frame, isActive()); - - QRect r(rect()); - p.setPen(Qt::black); - p.drawRect(r); - // outer frame - p.setPen(g.light()); - p.drawLine(r.x()+1, r.y()+1, r.right()-1, r.y()+1); - p.drawLine(r.x()+1, r.y()+1, r.x()+1, r.bottom()-1); - p.setPen(g.dark()); - p.drawLine(r.right()-1, r.y()+1, r.right()-1, r.bottom()-1); - p.drawLine(r.x()+1, r.bottom()-1, r.right()-1, r.bottom()-1); - - int th = titleHeight; - if ( isTool() ) - th -= 2; - - // inner rect - p.drawRect(r.x()+3, r.y()+th+3, r.width()-6, - r.height()-th-10); - // handles - if(r.width() > 44){ - qDrawShadePanel(&p, r.x()+1, r.bottom()-6, 20, - 6, g, false, 1, &g.brush(QColorGroup::Mid)); - qDrawShadePanel(&p, r.x()+21, r.bottom()-6, r.width()-42, 6, - g, false, 1, isActive() ? - &g.brush(QColorGroup::Background) : - &g.brush(QColorGroup::Mid)); - qDrawShadePanel(&p, r.right()-20, r.bottom()-6, 20, 6, - g, false, 1, &g.brush(QColorGroup::Mid)); - } - else - qDrawShadePanel(&p, r.x()+1, r.bottom()-6, r.width()-2, 6, g, - false, 1, isActive() ? - &g.brush(QColorGroup::Background) : - &g.brush(QColorGroup::Mid)); - - r = titlebar->geometry(); - r.setRight(r.right()-1); - - if(isActive()){ - updateActiveBuffer(); - p.drawPixmap(r.x(), r.y(), activeBuffer); - } - else{ - if(iUpperGradient) - p.drawTiledPixmap(r.x(), r.y(), r.width(), r.height()-1, - *iUpperGradient); - else - p.fillRect(r.x(), r.y(), r.width(), r.height()-1, - options->color(Options::TitleBar, false)); - - p.setFont(options->font(false, isTool() )); - QFontMetrics fm(options->font(false)); - g = options->colorGroup(Options::TitleBar, false); - if(iUpperGradient) - p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4, - r.y(), fm.width(caption())+8, r.height()-1, - *iUpperGradient); - else - p.fillRect(r.x()+((r.width()-fm.width(caption()))/2)-4, r.y(), - fm.width(caption())+8, r.height()-1, - g.brush(QColorGroup::Background)); - p.setPen(g.mid()); - p.drawLine(r.x(), r.y(), r.right(), r.y()); - p.drawLine(r.x(), r.y(), r.x(), r.bottom()); - p.setPen(g.button()); - p.drawLine(r.right(), r.y(), r.right(), r.bottom()); - p.drawLine(r.x(), r.bottom(), r.right(), r.bottom()); - p.setPen(options->color(Options::Font, false)); - p.drawText(r.x(), r.y(), r.width(), r.height()-1, - AlignCenter, caption() ); - g = options->colorGroup(Options::Frame, true); - p.setPen(g.background()); - p.drawPoint(r.x(), r.y()); - p.drawPoint(r.right(), r.y()); - p.drawLine(r.right()+1, r.y(), r.right()+1, r.bottom()); - } -} - -#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) - -void LaptopClient::doShape() -{ - QRegion mask(QRect(0, 0, width(), height())); - mask -= QRect(0, 0, 1, 1); - mask -= QRect(width()-1, 0, 1, 1); - mask -= QRect(0, height()-1, 1, 1); - mask -= QRect(width()-1, height()-1, 1, 1); - - setMask(mask); -} - -void LaptopClient::showEvent(QShowEvent *ev) -{ - Client::showEvent(ev); - doShape(); - repaint(); -} - -void LaptopClient::windowWrapperShowEvent( QShowEvent* ) -{ - doShape(); -} - -void LaptopClient::mouseDoubleClickEvent( QMouseEvent * e ) -{ - if (titlebar->geometry().contains( e->pos() ) ) - workspace()->performWindowOperation( this, options->operationTitlebarDblClick() ); - workspace()->requestFocus( this ); -} - -void LaptopClient::stickyChange(bool on) -{ - button[BtnSticky]->setBitmap(on ? unsticky_bits : sticky_bits); -} - -void LaptopClient::maximizeChange(bool m) -{ - button[BtnMax]->setBitmap(m ? minmax_bits : maximize_bits); -} - -void LaptopClient::init() -{ - // -} - -void LaptopClient::activeChange(bool) -{ - repaint(false); - int i; - for(i=0; i < 5; ++i){ - if(button[i]) - button[i]->reset(); - } -} - - -void LaptopClient::calcHiddenButtons() -{ - // order of hiding is help, sticky, maximize, minimize, close; - // buttons can have - int minWidth = 32 + btnWidth2*3 + (providesContextHelp() ? btnWidth1*2 : - btnWidth1); - - if(lastButtonWidth > width()){ // shrinking - lastButtonWidth = width(); - if(width() < minWidth){ - hiddenItems = true; - int i; - for(i=0; i<5; ++i){ - if(button[i]){ - if( !button[i]->isHidden() ) { - button[i]->hide(); - } - minWidth-=button[i]->sizeHint().width(); - if(width() >= minWidth) - return; - } - } - } - } - else if(hiddenItems){ // expanding - lastButtonWidth = width(); - int i; - int totalSize=32; - for(i=4; i>=0; --i){ - if(button[i]){ - if(button[i]->sizeHint().width() + totalSize <= width()){ - totalSize+=button[i]->sizeHint().width(); - if(button[i]->isHidden() && - ( !isTransient() || !isTransient() || i != BtnSticky ) && - ( isMinimizable() || i != BtnIconify ) && - ( isMaximizable() || ( i != BtnIconify && i != BtnSticky && i != BtnMax ) ) - - ) { - button[i]->resize(button[i]->sizeHint()); - button[i]->show(); - } - } - else - return; - } - } - // all items shown now - hiddenItems = false; - } - else - lastButtonWidth = width(); -} - -void LaptopClient::updateActiveBuffer( ) -{ - if( !bufferDirty && (lastBufferWidth == titlebar->geometry().width())) - return; - if ( titlebar->geometry().width() <= 0 || titlebar->geometry().height() <= 0 ) - return; - lastBufferWidth = titlebar->geometry().width(); - bufferDirty = false; - - activeBuffer.resize(titlebar->geometry().width(), - titlebar->geometry().height()); - QPainter p; - QRect r(0, 0, activeBuffer.width()-1, activeBuffer.height()); - p.begin(&activeBuffer); - if(aUpperGradient){ - p.drawTiledPixmap(r, *aUpperGradient); - } - else{ - p.fillRect(r, options->color(Options::TitleBar, true)); - } - if(titlePix) - p.drawTiledPixmap(r, *titlePix); - - p.setFont(options->font(true, isTool() )); - QFontMetrics fm(options->font(true)); - QColorGroup g = options->colorGroup(Options::TitleBar, true); - if(aUpperGradient) - p.drawTiledPixmap(r.x()+((r.width()-fm.width(caption()))/2)-4, - r.y(), fm.width(caption())+8, r.height()-1, - *aUpperGradient); - else - p.fillRect(r.x()+((r.width()-fm.width(caption()))/2)-4, 0, - fm.width(caption())+8, r.height(), - g.brush(QColorGroup::Background)); - p.setPen(g.mid()); - p.drawLine(r.x(), r.y(), r.right(), r.y()); - p.drawLine(r.x(), r.y(), r.x(), r.bottom()); - p.setPen(g.button()); - p.drawLine(r.right(), r.y(), r.right(), r.bottom()); - p.drawLine(r.x(), r.bottom(), r.right(), r.bottom()); - p.setPen(options->color(Options::Font, true)); - p.drawText(r.x(), r.y(), r.width(), r.height()-1, - AlignCenter, caption() ); - g = options->colorGroup(Options::Frame, true); - p.setPen(g.background()); - p.drawPoint(r.x(), r.y()); - p.drawPoint(r.right(), r.y()); - p.drawLine(r.right()+1, r.y(), r.right()+1, r.bottom()); - p.end(); -} - - Client::MousePosition -LaptopClient::mousePosition( const QPoint& p ) const -{ - MousePosition m = Nowhere; - - if (p.y() < (height() - 7)) - m = Client::mousePosition(p); - - else { - if (p.x() >= (width() - 20)) - m = BottomRight; - else if (p.x() <= 20) - m = BottomLeft; - else - m = Bottom; - } - - return m; -} - -extern "C" -{ - Client *allocate(Workspace *ws, WId w, int) - { - return(new LaptopClient(ws, w)); - } - void init() - { - create_pixmaps(); - } - void reset() - { - delete_pixmaps(); - create_pixmaps(); - } - void deinit() - { - delete_pixmaps(); - } -} - -#include "laptopclient.moc" diff --git a/clients/laptop/laptopclient.h b/clients/laptop/laptopclient.h deleted file mode 100644 index 260a85d83f..0000000000 --- a/clients/laptop/laptopclient.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __KDECLIENT_H -#define __KDECLIENT_H - -#include -#include -#include -#include "../../client.h" -class QLabel; -class QSpacerItem; -class QHBoxLayout; - -namespace KWinInternal { - -// get rid of autohide :P -class LaptopClientButton : public QButton -{ -public: - LaptopClientButton(int w, int h, Client *parent=0, const char *name=0, - const unsigned char *bitmap=NULL); - void setBitmap(const unsigned char *bitmap); - void reset(); - QSize sizeHint() const; - int last_button; - -protected: - void mousePressEvent( QMouseEvent* e ) - { - last_button = e->button(); - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QButton::mousePressEvent( &me ); - } - void mouseReleaseEvent( QMouseEvent* e ) - { - last_button = e->button(); - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QButton::mouseReleaseEvent( &me ); - } - virtual void drawButton(QPainter *p); - void drawButtonLabel(QPainter *){;} - QSize defaultSize; - QBitmap deco; - Client *client; -}; - -class LaptopClient : public KWinInternal::Client -{ - Q_OBJECT -public: - enum Buttons{BtnHelp=0, BtnSticky, BtnMax, BtnIconify, BtnClose}; - LaptopClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); - ~LaptopClient(){;} -protected: - void resizeEvent( QResizeEvent* ); - void paintEvent( QPaintEvent* ); - void showEvent( QShowEvent* ); - void windowWrapperShowEvent( QShowEvent* ); - void mouseDoubleClickEvent( QMouseEvent * ); - void init(); - void captionChange( const QString& name ); - void stickyChange(bool on); - void maximizeChange(bool m); - void doShape(); - void activeChange(bool); - - void calcHiddenButtons(); - void updateActiveBuffer(); - - MousePosition mousePosition(const QPoint &) const; - -protected slots: - void slotReset(); - void slotMaximize(); -private: - LaptopClientButton* button[5]; - int lastButtonWidth; - QSpacerItem* titlebar; - bool hiddenItems; - QHBoxLayout *hb; - KPixmap activeBuffer; - bool bufferDirty; - int lastBufferWidth; -}; - -}; - -#endif diff --git a/clients/modernsystem/Makefile.am b/clients/modernsystem/Makefile.am deleted file mode 100644 index e2a68e57da..0000000000 --- a/clients/modernsystem/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# $Id$ - -INCLUDES = $(all_includes) - -SUBDIRS = config - -kde_module_LTLIBRARIES = libkwinmodernsys.la - -libkwinmodernsys_la_SOURCES = modernsys.cpp -libkwinmodernsys_la_LIBADD = ../../kwin.la -libkwinmodernsys_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) - -METASOURCES = AUTO -noinst_HEADERS = modernsys.h - -lnkdir = $(kde_datadir)/kwin/ -lnk_DATA = modernsystem.desktop - -EXTRA_DIST = $(lnk_DATA) - diff --git a/clients/modernsystem/btnhighcolor.h b/clients/modernsystem/btnhighcolor.h deleted file mode 100644 index fa323b9eb5..0000000000 --- a/clients/modernsystem/btnhighcolor.h +++ /dev/null @@ -1,93 +0,0 @@ -/* XPM */ -static const char * btnhighcolor_xpm[] = { -"14 15 75 1", -" c None", -". c #6E6E6E", -"+ c #757575", -"@ c #878787", -"# c #7D7D7D", -"$ c #9E9E9E", -"% c #B9B9B9", -"& c #C6C6C6", -"* c #BABABA", -"= c #A5A5A5", -"- c #7F7F7F", -"; c #848484", -"> c #A7A7A7", -", c #BFBFBF", -"' c #D1D1D1", -") c #D7D7D7", -"! c #DADADA", -"~ c #CBCBCB", -"{ c #ABABAB", -"] c #B3B3B3", -"^ c #C2C2C2", -"/ c #CACACA", -"( c #C9C9C9", -"_ c #B6B6B6", -": c #9A9A9A", -"< c #999999", -"[ c #B0B0B0", -"} c #C4C4C4", -"| c #C3C3C3", -"1 c #C0C0C0", -"2 c #AEAEAE", -"3 c #969696", -"4 c #C1C1C1", -"5 c #CCCCCC", -"6 c #C5C5C5", -"7 c #BEBEBE", -"8 c #AAAAAA", -"9 c #CECECE", -"0 c #D4D4D4", -"a c #DBDBDB", -"b c #DEDEDE", -"c c #D5D5D5", -"d c #D3D3D3", -"e c #BCBCBC", -"f c #CDCDCD", -"g c #E0E0E0", -"h c #E4E4E4", -"i c #E8E8E8", -"j c #EBEBEB", -"k c #E9E9E9", -"l c #E6E6E6", -"m c #DDDDDD", -"n c #E1E1E1", -"o c #EDEDED", -"p c #F1F1F1", -"q c #F5F5F5", -"r c #F8F8F8", -"s c #F6F6F6", -"t c #F3F3F3", -"u c #EEEEEE", -"v c #E5E5E5", -"w c #DCDCDC", -"x c #B7B7B7", -"y c #E2E2E2", -"z c #FDFDFD", -"A c #FFFFFF", -"B c #FCFCFC", -"C c #F7F7F7", -"D c #B5B5B5", -"E c #F2F2F2", -"F c #FAFAFA", -"G c #9B9B9B", -"H c #FBFBFB", -"I c #A9A9A9", -"J c #747474", -" .... ", -" ..+@@+.. ", -" .#$%&&*=-. ", -" .;>,')!)~{#. ", -" .$]^///(&_:. ", -".<[*^}||11*23.", -".[4&5555~(678.", -".,90!aba)cd~e.", -".faghijklhm06.", -".'nopqrstuvw/.", -".xyprzAzBCunD.", -" .'EzAAAAFpf. ", -" .GcHAAAAF0<. ", -" ..I5kk5I.. ", -" J..... "}; diff --git a/clients/modernsystem/buttondata.h b/clients/modernsystem/buttondata.h deleted file mode 100644 index 20d0774bcf..0000000000 --- a/clients/modernsystem/buttondata.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Image bits processed by KPixmap2Bitmaps */ - -#define lowcolor_mask_width 14 -#define lowcolor_mask_height 15 -static unsigned char lowcolor_mask_bits[] = { - 0xf0,0x03,0xf8,0x07,0xfc,0xcf,0xfe,0x1f,0xfe,0x1f,0xff,0xff,0xff,0xff,0xff, - 0x3f,0xff,0x3f,0xff,0xbf,0xfe,0xdf,0xfe,0x9f,0xfc,0x0f,0xf8,0x07,0xf0,0x03, - 0x00,0x40,0x80,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x7c,0xfe,0x87,0x40,0x00, - 0x00,0x64,0x00,0x20,0x00,0x64,0x00,0x86,0xfe,0x87,0x40,0x00,0x00,0x65,0x00 }; - -#define lowcolor_6a696a_width 14 -#define lowcolor_6a696a_height 15 -static unsigned char lowcolor_6a696a_bits[] = { - 0xf0,0x03,0x18,0x06,0x04,0xcc,0x06,0x18,0x02,0x10,0x00,0xc0,0x00,0xc0,0x00, - 0x00,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x40,0x80,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03, - 0x00,0x00,0x00,0x80,0x24,0x0e,0x08,0x61,0x00,0x00,0x00,0xf0,0xd9,0x0c,0x08 }; - -#define lowcolor_949194_width 14 -#define lowcolor_949194_height 15 -static unsigned char lowcolor_949194_bits[] = { - 0x00,0x40,0xe0,0x01,0x08,0x02,0x00,0x04,0x04,0x08,0x07,0x78,0x03,0xf0,0x01, - 0xe0,0x01,0x60,0x01,0x20,0x00,0xc0,0x02,0x90,0x04,0x08,0x08,0x04,0xf0,0x03, - 0x00,0x40,0x80,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0xc8,0x51,0x0c,0x08,0x0e, - 0x01,0x00,0x00,0x37,0x00,0x00,0x00,0x58,0x5f,0x49,0x6d,0x61,0x67,0x65,0x54 }; - -#define lowcolor_b4b6b4_width 14 -#define lowcolor_b4b6b4_height 15 -static unsigned char lowcolor_b4b6b4_bits[] = { - 0x00,0x40,0x00,0x00,0x10,0x00,0x08,0x02,0x18,0x06,0xb8,0x47,0x0c,0xce,0x0e, - 0xd8,0x06,0x58,0x02,0x10,0x02,0xd0,0x00,0x80,0x00,0x00,0x10,0x02,0x00,0x00, - 0x00,0x40,0x80,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01, - 0x00,0x08,0x00,0x02,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0x38,0x5b,0x0c,0x08 }; - -#define lowcolor_e6e6e6_width 14 -#define lowcolor_e6e6e6_height 15 -static unsigned char lowcolor_e6e6e6_bits[] = { - 0x00,0x40,0x00,0x00,0x00,0x00,0xe0,0x01,0x00,0x00,0x00,0x40,0x00,0xc0,0x00, - 0xc0,0x00,0x40,0xe0,0xc0,0xe0,0xc1,0xe0,0x81,0xf0,0x03,0xc0,0x00,0x00,0x00, - 0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x08,0x19,0x0d,0x08,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00 }; - diff --git a/clients/modernsystem/config/Makefile.am b/clients/modernsystem/config/Makefile.am deleted file mode 100644 index a4c8a609ec..0000000000 --- a/clients/modernsystem/config/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -# $Id$ - -INCLUDES = $(all_includes) - -kde_module_LTLIBRARIES = libkwinmodernsys_config.la - -libkwinmodernsys_config_la_SOURCES = config.cpp -libkwinmodernsys_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -libkwinmodernsys_config_la_LIBADD = $(LIB_KDEUI) - -METASOURCES = AUTO -noinst_HEADERS = config.h - -lnkdir = $(kde_datadir)/kwin/ - diff --git a/clients/modernsystem/config/config.cpp b/clients/modernsystem/config/config.cpp deleted file mode 100644 index 7587cc7531..0000000000 --- a/clients/modernsystem/config/config.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// $Id$ -// Melchior FRANZ -- 2001-04-22 - -#include "config.h" -#include -#include -#include - - -extern "C" -{ - QObject* allocate_config( KConfig* conf, QWidget* parent ) - { - return(new ModernSysConfig(conf, parent)); - } -} - - -// '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 - -ModernSysConfig::ModernSysConfig(KConfig* conf, QWidget* parent) : QObject(parent) -{ - clientrc = new KConfig("kwinmodernsysrc"); - gb = new QGroupBox(1, Qt::Horizontal, i18n("Decoration Settings"), parent); - cbShowHandle = new QCheckBox(i18n("&Show resize handle"), gb); - QWhatsThis::add(cbShowHandle, i18n("When selected, all windows are drawn with a resize " - "handle at the lower right corner.")); - connect(cbShowHandle, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); - load(conf); - gb->show(); -} - - -ModernSysConfig::~ModernSysConfig() -{ - delete cbShowHandle; - delete gb; - delete clientrc; -} - - -void ModernSysConfig::slotSelectionChanged() -{ - emit changed(); -} - - -void ModernSysConfig::load(KConfig* /*conf*/) -{ - clientrc->setGroup("General"); - bool i = clientrc->readBoolEntry("ShowHandle", true ); - cbShowHandle->setChecked(i); - handle_width = clientrc->readUnsignedNumEntry("HandleWidth", 6); - handle_size = clientrc->readUnsignedNumEntry("HandleSize", 30); -} - - -void ModernSysConfig::save(KConfig* /*conf*/) -{ - clientrc->setGroup("General"); - clientrc->writeEntry("ShowHandle", cbShowHandle->isChecked()); - clientrc->writeEntry("HandleWidth", handle_width); - clientrc->writeEntry("HandleSize", handle_size); - clientrc->sync(); -} - - -void ModernSysConfig::defaults() -{ - cbShowHandle->setChecked(true); -} - -#include "config.moc" diff --git a/clients/modernsystem/config/config.h b/clients/modernsystem/config/config.h deleted file mode 100644 index 4c79ce6d08..0000000000 --- a/clients/modernsystem/config/config.h +++ /dev/null @@ -1,38 +0,0 @@ -// $Id$ -#ifndef __KDE_MODSYSTEMCONFIG_H -#define __KDE_MODSYSTEMCONFIG_H - -#include -#include -#include - -class ModernSysConfig : public QObject -{ - Q_OBJECT - - public: - ModernSysConfig( KConfig* conf, QWidget* parent ); - ~ModernSysConfig(); - - // These public signals/slots work similar to KCM modules - signals: - void changed(); - - public slots: - void load( KConfig* conf ); - void save( KConfig* conf ); - void defaults(); - - protected slots: - void slotSelectionChanged(); // Internal use - - private: - KConfig *clientrc; - QGroupBox *gb; - QCheckBox *cbShowHandle; - unsigned handle_width; - unsigned handle_size; -}; - - -#endif diff --git a/clients/modernsystem/modernsys.cpp b/clients/modernsystem/modernsys.cpp deleted file mode 100644 index 04eec898bc..0000000000 --- a/clients/modernsystem/modernsys.cpp +++ /dev/null @@ -1,646 +0,0 @@ -// $Id$ -// Daniel M. DULEY original work -// Melchior FRANZ configuration options - -#include -#include -#include -#include -#include -#include -#include -#include "../../workspace.h" -#include "../../options.h" -#include "modernsys.h" - -#include "buttondata.h" -#include "btnhighcolor.h" - -using namespace KWinInternal; - - -static unsigned char iconify_bits[] = { - 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00}; - -static unsigned char close_bits[] = { - 0x00, 0x66, 0x7e, 0x3c, 0x3c, 0x7e, 0x66, 0x00}; - -static unsigned char maximize_bits[] = { - 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00}; - -static unsigned char minmax_bits[] = { - 0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f}; - -static unsigned char unsticky_bits[] = { - 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42, 0x3c}; - -static unsigned char sticky_bits[] = { - 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c}; - -static unsigned char question_bits[] = { - 0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}; - -static unsigned char btnhighcolor_mask_bits[] = { - 0xe0,0x41,0xf8,0x07,0xfc,0x0f,0xfe,0xdf,0xfe,0x1f,0xff,0x3f,0xff,0xff,0xff, - 0x3f,0xff,0x3f,0xff,0xff,0xff,0xff,0xfe,0x9f,0xfe,0x1f,0xfc,0x0f,0xf0,0x03, - 0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x20,0x99,0x0f,0x08,0xc4, - 0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x58,0x5f,0x43,0x68,0x61,0x6e,0x67,0x65 }; - -static KPixmap *aUpperGradient=0; -static KPixmap *iUpperGradient=0; -static QPixmap *buttonPix=0; -static QPixmap *buttonPixDown=0; -static QPixmap *iButtonPix=0; -static QPixmap *iButtonPixDown=0; - -static QColor *buttonFg; -static bool pixmaps_created = false; - -static QBitmap *lcDark1; -static QBitmap *lcDark2; -static QBitmap *lcDark3; -static QBitmap *lcLight1; -static QImage *btnSource; - -static QString *button_pattern = NULL; -static bool show_handle; -static int handle_size; -static int handle_width; -static bool config_changed; - -static void make_button_fx(const QColorGroup &g, QPixmap *pix, bool light=false) -{ - pix->fill(g.background()); - QPainter p(pix); - - if(QPixmap::defaultDepth() > 8){ - int i, destH, destS, destV, srcH, srcS, srcV; - QColor btnColor = g.background(); - - if(btnSource->depth() < 32) - *btnSource = btnSource->convertDepth(32); - if(light) - btnColor = btnColor.light(120); - btnColor.hsv(&destH, &destS, &destV); - QImage btnDest(14, 15, 32); - - unsigned int *srcData = (unsigned int *)btnSource->bits(); - unsigned int *destData = (unsigned int *)btnDest.bits(); - QColor srcColor; - for(i=0; i < btnSource->width()*btnSource->height(); ++i){ - srcColor.setRgb(srcData[i]); - srcColor.hsv(&srcH, &srcS, &srcV); - srcColor.setHsv(destH, destS, srcV); - destData[i] = srcColor.rgb(); - } - pix->convertFromImage(btnDest); - - } - else{ - if(!lcDark1->mask()){ - lcDark1->setMask(*lcDark1); - lcDark2->setMask(*lcDark2); - lcDark3->setMask(*lcDark3); - lcLight1->setMask(*lcLight1); - } - p.setPen(g.dark()); - p.drawPixmap(0, 0, *lcDark2); - p.drawPixmap(0, 0, *lcDark1); - p.setPen(g.mid()); - p.drawPixmap(0, 0, *lcDark3); - p.setPen(g.light()); - p.drawPixmap(0, 0, *lcLight1); - } -} - - -static void create_pixmaps() -{ - if(pixmaps_created) - return; - pixmaps_created = true; - - lcDark1 = new QBitmap(14, 15, lowcolor_6a696a_bits, true); - lcDark2 = new QBitmap(14, 15, lowcolor_949194_bits, true); - lcDark3 = new QBitmap(14, 15, lowcolor_b4b6b4_bits, true); - lcLight1 = new QBitmap(14, 15, lowcolor_e6e6e6_bits, true); - btnSource = new QImage(btnhighcolor_xpm); - - if(QPixmap::defaultDepth() > 8){ - aUpperGradient = new KPixmap; - aUpperGradient->resize(32, 18); - iUpperGradient = new KPixmap; - iUpperGradient->resize(32, 18); - KPixmapEffect::gradient(*aUpperGradient, - options->color(Options::TitleBar, true).light(130), - options->color(Options::TitleBlend, true), - KPixmapEffect::VerticalGradient); - KPixmapEffect::gradient(*iUpperGradient, - options->color(Options::TitleBar, false).light(130), - options->color(Options::TitleBlend, false), - KPixmapEffect::VerticalGradient); - } - // buttons - QColorGroup btnColor(options->colorGroup(Options::ButtonBg, true)); - buttonPix = new QPixmap(14, 15); - make_button_fx(btnColor, buttonPix); - buttonPixDown = new QPixmap(14, 15); - make_button_fx(btnColor, buttonPixDown, true); - - btnColor = options->colorGroup(Options::ButtonBg, false); - iButtonPix = new QPixmap(14, 15); - make_button_fx(btnColor, iButtonPix); - iButtonPixDown = new QPixmap(14, 15); - make_button_fx(btnColor, iButtonPixDown, true); - - - if(qGray(btnColor.background().rgb()) < 150) - buttonFg = new QColor(Qt::white); - else - buttonFg = new QColor(Qt::black); - - delete lcDark1; - delete lcDark2; - delete lcDark3; - delete lcLight1; - delete btnSource; -} - -static void delete_pixmaps() -{ - if(aUpperGradient){ - delete aUpperGradient; - delete iUpperGradient; - } - delete buttonPix; - delete buttonPixDown; - delete iButtonPix; - delete iButtonPixDown; - - delete buttonFg; - - pixmaps_created = false; -} - -static bool read_config() -{ - bool showh; - int hsize, hwidth; - QString bpatt; - - KConfig c("kwinmodernsysrc"); - c.setGroup("General"); - showh = c.readBoolEntry("ShowHandle", true); - - hwidth = c.readUnsignedNumEntry("HandleWidth", 6); - hsize = c.readUnsignedNumEntry("HandleSize", 30); - if (!(showh && hsize && hwidth)) { - showh = false; - hwidth = hsize = 0; - } - - if (options->customButtonPositions()) { - bpatt = "2" + options->titleButtonsLeft() + "3t3" - + options->titleButtonsRight() + "2"; - } - else - bpatt = "2X3t3HSIA2"; - - if (showh == show_handle && hwidth == handle_width && hsize == handle_size - && bpatt == *button_pattern) - return false; - - show_handle = showh; - handle_width = hwidth; - handle_size = hsize; - *button_pattern = bpatt; - return true; -} - -ModernButton::ModernButton(Client *parent, const char *name, - const unsigned char *bitmap) - : QButton(parent, name) -{ - setBackgroundMode( NoBackground ); - QBitmap mask(14, 15, QPixmap::defaultDepth() > 8 ? - btnhighcolor_mask_bits : lowcolor_mask_bits, true); - resize(14, 15); - - if(bitmap) - setBitmap(bitmap); - setMask(mask); - client = parent; - hide(); -} - -QSize ModernButton::sizeHint() const -{ - return(QSize(14, 15)); -} - -void ModernButton::reset() -{ - repaint(false); -} - -void ModernButton::setBitmap(const unsigned char *bitmap) -{ - deco = QBitmap(8, 8, bitmap, true); - deco.setMask(deco); - repaint(); -} - -void ModernButton::drawButton(QPainter *p) -{ - if(client->isActive()){ - if(buttonPix) - p->drawPixmap(0, 0, isDown() ? *buttonPixDown : *buttonPix); - } - else{ - if(iButtonPix) - p->drawPixmap(0, 0, isDown() ? *iButtonPixDown : *iButtonPix); - } - if(!deco.isNull()){ - p->setPen(*buttonFg); - p->drawPixmap(isDown() ? 4 : 3, isDown() ? 5 : 4, deco); - } -} - -void ModernButton::mousePressEvent( QMouseEvent* e ) -{ - last_button = e->button(); - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QButton::mousePressEvent( &me ); -} - -void ModernButton::mouseReleaseEvent( QMouseEvent* e ) -{ - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QButton::mouseReleaseEvent( &me ); -} - - -void ModernSys::slotReset() -{ - if (config_changed) { - workspace()->slotResetAllClientsDelayed(); - config_changed = false; - } - titleBuffer.resize(0, 0); - recalcTitleBuffer(); - for (int i = 0; i < 5; button[i++]->reset()); - repaint(); -} - -ModernSys::ModernSys( Workspace *ws, WId w, QWidget *parent, - const char *name ) - : Client( ws, w, parent, name, WResizeNoErase ) -{ - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - bool help = providesContextHelp(); - - QGridLayout* g = new QGridLayout(this, 0, 0, 2); - g->addWidget(windowWrapper(), 1, 1 ); - g->setRowStretch(1, 10); - g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) ); - - g->addColSpacing(0, 2); - g->addColSpacing(2, 2 + handle_width); - - g->addRowSpacing(2, 2 + handle_width); - - QHBoxLayout* hb = new QHBoxLayout(0); - hb->setResizeMode(QLayout::FreeResize); - titlebar = new QSpacerItem(10, 16, QSizePolicy::Expanding, - QSizePolicy::Minimum); - - button[BtnClose] = new ModernButton(this, "close", close_bits); - button[BtnSticky] = new ModernButton(this, "sticky"); - button[BtnMinimize] = new ModernButton(this, "iconify", iconify_bits); - button[BtnMaximize] = new ModernButton(this, "maximize", maximize_bits); - button[BtnHelp] = new ModernButton(this, "help", question_bits); - - connect( button[BtnClose], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) ); - connect( button[BtnSticky], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) ); - connect( button[BtnMinimize], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) ); - connect( button[BtnMaximize], SIGNAL( clicked() ), this, ( SLOT( maxButtonClicked() ) ) ); - connect( button[BtnHelp], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) ); - - for (int i = 0; i < (int)button_pattern->length();) { - QChar c = (*button_pattern)[i++]; - if (c == '_') - c = '3'; - - if (c.isDigit()) { - hb->addSpacing(int(c - '0')); - continue; - } - else if (c == 'X') { - hb->addWidget(button[BtnClose]); - button[BtnClose]->show(); - } - else if (c == 'S') { - if(isSticky()) - button[BtnSticky]->setBitmap(unsticky_bits); - else - button[BtnSticky]->setBitmap(sticky_bits); - hb->addWidget(button[BtnSticky]); - button[BtnSticky]->show(); - } - else if (c == 'I' && isMinimizable()) { - hb->addWidget(button[BtnMinimize]); - button[BtnMinimize]->show(); - } - else if (c == 'A' && isMaximizable()) { - hb->addWidget(button[BtnMaximize]); - button[BtnMaximize]->show(); - } - else if (help && c == 'H') { - hb->addWidget(button[BtnHelp]); - button[BtnHelp]->show(); - } - else if (c == 't') - hb->addItem(titlebar); - - if ((*button_pattern)[i] >= 'A' && (*button_pattern)[i] <= 'Z') - hb->addSpacing(1); - } - - g->addLayout( hb, 0, 1 ); - setBackgroundMode(NoBackground); - recalcTitleBuffer(); -} - - -void ModernSys::maxButtonClicked( ) -{ - switch ( button[BtnMaximize]->last_button ) { - case MidButton: - maximize( MaximizeVertical ); - break; - case RightButton: - maximize( MaximizeHorizontal ); - break; - default: //LeftButton: - maximize( MaximizeFull ); - break; - } -} - -void ModernSys::resizeEvent( QResizeEvent* ) -{ - recalcTitleBuffer(); - doShape(); -} - -void ModernSys::recalcTitleBuffer() -{ - if(oldTitle == caption() && width() == titleBuffer.width()) - return; - QFontMetrics fm(options->font(true)); - titleBuffer.resize(width(), 18); - QPainter p; - p.begin(&titleBuffer); - if(aUpperGradient) - p.drawTiledPixmap(0, 0, width(), 18, *aUpperGradient); - else - p.fillRect(0, 0, width(), 18, - options->colorGroup(Options::TitleBar, true). - brush(QColorGroup::Button)); - - QRect t = titlebar->geometry(); - t.setTop( 2 ); - t.setLeft( t.left() ); - t.setRight( t.right() - 2 ); - - QRegion r(t.x(), 0, t.width(), 18); - r -= QRect(t.x()+((t.width()-fm.width(caption()))/2)-4, - 0, fm.width(caption())+8, 18); - p.setClipRegion(r); - int i, ly; - for(i=0, ly=4; i < 4; ++i, ly+=3){ - p.setPen(options->color(Options::TitleBar, true).light(150)); - p.drawLine(0, ly, width()-1, ly); - p.setPen(options->color(Options::TitleBar, true).dark(120)); - p.drawLine(0, ly+1, width()-1, ly+1); - } - p.setClipRect(t); - p.setPen(options->color(Options::Font, true)); - p.setFont(options->font(true)); - - p.drawText(t.x()+((t.width()-fm.width(caption()))/2)-4, - 0, fm.width(caption())+8, 18, AlignCenter, caption()); - p.setClipping(false); - p.end(); - oldTitle = caption(); -} - -void ModernSys::captionChange( const QString &) -{ - recalcTitleBuffer(); - repaint( titlebar->geometry(), false ); -} - -void ModernSys::drawRoundFrame(QPainter &p, int x, int y, int w, int h) -{ - kDrawRoundButton(&p, x, y, w, h, - options->colorGroup(Options::Frame, isActive()), false); - -} - -void ModernSys::paintEvent( QPaintEvent* ) -{ - int hs = handle_size; - int hw = handle_width; - - QPainter p( this ); - QRect t = titlebar->geometry(); - - QBrush fillBrush(colorGroup().brush(QColorGroup::Background).pixmap() ? - colorGroup().brush(QColorGroup::Background) : - options->colorGroup(Options::Frame, isActive()). - brush(QColorGroup::Button)); - - p.fillRect(1, 16, width()-2, height()-16, fillBrush); - p.fillRect(width()-6, 0, width()-1, height(), fillBrush); - - t.setTop( 2 ); - t.setLeft( t.left() ); - t.setRight( t.right() - 2 ); - - int w = width() - hw; // exclude handle - int h = height() - hw; - - // titlebar - QColorGroup g = options->colorGroup(Options::TitleBar, isActive()); - if(isActive()){ - p.drawPixmap(1, 1, titleBuffer, 0, 0, w-2, 18); - } - else{ - if(iUpperGradient) - p.drawTiledPixmap(1, 1, w-2, 18, *iUpperGradient); - else - p.fillRect(1, 1, w-2, 18, fillBrush); - p.setPen(options->color(Options::Font, isActive())); - p.setFont(options->font(isActive())); - p.drawText(t, AlignCenter, caption() ); - } - - // titlebar highlight - p.setPen(g.light()); - p.drawLine(1, 1, 1, 19); - p.drawLine(1, 1, w-3, 1); - p.setPen(g.dark()); - p.drawLine(w-2, 1, w-2, 19); - p.drawLine(0, 18, w-2, 18); - - // frame - g = options->colorGroup(Options::Frame, isActive()); - p.setPen(g.light()); - p.drawLine(1, 19, 1, h-2); - p.setPen(g.dark()); - p.drawLine(2, h-2, w-2, h-2); - p.drawLine(w-2, 19, w-2, h-2); - //p.drawPoint(w-3, 19); - //p.drawPoint(2, 19); - - qDrawShadePanel(&p, 3, 19, w-6, h-22, g, true); - - if (show_handle) { - p.setPen(g.dark()); - p.drawLine(width()-3, height()-hs-1, width()-3, height()-3); - p.drawLine(width()-hs-1, height()-3, width()-3, height()-3); - - p.setPen(g.light()); - p.drawLine(width()-hw, height()-hs-1, width()-hw, height()-hw); - p.drawLine(width()-hs-1, height()-hw, width()-hw, height()-hw); - p.drawLine(width()-hw, height()-hs-1, width()-4, height()-hs-1); - p.drawLine(width()-hs-1, height()-hw, width()-hs-1, height()-4); - - p.setPen(Qt::black); - p.drawRect(0, 0, w, h); - - // handle outline - p.drawLine(width()-hw, height()-hs, width(), height()-hs); - p.drawLine(width()-2, height()-hs, width()-2, height()-2); - p.drawLine(width()-hs, height()-2, width()-2, height()-2); - p.drawLine(width()-hs, height()-hw, width()-hs, height()-2); - } else { - p.setPen(Qt::black); - p.drawRect(0, 0, w, h); - } -} - -void ModernSys::doShape() -{ - int hs = handle_size; - int hw = handle_width; - QRegion mask; - mask += QRect(0, 0, width()-hw, height()-hw); - //single points - mask -= QRect(0, 0, 1, 1); - mask -= QRect(width()-hw-1, 0, 1, 1); - mask -= QRect(0, height()-hw-1, 1, 1); - - if (show_handle) { - mask += QRect(width()-hs, height()-hs, hs-1, hs-1); - mask -= QRect(width()-2, height()-2, 1, 1); - mask -= QRect(width()-2, height()-hs, 1, 1); - mask -= QRect(width()-hs, height()-2, 1, 1); - } else - mask -= QRect(width()-1, height()-1, 1, 1); - - setMask(mask); -} - -void ModernSys::showEvent(QShowEvent *ev) -{ - Client::showEvent(ev); - doShape(); - repaint(); -} - -void ModernSys::windowWrapperShowEvent( QShowEvent* ) -{ - doShape(); -} - -void ModernSys::mouseDoubleClickEvent( QMouseEvent * e ) -{ - if (titlebar->geometry().contains( e->pos() ) ) - workspace()->performWindowOperation( this, options->operationTitlebarDblClick() ); - workspace()->requestFocus( this ); -} - -void ModernSys::stickyChange(bool on) -{ - button[BtnSticky]->setBitmap(on ? unsticky_bits : sticky_bits); -} - -void ModernSys::maximizeChange(bool m) -{ - button[BtnMaximize]->setBitmap(m ? minmax_bits : maximize_bits); -} - -void ModernSys::init() -{ - // -} - -void ModernSys::activeChange(bool) -{ - repaint(false); - for (int i = 0; i < 5; button[i++]->reset()); -} - - -Client::MousePosition ModernSys::mousePosition( const QPoint& p) const -{ - MousePosition m = Client::mousePosition( p ); - - if ( show_handle && m == Center ) { - int border = handle_width + 4; - bool hx = (p.x() >= width() - border); - bool hy = (p.y() >= height() - border); - - if (hx && hy) - m = BottomRight; - else if (hx) - m = Right; - else if (hy) - m = Bottom; - } - return m; -} - - -// KWin extended plugin interface -extern "C" -{ - Client *allocate(Workspace *ws, WId w, int) - { - return(new ModernSys(ws, w)); - } - void init() - { - button_pattern = new QString; - create_pixmaps(); - read_config(); - config_changed = true; - } - void reset() - { - if (read_config()) - config_changed = true; - delete_pixmaps(); - create_pixmaps(); - } - void deinit() - { - delete_pixmaps(); - delete button_pattern; - } -} - -#include "modernsys.moc" -// vim:ts=4:sw=4 diff --git a/clients/modernsystem/modernsys.h b/clients/modernsystem/modernsys.h deleted file mode 100644 index 2fe8592af7..0000000000 --- a/clients/modernsystem/modernsys.h +++ /dev/null @@ -1,70 +0,0 @@ -// $Id$ -#ifndef __MODSYSTEMCLIENT_H -#define __MODSYSTEMCLIENT_H - -#include -#include -#include -#include "../../client.h" -class QLabel; -class QSpacerItem; - -namespace KWinInternal { - -// get rid of autohide :P -class ModernButton : public QButton -{ - Q_OBJECT -public: - ModernButton(Client *parent=0, const char *name=0, - const unsigned char *bitmap=NULL); - void setBitmap(const unsigned char *bitmap); - void reset(); - QSize sizeHint() const; -protected: - void mousePressEvent( QMouseEvent* e ); - void mouseReleaseEvent( QMouseEvent* e ); - - virtual void drawButton(QPainter *p); - void drawButtonLabel(QPainter *){;} - QBitmap deco; - Client *client; -public: - int last_button; -}; - -class ModernSys : public KWinInternal::Client -{ - Q_OBJECT -public: - ModernSys( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); - ~ModernSys(){;} -protected: - void drawRoundFrame(QPainter &p, int x, int y, int w, int h); - void resizeEvent( QResizeEvent* ); - void paintEvent( QPaintEvent* ); - void showEvent( QShowEvent* ); - void windowWrapperShowEvent( QShowEvent* ); - void mouseDoubleClickEvent( QMouseEvent * ); - void init(); - void captionChange( const QString& name ); - void stickyChange(bool on); - void maximizeChange(bool m); - void doShape(); - void recalcTitleBuffer(); - void activeChange(bool); - MousePosition mousePosition( const QPoint& ) const; -protected slots: - void slotReset(); - void maxButtonClicked(); -private: - enum Buttons{ BtnClose = 0, BtnSticky, BtnMinimize, BtnMaximize, BtnHelp }; - ModernButton* button[5]; - QSpacerItem* titlebar; - QPixmap titleBuffer; - QString oldTitle; -}; - -}; - -#endif diff --git a/clients/modernsystem/modernsystem.desktop b/clients/modernsystem/modernsystem.desktop deleted file mode 100644 index 5ae7d131c0..0000000000 --- a/clients/modernsystem/modernsystem.desktop +++ /dev/null @@ -1,3 +0,0 @@ -[Desktop Entry] -Name=ModSystem -X-KDE-Library=libkwinmodernsys diff --git a/clients/system/Makefile.am b/clients/system/Makefile.am deleted file mode 100644 index 21d3f1e107..0000000000 --- a/clients/system/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ - -INCLUDES = $(all_includes) - -kde_module_LTLIBRARIES = libkwinsystem.la - -libkwinsystem_la_SOURCES = systemclient.cpp -libkwinsystem_la_LIBADD = ../../kwin.la -libkwinsystem_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) - -METASOURCES = AUTO -noinst_HEADERS = systemclient.h - -lnkdir = $(kde_datadir)/kwin/ -lnk_DATA = system.desktop - -EXTRA_DIST = $(lnk_DATA) - - -###KMAKE-start (don't edit or delete this block) - -###KMAKE-end diff --git a/clients/system/system.desktop b/clients/system/system.desktop deleted file mode 100644 index 98e64dd933..0000000000 --- a/clients/system/system.desktop +++ /dev/null @@ -1,20 +0,0 @@ -[Desktop Entry] -Name=System++ -Name[ca]=Sistema++ -Name[cs]=Systém++ -Name[eo]=Sistemo++ -Name[et]=Süsteem++ -Name[fi]=Järjestelmä++ -Name[fr]=Système++ -Name[is]=Kerfi++ -Name[ko]=시스템++ -Name[lv]=Sistēma++ -Name[mk]=Систем++ -Name[nl]=Systeem++ -Name[oc]=Sistemo++ -Name[ro]=Sistem++ -Name[sk]=Systém++ -Name[sl]=Sistem++ -Name[tr]=Sistem++ -Name[zh_TW.Big5]=系統++ -X-KDE-Library=libkwinsystem diff --git a/clients/system/systemclient.cpp b/clients/system/systemclient.cpp deleted file mode 100644 index 8751e89d57..0000000000 --- a/clients/system/systemclient.cpp +++ /dev/null @@ -1,555 +0,0 @@ -#include "systemclient.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../workspace.h" -#include "../../options.h" - -using namespace KWinInternal; - - -static unsigned char iconify_bits[] = { - 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00}; - -static unsigned char maximize_bits[] = { - 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00}; - -static unsigned char minmax_bits[] = { - 0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f}; - -static unsigned char unsticky_bits[] = { - 0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00}; - -static unsigned char sticky_bits[] = { - 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00}; - -static unsigned char question_bits[] = { - 0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}; - -static KPixmap *aUpperGradient=0; -static KPixmap *iUpperGradient=0; - -static KPixmap *btnPix=0; -static KPixmap *btnPixDown=0; -static KPixmap *iBtnPix=0; -static KPixmap *iBtnPixDown=0; -static QColor *btnForeground; - -static bool pixmaps_created = false; - -static void drawButtonFrame(KPixmap *pix, const QColorGroup &g) -{ - QPainter p; - p.begin(pix); - p.setPen(g.mid()); - p.drawLine(0, 0, 13, 0); - p.drawLine(0, 0, 0, 13); - p.setPen(g.light()); - p.drawLine(13, 0, 13, 13); - p.drawLine(0, 13, 13, 13); - p.setPen(g.dark()); - p.drawRect(1, 1, 12, 12); - p.end(); -} - -static void create_pixmaps() -{ - if(pixmaps_created) - return; - pixmaps_created = true; - - if(QPixmap::defaultDepth() > 8){ - // titlebar - aUpperGradient = new KPixmap; - aUpperGradient->resize(32, 18); - iUpperGradient = new KPixmap; - iUpperGradient->resize(32, 18); - QColor bgColor = kapp->palette().normal().background(); - KPixmapEffect::gradient(*aUpperGradient, - options->color(Options::Frame, true).light(130), - bgColor, - KPixmapEffect::VerticalGradient); - KPixmapEffect::gradient(*iUpperGradient, - options->color(Options::Frame, false).light(130), - bgColor, - KPixmapEffect::VerticalGradient); - - // buttons - KPixmap aPix; - aPix.resize(12, 12); - KPixmap iPix; - iPix.resize(12, 12); - KPixmap aInternal; - aInternal.resize(8, 8); - KPixmap iInternal; - iInternal.resize(8, 8); - - QColor hColor(options->color(Options::ButtonBg, false)); - KPixmapEffect::gradient(iInternal, - hColor.dark(120), - hColor.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(iPix, - hColor.light(150), - hColor.dark(150), - KPixmapEffect::DiagonalGradient); - - hColor =options->color(Options::ButtonBg, true); - KPixmapEffect::gradient(aInternal, - hColor.dark(120), - hColor.light(120), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(aPix, - hColor.light(150), - hColor.dark(150), - KPixmapEffect::DiagonalGradient); - bitBlt(&aPix, 1, 1, &aInternal, 0, 0, 8, 8, Qt::CopyROP, true); - bitBlt(&iPix, 1, 1, &iInternal, 0, 0, 8, 8, Qt::CopyROP, true); - - // normal buttons - btnPix = new KPixmap; - btnPix->resize(14, 14); - bitBlt(btnPix, 2, 2, &aPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(btnPix, options->colorGroup(Options::Frame, true)); - - iBtnPix = new KPixmap; - iBtnPix->resize(14, 14); - bitBlt(iBtnPix, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(iBtnPix, options->colorGroup(Options::Frame, false)); - - - // pressed buttons - hColor = options->color(Options::ButtonBg, false); - KPixmapEffect::gradient(iInternal, - hColor.light(130), - hColor.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(iPix, - hColor.light(150), - hColor.dark(150), - KPixmapEffect::DiagonalGradient); - - hColor =options->color(Options::ButtonBg, true); - KPixmapEffect::gradient(aInternal, - hColor.light(130), - hColor.dark(130), - KPixmapEffect::DiagonalGradient); - KPixmapEffect::gradient(aPix, - hColor.light(150), - hColor.dark(150), - KPixmapEffect::DiagonalGradient); - bitBlt(&aPix, 1, 1, &aInternal, 0, 0, 8, 8, Qt::CopyROP, true); - bitBlt(&iPix, 1, 1, &iInternal, 0, 0, 8, 8, Qt::CopyROP, true); - - btnPixDown = new KPixmap; - btnPixDown->resize(14, 14); - bitBlt(btnPixDown, 2, 2, &aPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(btnPixDown, options->colorGroup(Options::Frame, - true)); - - iBtnPixDown = new KPixmap; - iBtnPixDown->resize(14, 14); - bitBlt(iBtnPixDown, 2, 2, &iPix, 0, 0, 10, 10, Qt::CopyROP, true); - drawButtonFrame(iBtnPixDown, options->colorGroup(Options::Frame, - false)); - } - if(qGray(options->color(Options::ButtonBg, true).rgb()) > 128) - btnForeground = new QColor(Qt::black); - else - btnForeground = new QColor(Qt::white); -} - -static void delete_pixmaps() -{ - if(aUpperGradient){ - delete aUpperGradient; - delete iUpperGradient; - delete btnPix; - delete btnPixDown; - delete iBtnPix; - delete iBtnPixDown; - aUpperGradient = 0; - } - delete btnForeground; - pixmaps_created = false; -} - -SystemButton::SystemButton(Client *parent, const char *name, - const unsigned char *bitmap) - : QToolButton(parent, name) -{ - setBackgroundMode( NoBackground ); - resize(14, 14); - connect( this, SIGNAL( clicked() ), this, SLOT( handleClicked() ) ); - if(bitmap) - setBitmap(bitmap); - client = parent; -} - -QSize SystemButton::sizeHint() const -{ - return(QSize(14, 14)); -} - -void SystemButton::reset() -{ - repaint(false); -} - -void SystemButton::setBitmap(const unsigned char *bitmap) -{ - deco = QBitmap(8, 8, bitmap, true); - deco.setMask(deco); - repaint(); -} - -void SystemButton::drawButton(QPainter *p) -{ - if(btnPixDown){ - if(client->isActive()) - p->drawPixmap(0, 0, isDown() ? *btnPixDown : *btnPix); - else - p->drawPixmap(0, 0, isDown() ? *iBtnPixDown : *iBtnPix); - } - else{ - QColorGroup g = options->colorGroup(Options::Frame, - client->isActive()); - int x2 = width()-1; - int y2 = height()-1; - // outer frame - p->setPen(g.mid()); - p->drawLine(0, 0, x2, 0); - p->drawLine(0, 0, 0, y2); - p->setPen(g.light()); - p->drawLine(x2, 0, x2, y2); - p->drawLine(0, x2, y2, x2); - p->setPen(g.dark()); - p->drawRect(1, 1, width()-2, height()-2); - // inner frame - g = options->colorGroup(Options::ButtonBg, client->isActive()); - p->fillRect(3, 3, width()-6, height()-6, g.background()); - p->setPen(isDown() ? g.mid() : g.light()); - p->drawLine(2, 2, x2-2, 2); - p->drawLine(2, 2, 2, y2-2); - p->setPen(isDown() ? g.light() : g.mid()); - p->drawLine(x2-2, 2, x2-2, y2-2); - p->drawLine(2, x2-2, y2-2, x2-2); - - } - - if(!deco.isNull()){ - p->setPen(*btnForeground); - p->drawPixmap(isDown() ? 4 : 3, isDown() ? 4 : 3, deco); - } - - -} - -void SystemButton::mousePressEvent( QMouseEvent* e ) -{ - last_button = e->button(); - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QToolButton::mousePressEvent( &me ); -} - -void SystemButton::mouseReleaseEvent( QMouseEvent* e ) -{ - QMouseEvent me ( e->type(), e->pos(), e->globalPos(), LeftButton, e->state() ); - QToolButton::mouseReleaseEvent( &me ); -} - -void SystemButton::handleClicked() -{ - emit clicked( last_button ); -} - - -void SystemClient::slotReset() -{ - titleBuffer.resize(0, 0); - recalcTitleBuffer(); - repaint(); - button[0]->reset(); - button[1]->reset(); - button[2]->reset(); - button[3]->reset(); - if(button[4]) - button[4]->reset(); -} - -void SystemClient::maxButtonClicked( int button ) -{ - switch ( button ){ - case MidButton: - maximize( MaximizeVertical ); - break; - case RightButton: - maximize( MaximizeHorizontal ); - break; - default: //LeftButton: - maximize( MaximizeFull ); - break; - } -} - -SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent, - const char *name ) - : Client( ws, w, parent, name, WResizeNoErase ) -{ - connect(options, SIGNAL(resetClients()), this, SLOT(slotReset())); - bool help = providesContextHelp(); - - QGridLayout* g = new QGridLayout(this, 0, 0, 2); - g->setRowStretch(1, 10); - g->addWidget(windowWrapper(), 1, 1 ); - g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) ); - - g->addColSpacing(0, 2); - g->addColSpacing(2, 2); - g->addRowSpacing(2, 6); - - button[0] = new SystemButton(this, "close"/*, close_bits*/); - button[1] = new SystemButton(this, "sticky"); - if(isSticky()) - button[1]->setBitmap(unsticky_bits); - else - button[1]->setBitmap(sticky_bits); - button[2] = new SystemButton(this, "iconify", iconify_bits); - button[3] = new SystemButton(this, "maximize", maximize_bits); - if(help){ - button[4] = new SystemButton(this, "help", question_bits); - connect( button[4], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) ); - } - else - button[4] = NULL; - - connect( button[0], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) ); - connect( button[1], SIGNAL( clicked() ), this, ( SLOT( toggleSticky() ) ) ); - connect( button[2], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) ); - connect( button[3], SIGNAL( clicked(int) ), this, ( SLOT( maxButtonClicked(int) ) ) ); - - QHBoxLayout* hb = new QHBoxLayout(0); - hb->setResizeMode(QLayout::FreeResize); - g->addLayout( hb, 0, 1 ); - hb->addSpacing(3); - hb->addWidget( button[0]); - titlebar = new QSpacerItem(10, 14, QSizePolicy::Expanding, - QSizePolicy::Minimum); - hb->addSpacing(3); - hb->addItem(titlebar); - hb->addSpacing(3); - if(help){ - hb->addWidget( button[4]); - hb->addSpacing(1); - } - hb->addWidget( button[1]); - hb->addSpacing(1); - hb->addWidget( button[2]); - hb->addSpacing(1); - hb->addWidget( button[3]); - hb->addSpacing(3); - - setBackgroundMode(NoBackground); - recalcTitleBuffer(); - -} - -void SystemClient::resizeEvent( QResizeEvent* ) -{ - //Client::resizeEvent( e ); - recalcTitleBuffer(); - doShape(); - /* - if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) { - QPainter p( this ); - QRect t = titlebar->geometry(); - t.setTop( 0 ); - QRegion r = rect(); - r = r.subtract( t ); - p.setClipRegion( r ); - p.eraseRect( rect() ); - }*/ -} - -void SystemClient::recalcTitleBuffer() -{ - if(oldTitle == caption() && width() == titleBuffer.width()) - return; - QFontMetrics fm(options->font(true)); - titleBuffer.resize(width(), 18); - QPainter p; - p.begin(&titleBuffer); - if(aUpperGradient) - p.drawTiledPixmap(0, 0, width(), 18, *aUpperGradient); - else - p.fillRect(0, 0, width(), 18, - options->colorGroup(Options::Frame, true). - brush(QColorGroup::Button)); - - QRect t = titlebar->geometry(); - t.setTop( 2 ); - t.setLeft( t.left() + 4 ); - t.setRight( t.right() - 2 ); - - QRegion r(t.x(), 0, t.width(), 18); - r -= QRect(t.x()+((t.width()-fm.width(caption()))/2)-4, - 0, fm.width(caption())+8, 18); - p.setClipRegion(r); - int i, ly; - for(i=0, ly=4; i < 4; ++i, ly+=3){ - p.setPen(options->color(Options::TitleBar, true).light(150)); - p.drawLine(0, ly, width()-1, ly); - p.setPen(options->color(Options::TitleBar, true).dark(120)); - p.drawLine(0, ly+1, width()-1, ly+1); - } - p.setClipRect(t); - p.setPen(options->color(Options::Font, true)); - p.setFont(options->font(true)); - - p.drawText(t.x()+((t.width()-fm.width(caption()))/2)-4, - 0, fm.width(caption())+8, 18, AlignCenter, caption()); - p.setClipping(false); - p.end(); - oldTitle = caption(); -} - -void SystemClient::captionChange( const QString &) -{ - recalcTitleBuffer(); - repaint( titlebar->geometry(), false ); -} - -void SystemClient::drawRoundFrame(QPainter &p, int x, int y, int w, int h) -{ - kDrawRoundButton(&p, x, y, w, h, - options->colorGroup(Options::Frame, isActive()), false); - -} - -void SystemClient::paintEvent( QPaintEvent* ) -{ - QPainter p( this ); - QRect t = titlebar->geometry(); - - QBrush fillBrush(colorGroup().brush(QColorGroup::Background).pixmap() ? - colorGroup().brush(QColorGroup::Background) : - options->colorGroup(Options::Frame, isActive()). - brush(QColorGroup::Button)); - - p.fillRect(1, 18, width()-2, height()-19, fillBrush); - - t.setTop( 2 ); - t.setLeft( t.left() + 4 ); - t.setRight( t.right() - 2 ); - - if(isActive()) - p.drawPixmap(0, 0, titleBuffer); - else{ - if(iUpperGradient) - p.drawTiledPixmap(0, 0, width(), 18, *iUpperGradient); - else - p.fillRect(0, 0, width(), 18, fillBrush); - p.setPen(options->color(Options::Font, isActive())); - p.setFont(options->font(isActive())); - p.drawText(t, AlignCenter, caption() ); - } - - - - p.setPen(options->colorGroup(Options::Frame, isActive()).light()); - p.drawLine(width()-20, height()-7, width()-10, height()-7); - p.drawLine(width()-20, height()-5, width()-10, height()-5); - p.setPen(options->colorGroup(Options::Frame, isActive()).dark()); - p.drawLine(width()-20, height()-6, width()-10, height()-6); - p.drawLine(width()-20, height()-4, width()-10, height()-4); - - drawRoundFrame(p, 0, 0, width(), height()); -} - -#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) - -void SystemClient::doShape() -{ - // using a bunch of QRect lines seems much more efficent than bitmaps or - // point arrays - - QRegion mask; - kRoundMaskRegion(mask, 0, 0, width(), height()); - setMask(mask); -} - -void SystemClient::showEvent(QShowEvent *ev) -{ - Client::showEvent(ev); - doShape(); - repaint(); -} - -void SystemClient::windowWrapperShowEvent( QShowEvent* ) -{ - doShape(); -} - -void SystemClient::mouseDoubleClickEvent( QMouseEvent * e ) -{ - if (titlebar->geometry().contains( e->pos() ) ) - workspace()->performWindowOperation( this, options->operationTitlebarDblClick() ); - workspace()->requestFocus( this ); -} - -void SystemClient::stickyChange(bool on) -{ - button[1]->setBitmap(on ? unsticky_bits : sticky_bits); -} - -void SystemClient::maximizeChange(bool m) -{ - button[3]->setBitmap(m ? minmax_bits : maximize_bits); -} - -void SystemClient::init() -{ - // -} - -void SystemClient::activeChange(bool) -{ - repaint(false); - button[0]->reset(); - button[1]->reset(); - button[2]->reset(); - button[3]->reset(); - if(button[4]) - button[4]->reset(); -} - -extern "C" -{ - Client *allocate(Workspace *ws, WId w, int) - { - return(new SystemClient(ws, w)); - } - void init() - { - create_pixmaps(); - } - void reset() - { - delete_pixmaps(); - create_pixmaps(); - } - void deinit() - { - delete_pixmaps(); - } -} - -#include "systemclient.moc" diff --git a/clients/system/systemclient.h b/clients/system/systemclient.h deleted file mode 100644 index 49991427bb..0000000000 --- a/clients/system/systemclient.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef __SYSTEMCLIENT_H -#define __SYSTEMCLIENT_H - -#include -#include - -#include -#include -#include "../../client.h" - - -class QLabel; -class QSpacerItem; - -namespace KWinInternal { - -class SystemButton : public QToolButton -{ - Q_OBJECT -public: - SystemButton(Client *parent=0, const char *name=0, - const unsigned char *bitmap=NULL); - void setBitmap(const unsigned char *bitmap); - void reset(); - QSize sizeHint() const; -signals: - void clicked( int ); -protected: - virtual void drawButton(QPainter *p); - void drawButtonLabel(QPainter *){;} - QBitmap deco; - Client *client; - - void mousePressEvent( QMouseEvent* e ); - void mouseReleaseEvent( QMouseEvent* e ); - -private slots: - void handleClicked(); - -private: - int last_button; - -}; - -class SystemClient : public KWinInternal::Client -{ - Q_OBJECT -public: - SystemClient( Workspace *ws, WId w, QWidget *parent=0, const char *name=0 ); - ~SystemClient(){;} -protected: - void drawRoundFrame(QPainter &p, int x, int y, int w, int h); - void resizeEvent( QResizeEvent* ); - void paintEvent( QPaintEvent* ); - void showEvent( QShowEvent* ); - void windowWrapperShowEvent( QShowEvent* ); - void mouseDoubleClickEvent( QMouseEvent * ); - void init(); - void captionChange( const QString& name ); - void stickyChange(bool on); - void maximizeChange(bool m); - void doShape(); - void recalcTitleBuffer(); - void activeChange(bool); -protected slots: - void slotReset(); -private slots: - void maxButtonClicked( int ); - -private: - SystemButton* button[5]; - QSpacerItem* titlebar; - QPixmap titleBuffer; - QString oldTitle; -}; - -}; - -#endif