diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-05-20 17:39:13 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-05-24 13:06:08 +0000 |
commit | 20692ad15b8ac0c24b12d30609f061a740c87f23 (patch) | |
tree | 52b4f9e4eb93af19c494461fb39b411270a10e0d /src/compositor/extensions/qwaylandxdgshell.cpp | |
parent | 61b552e886fdc34a3731abaaaa08f33059819e88 (diff) |
Add position property to QWaylandXdgPopup
Store the position relative to the parent
Change-Id: Iccae120b70e98388d18e4867e21a3a8c36ddd522
Reviewed-by: Erik Larsson <erik@ortogonal.com>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
Diffstat (limited to 'src/compositor/extensions/qwaylandxdgshell.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshell.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp index dfc68e254..76879fbf1 100644 --- a/src/compositor/extensions/qwaylandxdgshell.cpp +++ b/src/compositor/extensions/qwaylandxdgshell.cpp @@ -199,7 +199,7 @@ void QWaylandXdgShellPrivate::xdg_shell_get_xdg_popup(Resource *resource, uint32 if (!xdgPopup) { // A QWaylandXdgPopup was not created in response to the createXdgPopup signal, so we // create one as fallback here instead. - xdgPopup = new QWaylandXdgPopup(q, surface, parentSurface, xdgPopupResource); + xdgPopup = new QWaylandXdgPopup(q, surface, parentSurface, position, xdgPopupResource); } registerXdgPopup(xdgPopup); @@ -949,10 +949,10 @@ QWaylandXdgPopup::QWaylandXdgPopup() * given \a parentSurface and \a resource. */ QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface *surface, - QWaylandSurface *parentSurface, const QWaylandResource &resource) + QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource) : QWaylandCompositorExtensionTemplate<QWaylandXdgPopup>(*new QWaylandXdgPopupPrivate) { - initialize(xdgShell, surface, parentSurface, resource); + initialize(xdgShell, surface, parentSurface, position, resource); } /*! @@ -966,13 +966,14 @@ QWaylandXdgPopup::QWaylandXdgPopup(QWaylandXdgShell *xdgShell, QWaylandSurface * * Initializes the QWaylandXdgPopup, associating it with the given \a shell \a surface, * \a parentSurface and \a resource. */ -void QWaylandXdgPopup::initialize(QWaylandXdgShell *shell, QWaylandSurface *surface, - QWaylandSurface *parentSurface, const QWaylandResource &resource) +void QWaylandXdgPopup::initialize(QWaylandXdgShell *shell, QWaylandSurface *surface, QWaylandSurface *parentSurface, + const QPoint& position, const QWaylandResource &resource) { Q_D(QWaylandXdgPopup); d->m_surface = surface; d->m_parentSurface = parentSurface; d->m_xdgShell = shell; + d->m_position = position; d->init(resource.resource()); setExtensionContainer(surface); emit surfaceChanged(); @@ -1015,6 +1016,28 @@ QWaylandSurface *QWaylandXdgPopup::parentSurface() const return d->m_parentSurface; } + +/*! + * \qmlproperty object QtWaylandCompositor::XdgPopup::position + * + * This property holds the location of the upper left corner of the surface + * relative to the upper left corner of the parent surface, in surface local + * coordinates. + */ + +/*! + * \property QWaylandXdgPopup::position + * + * This property holds the location of the upper left corner of the surface + * relative to the upper left corner of the parent surface, in surface local + * coordinates. + */ +QPoint QWaylandXdgPopup::position() const +{ + Q_D(const QWaylandXdgPopup); + return d->m_position; +} + /*! * \internal */ |