diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2015-07-05 17:58:23 +0300 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-07-22 07:42:07 +0000 |
commit | 2e3cddf8b28cf6ce2b4db9c9a21f0a2427bdf756 (patch) | |
tree | d61f67f2468431379df438052e701d803c7f1c40 /src/client/qwaylandsubsurface.cpp | |
parent | 6c47babc1a3566c7186e3196e7975df2be9b575b (diff) |
Use standard wl_subsurface interface to set a window as a child of another one
Change-Id: I52628f87dbea5383db06468f9748a9bacdec3179
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/client/qwaylandsubsurface.cpp')
-rw-r--r-- | src/client/qwaylandsubsurface.cpp | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/src/client/qwaylandsubsurface.cpp b/src/client/qwaylandsubsurface.cpp index 81cfef254..ec813609f 100644 --- a/src/client/qwaylandsubsurface.cpp +++ b/src/client/qwaylandsubsurface.cpp @@ -41,45 +41,18 @@ QT_BEGIN_NAMESPACE namespace QtWaylandClient { -QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, struct ::qt_sub_surface *sub_surface) - : QtWayland::qt_sub_surface(sub_surface) +QWaylandSubSurface::QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *sub_surface) + : QtWayland::wl_subsurface(sub_surface) , m_window(window) + , m_parent(parent) { + m_parent->mChildren << this; + set_desync(); } -void QWaylandSubSurface::setParent(const QWaylandWindow *parent) +QWaylandSubSurface::~QWaylandSubSurface() { - QWaylandSubSurface *parentSurface = parent ? parent->subSurfaceWindow() : 0; - if (parentSurface) { - int x = m_window->geometry().x() + parent->frameMargins().left(); - int y = m_window->geometry().y() + parent->frameMargins().top(); - parentSurface->attach_sub_surface(object(), x, y); - } -} - -static void setPositionToParent(QWaylandWindow *parentWaylandWindow) -{ - QObjectList children = parentWaylandWindow->window()->children(); - for (int i = 0; i < children.size(); i++) { - QWindow *childWindow = qobject_cast<QWindow *>(children.at(i)); - if (!childWindow) - continue; - - if (childWindow->handle()) { - QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(childWindow->handle()); - waylandWindow->subSurfaceWindow()->setParent(parentWaylandWindow); - setPositionToParent(waylandWindow); - } - } -} - -void QWaylandSubSurface::adjustPositionOfChildren() -{ - QWindow *window = m_window->window(); - if (window->parent()) { - qDebug() << "QWaylandSubSurface::adjustPositionOfChildren not called for toplevel window"; - } - setPositionToParent(m_window); + m_parent->mChildren.removeOne(this); } } |