New KWM theme client stuff, as described in my earlier email to core-devel
svn path=/trunk/kdebase/kwin/; revision=84131icc-effect-5.14.5
parent
2df31287aa
commit
eeb5bb19e3
|
@ -17,6 +17,7 @@
|
||||||
#include "../../workspace.h"
|
#include "../../workspace.h"
|
||||||
#include "../../options.h"
|
#include "../../options.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace KWinInternal;
|
using namespace KWinInternal;
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -27,6 +28,47 @@ extern "C"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
enum FramePixmap{FrameTop=0, FrameBottom, FrameLeft, FrameRight, FrameTopLeft,
|
||||||
FrameTopRight, FrameBottomLeft, FrameBottomRight};
|
FrameTopRight, FrameBottomLeft, FrameBottomRight};
|
||||||
|
@ -65,6 +107,12 @@ static void init_theme()
|
||||||
if(framePixmaps[i]->isNull())
|
if(framePixmaps[i]->isNull())
|
||||||
qWarning("Unable to load frame pixmap for %s", keys[i]);
|
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();
|
maxExtent = framePixmaps[FrameTop]->height();
|
||||||
if(framePixmaps[FrameBottom]->height() > maxExtent)
|
if(framePixmaps[FrameBottom]->height() > maxExtent)
|
||||||
maxExtent = framePixmaps[FrameBottom]->height();
|
maxExtent = framePixmaps[FrameBottom]->height();
|
||||||
|
@ -110,7 +158,7 @@ static void init_theme()
|
||||||
else
|
else
|
||||||
titleAlign = Qt::AlignLeft | Qt::AlignVCenter;
|
titleAlign = Qt::AlignLeft | Qt::AlignVCenter;
|
||||||
titleSunken = config->readBoolEntry("TitleFrameShaded", true);
|
titleSunken = config->readBoolEntry("TitleFrameShaded", true);
|
||||||
titleSunken = true; // FIXME
|
// titleSunken = true; // is this fixed?
|
||||||
titleTransparent = config->readBoolEntry("PixmapUnderTitleText", true);
|
titleTransparent = config->readBoolEntry("PixmapUnderTitleText", true);
|
||||||
|
|
||||||
tmpStr = config->readEntry("TitlebarLook");
|
tmpStr = config->readEntry("TitlebarLook");
|
||||||
|
@ -203,7 +251,7 @@ KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
const char *name )
|
const char *name )
|
||||||
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity)
|
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity)
|
||||||
{
|
{
|
||||||
stickyBtn = maxBtn = 0;
|
stickyBtn = maxBtn = mnuBtn = 0;
|
||||||
init_theme();
|
init_theme();
|
||||||
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
|
||||||
QGridLayout *layout = new QGridLayout(this);
|
QGridLayout *layout = new QGridLayout(this);
|
||||||
|
@ -241,10 +289,12 @@ KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
key += QChar(keyOffsets[i]);
|
key += QChar(keyOffsets[i]);
|
||||||
val = config->readEntry(key, defaultButtons[i]);
|
val = config->readEntry(key, defaultButtons[i]);
|
||||||
if(val == "Menu"){
|
if(val == "Menu"){
|
||||||
btn = new MyButton(this, "menu");
|
mnuBtn = new MyButton(this, "menu");
|
||||||
btn->setPixmap(*menuPix);
|
iconChange();
|
||||||
hb->addWidget(btn);
|
hb->addWidget(mnuBtn);
|
||||||
btn->setFixedSize(20, 20);
|
mnuBtn->setFixedSize(20, 20);
|
||||||
|
connect(mnuBtn, SIGNAL(pressed()), this,
|
||||||
|
SLOT(menuButtonPressed()));
|
||||||
}
|
}
|
||||||
else if(val == "Sticky"){
|
else if(val == "Sticky"){
|
||||||
stickyBtn = new MyButton(this, "sticky");
|
stickyBtn = new MyButton(this, "sticky");
|
||||||
|
@ -287,7 +337,6 @@ KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
|
||||||
aGradient = 0;
|
aGradient = 0;
|
||||||
iGradient = 0;
|
iGradient = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setBackgroundMode(NoBackground);
|
setBackgroundMode(NoBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,13 +394,7 @@ void KWMThemeClient::resizeEvent( QResizeEvent* e)
|
||||||
Client::resizeEvent( e );
|
Client::resizeEvent( e );
|
||||||
doShape();
|
doShape();
|
||||||
if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) {
|
if ( isVisibleToTLW() && !testWFlags( WNorthWestGravity )) {
|
||||||
QPainter p( this );
|
repaint(); // ugh! Not even this works...
|
||||||
QRect t = titlebar->geometry();
|
|
||||||
t.setTop( 0 );
|
|
||||||
QRegion r = rect();
|
|
||||||
r = r.subtract( t );
|
|
||||||
p.setClipRegion( r );
|
|
||||||
p.eraseRect( rect() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,118 +403,298 @@ void KWMThemeClient::captionChange( const QString& )
|
||||||
repaint( titlebar->geometry(), false );
|
repaint( titlebar->geometry(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWMThemeClient::paintEvent( QPaintEvent*e )
|
void KWMThemeClient::paintEvent( QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter p;
|
QPainter p;
|
||||||
p.begin(this);
|
p.begin(this);
|
||||||
|
int x,y;
|
||||||
// first the corners
|
// first the corners
|
||||||
int w1 = framePixmaps[FrameTopLeft]->width();
|
int w1 = framePixmaps[FrameTopLeft]->width();
|
||||||
int h1 = framePixmaps[FrameTopLeft]->height();
|
int h1 = framePixmaps[FrameTopLeft]->height();
|
||||||
if (w1 > width()/2) w1 = width()/2;
|
if (w1 > width()/2) w1 = width()/2;
|
||||||
if (h1 > height()/2) h1 = height()/2;
|
if (h1 > height()/2) h1 = height()/2;
|
||||||
bitBlt(this, 0,0, framePixmaps[FrameTopLeft],
|
p.drawPixmap(0,0,*framePixmaps[FrameTopLeft],
|
||||||
0,0, w1, h1);
|
0,0,w1, h1);
|
||||||
|
|
||||||
int w2 = framePixmaps[FrameTopRight]->width();
|
int w2 = framePixmaps[FrameTopRight]->width();
|
||||||
int h2 = framePixmaps[FrameTopRight]->height();
|
int h2 = framePixmaps[FrameTopRight]->height();
|
||||||
if (w2 > width()/2) w2 = width()/2;
|
if (w2 > width()/2) w2 = width()/2;
|
||||||
if (h2 > height()/2) h2 = height()/2;
|
if (h2 > height()/2) h2 = height()/2;
|
||||||
bitBlt(this, width()-w2,0, framePixmaps[FrameTopRight],
|
p.drawPixmap(width()-w2,0,*framePixmaps[FrameTopRight],
|
||||||
framePixmaps[FrameTopRight]->width()-w2,0,w2, h2);
|
framePixmaps[FrameTopRight]->width()-w2,0,w2, h2);
|
||||||
|
|
||||||
int w3 = framePixmaps[FrameBottomLeft]->width();
|
int w3 = framePixmaps[FrameBottomLeft]->width();
|
||||||
int h3 = framePixmaps[FrameBottomLeft]->height();
|
int h3 = framePixmaps[FrameBottomLeft]->height();
|
||||||
if (w3 > width()/2) w3 = width()/2;
|
if (w3 > width()/2) w3 = width()/2;
|
||||||
if (h3 > height()/2) h3 = height()/2;
|
if (h3 > height()/2) h3 = height()/2;
|
||||||
bitBlt(this, 0,height()-h3, framePixmaps[FrameBottomLeft],
|
p.drawPixmap(0,height()-h3,*framePixmaps[FrameBottomLeft],
|
||||||
0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3);
|
0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3);
|
||||||
|
|
||||||
int w4 = framePixmaps[FrameBottomRight]->width();
|
int w4 = framePixmaps[FrameBottomRight]->width();
|
||||||
int h4 = framePixmaps[FrameBottomRight]->height();
|
int h4 = framePixmaps[FrameBottomRight]->height();
|
||||||
if (w4 > width()/2) w4 = width()/2;
|
if (w4 > width()/2) w4 = width()/2;
|
||||||
if (h4 > height()/2) h4 = height()/2;
|
if (h4 > height()/2) h4 = height()/2;
|
||||||
bitBlt(this, width()-w4,height()-h4, framePixmaps[FrameBottomRight],
|
p.drawPixmap(width()-w4,height()-h4,*(framePixmaps[FrameBottomRight]),
|
||||||
framePixmaps[FrameBottomRight]->width()-w4,
|
framePixmaps[FrameBottomRight]->width()-w4,
|
||||||
framePixmaps[FrameBottomRight]->height()-h4,
|
framePixmaps[FrameBottomRight]->height()-h4,
|
||||||
w4, h4);
|
w4, h4);
|
||||||
|
|
||||||
QPixmap *curPix = framePixmaps[FrameTop];
|
QPixmap pm;
|
||||||
p.drawTiledPixmap(w1, maxExtent-curPix->height(), width()-w2-w1,
|
QWMatrix m;
|
||||||
curPix->height(), *curPix);
|
int n,s,w;
|
||||||
curPix = framePixmaps[FrameBottom];
|
//top
|
||||||
p.drawTiledPixmap(w3, height()-maxExtent, width()-w3-w4,
|
pm = *framePixmaps[FrameTop];
|
||||||
curPix->height(), *curPix);
|
|
||||||
curPix = framePixmaps[FrameLeft];
|
|
||||||
p.drawTiledPixmap(maxExtent-curPix->width(), h1, curPix->width(),
|
|
||||||
height()-h1-h3, *curPix);
|
|
||||||
|
|
||||||
curPix = framePixmaps[FrameRight];
|
s = width()-w2-w1;
|
||||||
p.drawTiledPixmap(width()-maxExtent, h2, curPix->width(),
|
n = s/pm.width();
|
||||||
height()-h2-h4, *curPix);
|
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];
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
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);
|
drawTitle(p);
|
||||||
|
// 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(colorGroup().background());
|
||||||
|
p.drawRect(maxExtent-1, maxExtent-1, width()-(maxExtent-1)*2,
|
||||||
|
height()-(maxExtent-1)*2);
|
||||||
|
|
||||||
p.end();
|
p.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWMThemeClient::doShape()
|
void KWMThemeClient::doShape()
|
||||||
{
|
{
|
||||||
QBitmap mask(width(), height());
|
|
||||||
mask.fill(color0);
|
|
||||||
QPainter p;
|
|
||||||
|
|
||||||
|
QBitmap shapemask(width(), height());
|
||||||
|
shapemask.fill(color0);
|
||||||
|
QPainter p;
|
||||||
|
p.begin(&shapemask);
|
||||||
|
p.setBrush(color1);
|
||||||
|
p.setPen(color1);
|
||||||
|
int x,y;
|
||||||
// first the corners
|
// first the corners
|
||||||
int w1 = framePixmaps[FrameTopLeft]->width();
|
int w1 = framePixmaps[FrameTopLeft]->width();
|
||||||
int h1 = framePixmaps[FrameTopLeft]->height();
|
int h1 = framePixmaps[FrameTopLeft]->height();
|
||||||
if (w1 > width()/2) w1 = width()/2;
|
if (w1 > width()/2) w1 = width()/2;
|
||||||
if (h1 > height()/2) h1 = height()/2;
|
if (h1 > height()/2) h1 = height()/2;
|
||||||
bitBlt(&mask, 0,0,framePixmaps[FrameTopLeft]->mask(),
|
p.drawPixmap(0,0,*framePixmaps[FrameTopLeft]->mask(),
|
||||||
0,0,w1, h1);
|
0,0,w1, h1);
|
||||||
int w2 = framePixmaps[FrameTopRight]->width();
|
int w2 = framePixmaps[FrameTopRight]->width();
|
||||||
int h2 = framePixmaps[FrameTopRight]->height();
|
int h2 = framePixmaps[FrameTopRight]->height();
|
||||||
if (w2 > width()/2) w2 = width()/2;
|
if (w2 > width()/2) w2 = width()/2;
|
||||||
if (h2 > height()/2) h2 = height()/2;
|
if (h2 > height()/2) h2 = height()/2;
|
||||||
bitBlt(&mask, width()-w2,0,framePixmaps[FrameTopRight]->mask(),
|
p.drawPixmap(width()-w2,0,*framePixmaps[FrameTopRight]->mask(),
|
||||||
framePixmaps[FrameTopRight]->width()-w2,0,w2, h2);
|
framePixmaps[FrameTopRight]->width()-w2,0,w2, h2);
|
||||||
|
|
||||||
int w3 = framePixmaps[FrameBottomLeft]->width();
|
int w3 = framePixmaps[FrameBottomLeft]->width();
|
||||||
int h3 = framePixmaps[FrameBottomLeft]->height();
|
int h3 = framePixmaps[FrameBottomLeft]->height();
|
||||||
if (w3 > width()/2) w3 = width()/2;
|
if (w3 > width()/2) w3 = width()/2;
|
||||||
if (h3 > height()/2) h3 = height()/2;
|
if (h3 > height()/2) h3 = height()/2;
|
||||||
bitBlt(&mask, 0,height()-h3,framePixmaps[FrameBottomLeft]->mask(),
|
p.drawPixmap(0,height()-h3,*framePixmaps[FrameBottomLeft]->mask(),
|
||||||
0, framePixmaps[FrameBottomLeft]->height()-h3,w3, h3);
|
0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3);
|
||||||
|
|
||||||
int w4 = framePixmaps[FrameBottomRight]->width();
|
int w4 = framePixmaps[FrameBottomRight]->width();
|
||||||
int h4 = framePixmaps[FrameBottomRight]->height();
|
int h4 = framePixmaps[FrameBottomRight]->height();
|
||||||
if (w4 > width()/2) w4 = width()/2;
|
if (w4 > width()/2) w4 = width()/2;
|
||||||
if (h4 > height()/2) h4 = height()/2;
|
if (h4 > height()/2) h4 = height()/2;
|
||||||
bitBlt(&mask, width()-w4,height()-h4,framePixmaps[FrameBottomRight]->mask(),
|
p.drawPixmap(width()-w4,height()-h4,*framePixmaps[FrameBottomRight]->mask(),
|
||||||
framePixmaps[FrameBottomRight]->width()-w4,
|
framePixmaps[FrameBottomRight]->width()-w4,
|
||||||
framePixmaps[FrameBottomRight]->height()-h4,
|
framePixmaps[FrameBottomRight]->height()-h4,
|
||||||
w4, h4);
|
w4, h4);
|
||||||
|
|
||||||
p.begin(&mask);
|
QPixmap pm;
|
||||||
const QBitmap *curPix = framePixmaps[FrameTop]->mask();
|
QWMatrix m;
|
||||||
if (curPix)
|
int n,s,w;
|
||||||
p.drawTiledPixmap(w1, maxExtent-curPix->height(), width()-w2-w1,
|
//top
|
||||||
curPix->height(), *curPix);
|
pm = *framePixmaps[FrameTop]->mask();
|
||||||
curPix = framePixmaps[FrameBottom]->mask();
|
|
||||||
if (curPix)
|
s = width()-w2-w1;
|
||||||
p.drawTiledPixmap(w3, height()-maxExtent, width()-w3-w4,
|
n = s/pm.width();
|
||||||
curPix->height(), *curPix);
|
w = n>0?s/n:s;
|
||||||
curPix = framePixmaps[FrameLeft]->mask();
|
m.reset();
|
||||||
if (curPix)
|
m.scale(w/(float)pm.width(), 1);
|
||||||
p.drawTiledPixmap(maxExtent-curPix->width(), h1, curPix->width(),
|
pm = pm.xForm(m);
|
||||||
height()-h1-h3, *curPix);
|
|
||||||
curPix = framePixmaps[FrameRight]->mask();
|
x = w1;
|
||||||
if (curPix)
|
while (1){
|
||||||
p.drawTiledPixmap(width()-maxExtent, h2, curPix->width(),
|
if (pm.width() < width()-w2-x){
|
||||||
height()-h2-h4, *curPix);
|
p.drawPixmap(x,maxExtent-pm.height()-1,
|
||||||
p.setBrush(color1);
|
pm);
|
||||||
p.setPen(color1);
|
x += pm.width();
|
||||||
p.fillRect(maxExtent, maxExtent, width()-2*maxExtent,
|
}
|
||||||
height()-2*maxExtent, color1);
|
else {
|
||||||
p.end();
|
p.drawPixmap(x,maxExtent-pm.height()-1,
|
||||||
setMask(mask);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -537,10 +760,45 @@ Client::MousePosition KWMThemeClient::mousePosition(const QPoint &p) const
|
||||||
return(m);
|
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()
|
void KWMThemeClient::init()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "kwmthemeclient.moc"
|
#include "kwmthemeclient.moc"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QSpacerItem;
|
class QSpacerItem;
|
||||||
|
|
||||||
namespace KWinInternal {
|
namespace KWinInternal{
|
||||||
|
|
||||||
// QToolButton uses a 1 pixel border :P
|
// QToolButton uses a 1 pixel border :P
|
||||||
class MyButton : public QToolButton
|
class MyButton : public QToolButton
|
||||||
|
@ -38,13 +38,15 @@ protected:
|
||||||
void captionChange( const QString& name );
|
void captionChange( const QString& name );
|
||||||
void stickyChange(bool on);
|
void stickyChange(bool on);
|
||||||
void maximizeChange(bool m);
|
void maximizeChange(bool m);
|
||||||
|
void iconChange();
|
||||||
MousePosition mousePosition(const QPoint &) const;
|
MousePosition mousePosition(const QPoint &) const;
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotReset();
|
void slotReset();
|
||||||
|
void menuButtonPressed();
|
||||||
private:
|
private:
|
||||||
QPixmap buffer;
|
QPixmap buffer;
|
||||||
KPixmap *aGradient, *iGradient;
|
KPixmap *aGradient, *iGradient;
|
||||||
MyButton *maxBtn, *stickyBtn;
|
MyButton *maxBtn, *stickyBtn, *mnuBtn;
|
||||||
QSpacerItem *titlebar;
|
QSpacerItem *titlebar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue