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()
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,
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()));
}
#include "waylandobject.h"
#include <wayland-server.h>
+#include <QPoint>
namespace Wayland {
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;