diff options
author | Giulio Camuffo <giuliocamuffo@gmail.com> | 2012-11-05 00:12:15 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@digia.com> | 2013-01-10 16:47:53 +0100 |
commit | f7b58cccba239b16d18379afbd4117e4432790c4 (patch) | |
tree | 5a8f713c1cc282030d43252abeace6ce83efb4b4 /src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | |
parent | 1ddfb323388ff079d1e492ca8bb6ea0e08344bd5 (diff) |
Implemented moving and resizing using the decorations.
Change-Id: I4153b72876b272c508264c82ac10def68ee4349d
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index d41bfe156..8300d9c9b 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -202,16 +202,23 @@ void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, cons wl_callback_add_listener(mFrameCallback,&frameCallbackListener,this); QMargins margins = windowDecorationMargins(); + bool damageAll = false; if (waylandWindow()->attached() != mFrontBuffer) { delete waylandWindow()->attached(); - waylandWindow()->attach(mFrontBuffer); + waylandWindow()->attachOffset(mFrontBuffer); + damageAll = true; } - QVector<QRect> rects = region.rects(); - for (int i = 0; i < rects.size(); i++) { - QRect rect = rects.at(i); - rect.translate(margins.left(),margins.top()); - waylandWindow()->damage(rect); + if (damageAll) { + //need to damage it all, otherwise the attach offset may screw up + waylandWindow()->damage(QRect(QPoint(0,0),mFrontBuffer->size())); + } else { + QVector<QRect> rects = region.rects(); + for (int i = 0; i < rects.size(); i++) { + QRect rect = rects.at(i); + rect.translate(margins.left(),margins.top()); + waylandWindow()->damage(rect); + } } mFrontBufferIsDirty = false; } @@ -223,7 +230,6 @@ void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) void QWaylandShmBackingStore::resize(const QSize &size) { - QMargins margins = windowDecorationMargins(); QSize sizeWithMargins = size + QSize(margins.left()+margins.right(),margins.top()+margins.bottom()); @@ -254,14 +260,16 @@ void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t t static_cast<QWaylandShmBackingStore *>(data); if (callback != self->mFrameCallback) // others, like QWaylandWindow, may trigger callbacks too return; - QWaylandWindow *window = self->waylandWindow(); + QWaylandShmWindow *window = self->waylandWindow(); wl_callback_destroy(self->mFrameCallback); self->mFrameCallback = 0; + if (self->mFrontBuffer != window->attached()) { delete window->attached(); - window->attach(self->mFrontBuffer); } + window->attachOffset(self->mFrontBuffer); + if (self->mFrontBufferIsDirty && !self->mPainting) { self->mFrontBufferIsDirty = false; self->mFrameCallback = wl_surface_frame(window->wl_surface()); |