summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-10-06 11:05:23 +0300
committerGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-10-06 10:16:28 +0200
commit9b4c3cd1e53024ee2196238aabf00d079fece1de (patch)
treec58e58c103eeec369b4549431d2da4d5fea07897 /src
parentc7a8b70b4e9afef864652cf98a934d99d49bb36f (diff)
Fix shm windows sometimes not showing after being hidden
QWaylandShmBackingStore installs a frame callback on flush, and subsequent flushes will not attach a new buffer until the callback is fired. If the window is hidden while we're waiting for the callback, we attach a NULL buffer, so the compositor will not redraw the surface and will not fire the frame callback. When showing the window again the backing store's flush() will wait indefinitely for the frame callback to attach its buffer. To fix it destroy the frame callback when the window is hidden. This was easily noticeable when fast switching between popup menus. Change-Id: Ic0c71ed79e2fab9faf452f63b05bc4576ea9a3ba Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandshmbackingstore.cpp11
-rw-r--r--src/client/qwaylandshmbackingstore_p.h1
-rw-r--r--src/client/qwaylandwindow.cpp5
3 files changed, 17 insertions, 0 deletions
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index 421fae91c..332ea9265 100644
--- a/src/client/qwaylandshmbackingstore.cpp
+++ b/src/client/qwaylandshmbackingstore.cpp
@@ -140,6 +140,9 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window)
QWaylandShmBackingStore::~QWaylandShmBackingStore()
{
+ if (QWaylandWindow *w = waylandWindow())
+ w->setBackingStore(Q_NULLPTR);
+
if (mFrameCallback)
wl_callback_destroy(mFrameCallback);
@@ -175,6 +178,14 @@ void QWaylandShmBackingStore::endPaint()
waylandWindow()->setCanResize(true);
}
+void QWaylandShmBackingStore::hidden()
+{
+ if (mFrameCallback) {
+ wl_callback_destroy(mFrameCallback);
+ mFrameCallback = Q_NULLPTR;
+ }
+}
+
void QWaylandShmBackingStore::ensureSize()
{
waylandWindow()->setBackingStore(this);
diff --git a/src/client/qwaylandshmbackingstore_p.h b/src/client/qwaylandshmbackingstore_p.h
index 5c3dbb5bc..319acd9a9 100644
--- a/src/client/qwaylandshmbackingstore_p.h
+++ b/src/client/qwaylandshmbackingstore_p.h
@@ -82,6 +82,7 @@ public:
void resize(const QSize &size);
void beginPaint(const QRegion &);
void endPaint();
+ void hidden();
QWaylandAbstractDecoration *windowDecoration() const;
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 5786c1fb8..d1ea6c1f9 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -54,6 +54,7 @@
#include "qwaylandwindowmanagerintegration_p.h"
#include "qwaylandnativeinterface_p.h"
#include "qwaylanddecorationfactory_p.h"
+#include "qwaylandshmbackingstore_p.h"
#include <QtCore/QFileInfo>
#include <QtCore/QPointer>
@@ -90,6 +91,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
, mMouseDevice(0)
, mMouseSerial(0)
, mState(Qt::WindowNoState)
+ , mBackingStore(Q_NULLPTR)
{
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
@@ -248,6 +250,9 @@ void QWaylandWindow::setVisible(bool visible)
if (!deleteGuard.isNull()) {
attach(static_cast<QWaylandBuffer *>(0), 0, 0);
commit();
+ if (mBackingStore) {
+ mBackingStore->hidden();
+ }
}
}
}