[paintredirector] Pass KDecoration to PaintRedirector
Gives us more power in the future.
This commit is contained in:
parent
acd0015c6e
commit
1deea69170
3 changed files with 24 additions and 19 deletions
|
@ -460,7 +460,7 @@ void Client::createDecoration(const QRect& oldgeom)
|
|||
move(calculateGravitation(false));
|
||||
plainResize(sizeForClientSize(clientSize()), ForceGeometrySet);
|
||||
if (Compositor::compositing()) {
|
||||
paintRedirector = PaintRedirector::create(this, decoration->widget());
|
||||
paintRedirector = PaintRedirector::create(this, decoration);
|
||||
discardWindowPixmap();
|
||||
}
|
||||
emit geometryShapeChanged(this, oldgeom);
|
||||
|
|
|
@ -39,23 +39,24 @@ DEALINGS IN THE SOFTWARE.
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
PaintRedirector *PaintRedirector::create(Client *c, QWidget *widget)
|
||||
PaintRedirector *PaintRedirector::create(Client *c, KDecoration *deco)
|
||||
{
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
return new OpenGLPaintRedirector(c, widget);
|
||||
return new OpenGLPaintRedirector(c, deco);
|
||||
} else {
|
||||
return new RasterXRenderPaintRedirector(c, widget);
|
||||
return new RasterXRenderPaintRedirector(c, deco);
|
||||
}
|
||||
}
|
||||
|
||||
PaintRedirector::PaintRedirector(Client *c, QWidget* w)
|
||||
: QObject(w)
|
||||
, widget(w)
|
||||
PaintRedirector::PaintRedirector(Client *c, KDecoration *deco)
|
||||
: QObject(deco)
|
||||
, widget(deco->widget())
|
||||
, recursionCheck(false)
|
||||
, m_client(c)
|
||||
, m_decoration(deco)
|
||||
, m_requiresRepaint(false)
|
||||
{
|
||||
added(w);
|
||||
added(deco->widget());
|
||||
}
|
||||
|
||||
PaintRedirector::~PaintRedirector()
|
||||
|
@ -67,6 +68,7 @@ void PaintRedirector::reparent(Deleted *d)
|
|||
setParent(d);
|
||||
widget = NULL;
|
||||
m_client = NULL;
|
||||
m_decoration = NULL;
|
||||
}
|
||||
|
||||
static int align(int value, int align)
|
||||
|
@ -272,8 +274,8 @@ void PaintRedirector::paint(DecorationPixmap border, const QRect& r, const QRect
|
|||
|
||||
|
||||
|
||||
ImageBasedPaintRedirector::ImageBasedPaintRedirector(Client *c, QWidget *widget)
|
||||
: PaintRedirector(c, widget)
|
||||
ImageBasedPaintRedirector::ImageBasedPaintRedirector(Client *c, KDecoration *deco)
|
||||
: PaintRedirector(c, deco)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -307,8 +309,8 @@ void ImageBasedPaintRedirector::discardScratch()
|
|||
// ------------------------------------------------------------------
|
||||
|
||||
|
||||
OpenGLPaintRedirector::OpenGLPaintRedirector(Client *c, QWidget *widget)
|
||||
: ImageBasedPaintRedirector(c, widget)
|
||||
OpenGLPaintRedirector::OpenGLPaintRedirector(Client *c, KDecoration *deco)
|
||||
: ImageBasedPaintRedirector(c, deco)
|
||||
{
|
||||
for (int i = 0; i < TextureCount; ++i)
|
||||
m_textures[i] = NULL;
|
||||
|
@ -386,8 +388,8 @@ void OpenGLPaintRedirector::updatePixmaps(const QRect *rects, const QRegion ®
|
|||
|
||||
|
||||
|
||||
RasterXRenderPaintRedirector::RasterXRenderPaintRedirector(Client *c, QWidget *widget)
|
||||
: ImageBasedPaintRedirector(c, widget)
|
||||
RasterXRenderPaintRedirector::RasterXRenderPaintRedirector(Client *c, KDecoration *deco)
|
||||
: ImageBasedPaintRedirector(c, deco)
|
||||
, m_gc(0)
|
||||
{
|
||||
for (int i=0; i<PixmapCount; ++i) {
|
||||
|
|
|
@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
|
|||
// xcb
|
||||
#include <xcb/render.h>
|
||||
|
||||
class KDecoration;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
|
@ -84,12 +86,12 @@ public:
|
|||
* is created.
|
||||
**/
|
||||
void reparent(Deleted *d);
|
||||
static PaintRedirector *create(Client *c, QWidget* widget);
|
||||
static PaintRedirector *create(Client *c, KDecoration *deco);
|
||||
|
||||
public Q_SLOTS:
|
||||
void ensurePixmapsPainted();
|
||||
protected:
|
||||
PaintRedirector(Client *c, QWidget* widget);
|
||||
PaintRedirector(Client *c, KDecoration *deco);
|
||||
virtual xcb_render_picture_t picture(DecorationPixmap border) const;
|
||||
virtual GLTexture *texture(DecorationPixmap border) const;
|
||||
virtual void resizePixmaps(const QRect *rects);
|
||||
|
@ -117,6 +119,7 @@ private:
|
|||
QBasicTimer cleanupTimer;
|
||||
|
||||
Client *m_client;
|
||||
KDecoration *m_decoration;
|
||||
bool m_requiresRepaint;
|
||||
};
|
||||
|
||||
|
@ -126,7 +129,7 @@ class ImageBasedPaintRedirector : public PaintRedirector
|
|||
public:
|
||||
virtual ~ImageBasedPaintRedirector();
|
||||
protected:
|
||||
ImageBasedPaintRedirector(Client *c, QWidget *widget);
|
||||
ImageBasedPaintRedirector(Client *c, KDecoration *deco);
|
||||
virtual QPaintDevice *recreateScratch(const QSize &size);
|
||||
virtual QPaintDevice *scratch();
|
||||
virtual void fillScratch(Qt::GlobalColor color);
|
||||
|
@ -143,7 +146,7 @@ class OpenGLPaintRedirector : public ImageBasedPaintRedirector
|
|||
enum Texture { LeftRight = 0, TopBottom, TextureCount };
|
||||
|
||||
public:
|
||||
OpenGLPaintRedirector(Client *c, QWidget *widget);
|
||||
OpenGLPaintRedirector(Client *c, KDecoration *deco);
|
||||
virtual ~OpenGLPaintRedirector();
|
||||
|
||||
GLTexture *leftRightTexture() const { return m_textures[LeftRight]; }
|
||||
|
@ -161,7 +164,7 @@ class RasterXRenderPaintRedirector : public ImageBasedPaintRedirector
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RasterXRenderPaintRedirector(Client *c, QWidget *widget);
|
||||
RasterXRenderPaintRedirector(Client *c, KDecoration *deco);
|
||||
virtual ~RasterXRenderPaintRedirector();
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue