summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wayland/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2012-11-05 00:12:15 +0100
committerAndy Nichols <andy.nichols@digia.com>2013-01-10 16:47:53 +0100
commitf7b58cccba239b16d18379afbd4117e4432790c4 (patch)
tree5a8f713c1cc282030d43252abeace6ce83efb4b4 /src/plugins/platforms/wayland/qwaylandwindow.cpp
parent1ddfb323388ff079d1e492ca8bb6ea0e08344bd5 (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/qwaylandwindow.cpp')
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index 1e48bfdea..64170d24a 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -154,6 +154,8 @@ void QWaylandWindow::setGeometry(const QRect &rect)
if (shellSurface() && window()->transientParent())
shellSurface()->updateTransientParent(window()->transientParent());
+
+ mDisplay->scheduleRedraw(this);
}
void QWaylandWindow::setVisible(bool visible)
@@ -201,19 +203,45 @@ void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height)
heightWithoutMargins = qMax(heightWithoutMargins, window()->minimumSize().height());
QRect geometry = QRect(0,0,
widthWithoutMargins, heightWithoutMargins);
+
+ int x = 0;
+ int y = 0;
+ QSize size = this->geometry().size();
+ if (edges == WL_SHELL_SURFACE_RESIZE_LEFT || edges == WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT ||
+ edges == WL_SHELL_SURFACE_RESIZE_TOP_LEFT) {
+ x = size.width() - geometry.width();
+ }
+ if (edges == WL_SHELL_SURFACE_RESIZE_TOP || edges == WL_SHELL_SURFACE_RESIZE_TOP_LEFT ||
+ edges == WL_SHELL_SURFACE_RESIZE_TOP_RIGHT) {
+ y = size.height() - geometry.height();
+ }
+ mOffset += QPoint(x, y);
+
setGeometry(geometry);
QWindowSystemInterface::handleGeometryChange(window(), geometry);
+ QWindowSystemInterface::flushWindowSystemEvents();
+}
+
+void QWaylandWindow::redraw()
+{
+
}
-void QWaylandWindow::attach(QWaylandBuffer *buffer)
+void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y)
{
mBuffer = buffer;
if (window()->isVisible()) {
- wl_surface_attach(mSurface, mBuffer->buffer(),0,0);
+ wl_surface_attach(mSurface, mBuffer->buffer(), x, y);
}
}
+void QWaylandWindow::attachOffset(QWaylandBuffer *buffer)
+{
+ attach(buffer, mOffset.x(), mOffset.y());
+ mOffset = QPoint();
+}
+
QWaylandBuffer *QWaylandWindow::attached() const
{
return mBuffer;
@@ -380,10 +408,8 @@ void QWaylandWindow::handleMouseLeave()
void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
{
- if (mWindowDecoration->inMouseButtonPressedState()) {
- mWindowDecoration->handleMouse(inputDevice,local,global,b,mods);
+ if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods))
return;
- }
QMargins marg = frameMargins();
QRect windowRect(0 + marg.left(),