summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@nokia.com>2010-10-07 22:35:07 +0300
committerAbdiel Janulgue <abdiel.janulgue@nokia.com>2010-10-07 22:35:07 +0300
commitfbc681ad51c5ee8cf22aee487b79b0756d929e91 (patch)
treebfa60d34c94f696d1cbe7f1bc996598ac19d0a59
parent893dcd475bdc370d6e307748252d98aa30b72101 (diff)
parente4a5021ee5ec1bc0b0777953c5fd2248fef22ea3 (diff)
Merge commit 'refs/merge-requests/49' of git@gitorious.org:meegotouch/meegotouch-compositor
-rw-r--r--src/mcompositemanager.cpp8
-rw-r--r--src/mcompositewindow.h9
-rw-r--r--src/mtexturepixmapitem.h12
-rw-r--r--src/mtexturepixmapitem_egl.cpp13
-rw-r--r--src/mtexturepixmapitem_glx.cpp8
-rw-r--r--src/mtexturepixmapitem_p.cpp10
-rw-r--r--src/mtexturepixmapitem_p.h2
7 files changed, 28 insertions, 34 deletions
diff --git a/src/mcompositemanager.cpp b/src/mcompositemanager.cpp
index 63be899..87af714 100644
--- a/src/mcompositemanager.cpp
+++ b/src/mcompositemanager.cpp
@@ -509,7 +509,8 @@ static void fullscreen_wm_state(MCompositeManagerPrivate *priv,
QRect r = availScreenRect;
XMoveResizeWindow(dpy, window, r.x(), r.y(), r.width(), r.height());
}
- priv->dirtyStacking(false);
+ if (win && win->propertyCache()->isMapped())
+ priv->dirtyStacking(false);
} break;
case 1: /* add */ {
if (i == -1) {
@@ -533,7 +534,8 @@ static void fullscreen_wm_state(MCompositeManagerPrivate *priv,
MDecoratorFrame::instance()->lower();
MDecoratorFrame::instance()->setManagedWindow(0);
}
- priv->dirtyStacking(false);
+ if (win && win->propertyCache()->isMapped())
+ priv->dirtyStacking(false);
} break;
case 2: /* toggle */ {
if (i == -1)
@@ -2197,7 +2199,7 @@ void MCompositeManagerPrivate::mapEvent(XMapEvent *e)
((MTexturePixmapItem *)item)->enableRedirectedRendering();
setWindowDebugProperties(item->window());
} else
- item->saveBackingStore(true);
+ item->saveBackingStore();
// TODO: don't show the animation if the window is not stacked on top
const XWMHints &h = pc->getWMHints();
if ((!(h.flags & StateHint) || h.initial_state != IconicState)
diff --git a/src/mcompositewindow.h b/src/mcompositewindow.h
index ca778b5..60c6545 100644
--- a/src/mcompositewindow.h
+++ b/src/mcompositewindow.h
@@ -242,13 +242,10 @@ public:
virtual void updateWindowPixmap(XRectangle *rects = 0, int num = 0) = 0;
/*!
- * Creates the pixmap id and saves the offscreen buffer that represents
- * this window
- *
- * \param renew Set to true if the window was just mapped or resized. This
- * will update the offscreen backing store.
+ * Recreates the pixmap id and saves the offscreen buffer that represents
+ * this window. This will update the offscreen backing store.
*/
- virtual void saveBackingStore(bool renew = false) = 0;
+ virtual void saveBackingStore() = 0;
/*!
Clears the texture that is associated with the offscreen pixmap
diff --git a/src/mtexturepixmapitem.h b/src/mtexturepixmapitem.h
index 13b72c9..1a25b29 100644
--- a/src/mtexturepixmapitem.h
+++ b/src/mtexturepixmapitem.h
@@ -21,6 +21,7 @@
#define DUITEXTUREPIXMAPITEM_H
#include "mcompositewindow.h"
+#include "mtexturepixmapitem_p.h"
#include <QtOpenGL>
#include <QPixmap>
@@ -63,13 +64,10 @@ public:
void updateWindowPixmap(XRectangle *rects = 0, int num = 0);
/*!
- * Creates the pixmap id and saves the offscreen buffer that represents
- * this window
- *
- * \param renew Set to true if the window was just mapped or resized. This
- * will update the offscreen backing store.
+ * Recreates the pixmap id and saves the offscreen buffer that represents
+ * this window. This will update the offscreen backing store.
*/
- void saveBackingStore(bool renew = false);
+ void saveBackingStore();
/*!
Clears the texture that is associated with the offscreen pixmap
@@ -90,6 +88,8 @@ public:
void enableDirectFbRendering();
void enableRedirectedRendering();
+ Pixmap windowPixmap() const { return d->windowp; }
+
protected:
void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
diff --git a/src/mtexturepixmapitem_egl.cpp b/src/mtexturepixmapitem_egl.cpp
index c554bd7..421d870 100644
--- a/src/mtexturepixmapitem_egl.cpp
+++ b/src/mtexturepixmapitem_egl.cpp
@@ -132,16 +132,13 @@ void MTexturePixmapItem::init()
d->eglresource = new EglResourceManager();
d->custom_tfp = !d->eglresource->texturePixmapSupport();
- saveBackingStore();
- d->ctx->makeCurrent();
-
d->textureId = d->eglresource->texman->getTexture();
glEnable(GL_TEXTURE_2D);
if (d->custom_tfp)
d->inverted_texture = false;
- doTFP();
+ d->saveBackingStore();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -158,9 +155,9 @@ MTexturePixmapItem::MTexturePixmapItem(Window window, MWindowPropertyCache *mpc,
init();
}
-void MTexturePixmapItem::saveBackingStore(bool renew)
+void MTexturePixmapItem::saveBackingStore()
{
- d->saveBackingStore(renew);
+ d->saveBackingStore();
}
void MTexturePixmapItem::rebindPixmap()
@@ -207,7 +204,7 @@ void MTexturePixmapItem::enableRedirectedRendering()
d->direct_fb_render = false;
XCompositeRedirectWindow(QX11Info::display(), window(),
CompositeRedirectManual);
- saveBackingStore(true);
+ saveBackingStore();
updateWindowPixmap();
}
@@ -268,7 +265,7 @@ void MTexturePixmapItem::updateWindowPixmap(XRectangle *rects, int num)
img.height(), GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
} else {
if (d->egl_image == EGL_NO_IMAGE_KHR)
- saveBackingStore(true);
+ saveBackingStore();
}
d->glwidget->update();
}
diff --git a/src/mtexturepixmapitem_glx.cpp b/src/mtexturepixmapitem_glx.cpp
index a385e28..0129a31 100644
--- a/src/mtexturepixmapitem_glx.cpp
+++ b/src/mtexturepixmapitem_glx.cpp
@@ -93,9 +93,9 @@ void MTexturePixmapItem::init()
return;
d->glpixmap = 0;
- saveBackingStore();
d->custom_tfp = !hasTextureFromPixmap();
+ saveBackingStore();
if (d->custom_tfp) {
initCustomTfp();
@@ -169,9 +169,9 @@ MTexturePixmapItem::MTexturePixmapItem(Window window,
init();
}
-void MTexturePixmapItem::saveBackingStore(bool renew)
+void MTexturePixmapItem::saveBackingStore()
{
- d->saveBackingStore(renew);
+ d->saveBackingStore();
}
void MTexturePixmapItem::rebindPixmap()
@@ -234,7 +234,7 @@ void MTexturePixmapItem::enableRedirectedRendering()
XCompositeRedirectWindow(QX11Info::display(), window(),
CompositeRedirectManual);
XSync(QX11Info::display(), FALSE);
- saveBackingStore(true);
+ saveBackingStore();
updateWindowPixmap();
}
diff --git a/src/mtexturepixmapitem_p.cpp b/src/mtexturepixmapitem_p.cpp
index 47f1086..9725250 100644
--- a/src/mtexturepixmapitem_p.cpp
+++ b/src/mtexturepixmapitem_p.cpp
@@ -370,7 +370,7 @@ MTexturePixmapPrivate::~MTexturePixmapPrivate()
XFreePixmap(QX11Info::display(), windowp);
}
-void MTexturePixmapPrivate::saveBackingStore(bool renew)
+void MTexturePixmapPrivate::saveBackingStore()
{
if ((item->propertyCache()->is_valid && !item->propertyCache()->isMapped())
|| item->propertyCache()->isInputOnly())
@@ -378,10 +378,8 @@ void MTexturePixmapPrivate::saveBackingStore(bool renew)
if (windowp)
XFreePixmap(QX11Info::display(), windowp);
- Pixmap px = XCompositeNameWindowPixmap(QX11Info::display(), item->window());
- windowp = px;
- if (renew)
- item->rebindPixmap();
+ windowp = XCompositeNameWindowPixmap(QX11Info::display(), item->window());
+ item->rebindPixmap(); // windowp == 0 is also handled here
}
void MTexturePixmapPrivate::windowRaised()
@@ -392,7 +390,7 @@ void MTexturePixmapPrivate::windowRaised()
void MTexturePixmapPrivate::resize(int w, int h)
{
if (!brect.isEmpty() && !item->isDirectRendered() && (brect.width() != w || brect.height() != h)) {
- item->saveBackingStore(true);
+ item->saveBackingStore();
item->updateWindowPixmap();
}
brect.setWidth(w);
diff --git a/src/mtexturepixmapitem_p.h b/src/mtexturepixmapitem_p.h
index a3c9dfe..af83966 100644
--- a/src/mtexturepixmapitem_p.h
+++ b/src/mtexturepixmapitem_p.h
@@ -55,7 +55,7 @@ public:
~MTexturePixmapPrivate();
void init();
void updateWindowPixmap(XRectangle *rects = 0, int num = 0);
- void saveBackingStore(bool renew = false);
+ void saveBackingStore();
void clearTexture();
bool isDirectRendered() const;
void resize(int w, int h);