Added custom mouse position stuff for resizing themed windows. Speed hacks.
There is an error where everything is not redrawn I have to fix, but it's way faster now ;-) svn path=/trunk/kdebase/kwin/; revision=74668
This commit is contained in:
parent
58356f65ec
commit
8d82de546d
2 changed files with 33 additions and 3 deletions
|
@ -174,7 +174,7 @@ void MyButton::drawButtonLabel(QPainter *p)
|
|||
|
||||
KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
|
||||
const char *name )
|
||||
: Client( ws, w, parent, name, WResizeNoErase )
|
||||
: Client( ws, w, parent, name, WResizeNoErase | WNorthWestGravity)
|
||||
{
|
||||
init_theme();
|
||||
|
||||
|
@ -323,8 +323,6 @@ void KWMThemeClient::paintEvent( QPaintEvent* )
|
|||
{
|
||||
QPainter p;
|
||||
p.begin(this);
|
||||
p.fillRect(rect(), options->colorGroup(Options::Frame, isActive()).
|
||||
brush(QColorGroup::Background));
|
||||
|
||||
// first the corners
|
||||
int w1 = framePixmaps[FrameTopLeft]->width();
|
||||
|
@ -461,6 +459,37 @@ void KWMThemeClient::maximizeChange(bool m)
|
|||
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::init()
|
||||
{
|
||||
//
|
||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
|||
void captionChange( const QString& name );
|
||||
void stickyChange(bool on);
|
||||
void maximizeChange(bool m);
|
||||
MousePosition mousePosition(const QPoint &) const;
|
||||
private:
|
||||
KPixmap *aGradient, *iGradient;
|
||||
MyButton *maxBtn, *stickyBtn;
|
||||
|
|
Loading…
Reference in a new issue