diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-04-13 13:58:05 +0300 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2012-04-17 13:12:02 +0200 |
commit | 56758f210dc090d9b306d20c221fdc35f3b3a917 (patch) | |
tree | f25eb1c5d74058b243e3fa83bc2c5097c8486d02 /src/compositor/wayland_wrapper | |
parent | 6ec82c38f0ed751d2e7c67c0732d2d5c043c4a84 (diff) |
Decorations: Make it possible to move windows with transient parent
This was not working previously due to not updating the offset.
Change-Id: I0a8db17a1eabeb6139129386675b271f9e1b8f22
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r-- | src/compositor/wayland_wrapper/wlshellsurface.cpp | 13 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/wlshellsurface.h | 5 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/wlsurface.cpp | 8 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/wlsurface.h | 1 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/compositor/wayland_wrapper/wlshellsurface.cpp b/src/compositor/wayland_wrapper/wlshellsurface.cpp index 9e37a330f..4751250a0 100644 --- a/src/compositor/wayland_wrapper/wlshellsurface.cpp +++ b/src/compositor/wayland_wrapper/wlshellsurface.cpp @@ -116,13 +116,13 @@ void ShellSurface::adjustPosInResize() surface()->setPos(newPos); } -void ShellSurface::adjustPosToTransientParent() +QPointF ShellSurface::adjustedPosToTransientParent() const { if (!m_transientParent || (m_surface->subSurface() && m_surface->subSurface()->parent())) - return; + return m_surface->nonAdjustedPos(); - m_surface->setPos(m_transientParent->surface()->pos() + QPoint(m_xOffset,m_yOffset)); + return m_transientParent->surface()->pos() + QPoint(m_xOffset,m_yOffset); } void ShellSurface::resetResizeGrabber() @@ -140,6 +140,11 @@ ShellSurface *ShellSurface::transientParent() const return m_transientParent; } +void ShellSurface::setOffset(const QPointF &offset) +{ + m_xOffset = offset.x(); + m_yOffset = offset.y(); +} void ShellSurface::move(struct wl_client *client, struct wl_resource *shell_surface_resource, @@ -393,6 +398,8 @@ void ShellSurfaceMoveGrabber::motion(wl_pointer_grab *grab, uint32_t time, int32 QPointF pos(input_device->base()->x - shell_surface_grabber->offset_x, input_device->base()->y - shell_surface_grabber->offset_y); shell_surface->surface()->setPos(pos); + if (shell_surface->transientParent()) + shell_surface->setOffset(pos - shell_surface->transientParent()->surface()->pos()); shell_surface->surface()->damage(QRect(QPoint(0,0),shell_surface->surface()->size())); } diff --git a/src/compositor/wayland_wrapper/wlshellsurface.h b/src/compositor/wayland_wrapper/wlshellsurface.h index dc6491471..1cdb6f42d 100644 --- a/src/compositor/wayland_wrapper/wlshellsurface.h +++ b/src/compositor/wayland_wrapper/wlshellsurface.h @@ -44,6 +44,7 @@ #include "waylandobject.h" #include <wayland-server.h> +#include <QPoint> namespace Wayland { @@ -78,11 +79,13 @@ public: Surface *surface() const; void adjustPosInResize(); - void adjustPosToTransientParent(); + QPointF adjustedPosToTransientParent() const; void resetResizeGrabber(); void resetMoveGrabber(); ShellSurface *transientParent() const; + void setOffset(const QPointF &offset); + private: struct wl_resource *m_shellSurface; Surface *m_surface; diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp index 7afed8daf..091f059ff 100644 --- a/src/compositor/wayland_wrapper/wlsurface.cpp +++ b/src/compositor/wayland_wrapper/wlsurface.cpp @@ -146,9 +146,11 @@ bool Surface::visible() const QPointF Surface::pos() const { - if (m_shellSurface) { - m_shellSurface->adjustPosToTransientParent(); - } + return m_shellSurface ? m_shellSurface->adjustedPosToTransientParent() : m_position; +} + +QPointF Surface::nonAdjustedPos() const +{ return m_position; } diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h index cd069598e..95377b507 100644 --- a/src/compositor/wayland_wrapper/wlsurface.h +++ b/src/compositor/wayland_wrapper/wlsurface.h @@ -85,6 +85,7 @@ public: uint id() const { return base()->resource.object.id; } QPointF pos() const; + QPointF nonAdjustedPos() const; void setPos(const QPointF &pos); QSize size() const; |