summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-10-30 00:50:22 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-10-30 00:50:22 +0100
commit52876056ff3dcda97f93932bc8c6e1c0fbce9d5e (patch)
tree5bdd3cc28573a90e192b24564d3ed7cc4792f365 /src
parent9ebe63181ba3504569c75b25862172353b6cfaa8 (diff)
parent16a98829a664403f2fb8962884701f5d4d31cacd (diff)
Merge 5.12 into 5.12.0
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandshmbackingstore.cpp3
-rw-r--r--src/client/qwaylandwindow.cpp27
-rw-r--r--src/client/qwaylandwindow_p.h5
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp19
-rw-r--r--src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h2
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp19
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h2
7 files changed, 66 insertions, 11 deletions
diff --git a/src/client/qwaylandshmbackingstore.cpp b/src/client/qwaylandshmbackingstore.cpp
index ecb03c0d6..3fe2ce80c 100644
--- a/src/client/qwaylandshmbackingstore.cpp
+++ b/src/client/qwaylandshmbackingstore.cpp
@@ -234,8 +234,7 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion &region, cons
mFrontBuffer = mBackBuffer;
QMargins margins = windowDecorationMargins();
-
- waylandWindow()->commit(mFrontBuffer, region.translated(margins.left(), margins.top()));
+ waylandWindow()->safeCommit(mFrontBuffer, region.translated(margins.left(), margins.top()));
}
void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &)
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 52bee6ae3..4ac2ca51e 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -248,6 +248,7 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
}
mMask = QRegion();
+ mQueuedBuffer = nullptr;
}
QWaylandWindow *QWaylandWindow::fromWlSurface(::wl_surface *surface)
@@ -337,7 +338,9 @@ void QWaylandWindow::setGeometry(const QRect &rect)
mSentInitialResize = true;
}
- sendExposeEvent(QRect(QPoint(), geometry().size()));
+ QRect exposeGeometry(QPoint(), geometry().size());
+ if (exposeGeometry != mLastExposeGeometry)
+ sendExposeEvent(exposeGeometry);
}
void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset)
@@ -355,6 +358,7 @@ void QWaylandWindow::sendExposeEvent(const QRect &rect)
{
if (!(mShellSurface && mShellSurface->handleExpose(rect)))
QWindowSystemInterface::handleExposeEvent(window(), rect);
+ mLastExposeGeometry = rect;
}
@@ -566,8 +570,29 @@ void QWaylandWindow::damage(const QRect &rect)
damage(rect.x(), rect.y(), rect.width(), rect.height());
}
+void QWaylandWindow::safeCommit(QWaylandBuffer *buffer, const QRegion &damage)
+{
+ if (isExposed()) {
+ commit(buffer, damage);
+ } else {
+ mQueuedBuffer = buffer;
+ mQueuedBufferDamage = damage;
+ }
+}
+
+void QWaylandWindow::handleExpose(const QRegion &region)
+{
+ QWindowSystemInterface::handleExposeEvent(window(), region);
+ if (mQueuedBuffer) {
+ commit(mQueuedBuffer, mQueuedBufferDamage);
+ mQueuedBuffer = nullptr;
+ mQueuedBufferDamage = QRegion();
+ }
+}
+
void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage)
{
+ Q_ASSERT(isExposed());
if (buffer->committed()) {
qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring.";
return;
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
index d11ed871b..56ebd3cc6 100644
--- a/src/client/qwaylandwindow_p.h
+++ b/src/client/qwaylandwindow_p.h
@@ -116,6 +116,8 @@ public:
using QtWayland::wl_surface::damage;
void damage(const QRect &rect);
+ void safeCommit(QWaylandBuffer *buffer, const QRegion &damage);
+ void handleExpose(const QRegion &region);
void commit(QWaylandBuffer *buffer, const QRegion &damage);
void waitForFrameSync();
@@ -231,6 +233,8 @@ protected:
Qt::WindowStates mLastReportedWindowStates = Qt::WindowNoState;
QWaylandShmBackingStore *mBackingStore = nullptr;
+ QWaylandBuffer *mQueuedBuffer = nullptr;
+ QRegion mQueuedBufferDamage;
private slots:
void handleScreenRemoved(QScreen *qScreen);
@@ -250,6 +254,7 @@ private:
void handleScreenChanged();
bool mUpdateRequested = false;
+ QRect mLastExposeGeometry;
static const wl_callback_listener callbackListener;
static void frameCallback(void *data, struct wl_callback *wl_callback, uint32_t time);
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
index 447e8fb6a..3d3af6929 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
@@ -258,9 +258,14 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId)
m_toplevel->set_app_id(appId);
}
+bool QWaylandXdgSurfaceV6::isExposed() const
+{
+ return m_configured || m_pendingConfigureSerial;
+}
+
bool QWaylandXdgSurfaceV6::handleExpose(const QRegion &region)
{
- if (!m_configured && !region.isEmpty()) {
+ if (!isExposed() && !region.isEmpty()) {
m_exposeRegion = region;
return true;
}
@@ -333,10 +338,18 @@ void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice
void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial)
{
- m_window->applyConfigureWhenPossible();
m_pendingConfigureSerial = serial;
+ if (!m_configured) {
+ // We have to do the initial applyConfigure() immediately, since that is the expose.
+ applyConfigure();
+ } else {
+ // Later configures are probably resizes, so we have to queue them up for a time when we
+ // are not painting to the window.
+ m_window->applyConfigureWhenPossible();
+ }
+
if (!m_exposeRegion.isEmpty()) {
- QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion);
+ m_window->handleExpose(m_exposeRegion);
m_exposeRegion = QRegion();
}
}
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
index 38b711f88..874dba014 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
@@ -85,7 +85,7 @@ public:
void setTitle(const QString &title) override;
void setAppId(const QString &appId) override;
- bool isExposed() const override { return m_configured; }
+ bool isExposed() const override;
bool handleExpose(const QRegion &) override;
bool handlesActiveState() const { return m_toplevel; }
void applyConfigure() override;
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 0756e4d02..c723192c8 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -292,9 +292,14 @@ void QWaylandXdgSurface::setWindowFlags(Qt::WindowFlags flags)
m_toplevel->requestWindowFlags(flags);
}
+bool QWaylandXdgSurface::isExposed() const
+{
+ return m_configured || m_pendingConfigureSerial;
+}
+
bool QWaylandXdgSurface::handleExpose(const QRegion &region)
{
- if (!m_configured && !region.isEmpty()) {
+ if (!isExposed() && !region.isEmpty()) {
m_exposeRegion = region;
return true;
}
@@ -367,10 +372,18 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent, QWaylandInputDevice *d
void QWaylandXdgSurface::xdg_surface_configure(uint32_t serial)
{
- m_window->applyConfigureWhenPossible();
m_pendingConfigureSerial = serial;
+ if (!m_configured) {
+ // We have to do the initial applyConfigure() immediately, since that is the expose.
+ applyConfigure();
+ } else {
+ // Later configures are probably resizes, so we have to queue them up for a time when we
+ // are not painting to the window.
+ m_window->applyConfigureWhenPossible();
+ }
+
if (!m_exposeRegion.isEmpty()) {
- QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion);
+ m_window->handleExpose(m_exposeRegion);
m_exposeRegion = QRegion();
}
}
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
index 45d7d4b0e..5e97a34b3 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
@@ -89,7 +89,7 @@ public:
void setAppId(const QString &appId) override;
void setWindowFlags(Qt::WindowFlags flags) override;
- bool isExposed() const override { return m_configured; }
+ bool isExposed() const override;
bool handleExpose(const QRegion &) override;
bool handlesActiveState() const { return m_toplevel; }
void applyConfigure() override;