7ba2cf2d87
First off, Rikkus was right about double buffering. I really didn't think this was needed and tried everything to get rid of the flicker but it didn't happen until I double buffered the title. I was able to optimize this quite a bit (only recalc on resize, only buffer the active title/color scheme, etc...). In the meantime, I got rid of a lot of non-optimal painting and now use NoBackground for the widget. The latter was a obvious move as it avoids a whole clearing of the widget :P This resulted in a big speed improvement, which helps offset the time taken in buffering ;-) svn path=/trunk/kdebase/kwin/; revision=45264
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
#ifndef __SYSTEMCLIENT_H
|
|
#define __SYSTEMCLIENT_H
|
|
|
|
#include <qbutton.h>
|
|
#include <qbitmap.h>
|
|
#include <kpixmap.h>
|
|
#include "../../client.h"
|
|
class QLabel;
|
|
class QSpacerItem;
|
|
|
|
|
|
// get rid of autohide :P
|
|
class SystemButton : public QButton
|
|
{
|
|
public:
|
|
SystemButton(QWidget *parent=0, const char *name=0,
|
|
const unsigned char *bitmap=NULL);
|
|
void setBitmap(const unsigned char *bitmap);
|
|
void reset();
|
|
QSize sizeHint() const;
|
|
protected:
|
|
virtual void drawButton(QPainter *p);
|
|
void drawButtonLabel(QPainter *){;}
|
|
KPixmap aBackground, iBackground;
|
|
QBitmap deco;
|
|
};
|
|
|
|
class SystemClient : public 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();
|
|
protected slots:
|
|
void slotReset();
|
|
private:
|
|
SystemButton* button[5];
|
|
QSpacerItem* titlebar;
|
|
QPixmap titleBuffer;
|
|
QString oldTitle;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|