Home
Phabricator
Search
Log In
Paste
P636
Masterwork From Distant Lands
Active
Public
Actions
Authored by
davidedmundson
on Sep 15 2020, 2:29 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 1127a07d..715d08ef 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -132,10 +132,16 @@ void QWaylandWindow::initWindow()
if (shouldCreateSubSurface()) {
Q_ASSERT(!mSubSurfaceWindow);
+ // find the most topmost parent that has actualy been initialised
auto *parent = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
- if (parent->wlSurface()) {
- if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent))
- mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface);
+ while (parent) {
+ if (parent->wlSurface() && (parent->mShellSurface || parent->mSubSurfaceWindow)) {
+ qDebug() << "Creating subsurface" << window() << " to " << parent->window();
+ if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent))
+ mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface);
+ break;
+ }
+ parent = static_cast<QWaylandWindow *>(parent->QPlatformWindow::parent());
}
} else if (shouldCreateShellSurface()) {
Q_ASSERT(!mShellSurface);
@@ -336,8 +342,16 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect)
qBound(window()->minimumHeight(), rect.height(), window()->maximumHeight())));
if (mSubSurfaceWindow) {
- QMargins m = QPlatformWindow::parent()->frameMargins();
- mSubSurfaceWindow->set_position(rect.x() + m.left(), rect.y() + m.top());
+ auto parent = QPlatformWindow::parent();
+ QPoint offset;
+ while (parent && parent != mSubSurfaceWindow->parent()) {
+ offset += parent->geometry().topLeft();
+ qDebug() << "Adding offset" << offset << "from " << parent->window();
+ parent = parent->parent();
+ qDebug() << parent->window();
+ }
+ QMargins m = mSubSurfaceWindow->parent()->frameMargins();
+ mSubSurfaceWindow->set_position(offset.x() + rect.x() + m.left(), offset.y() + rect.y() + m.top());
mSubSurfaceWindow->parent()->window()->requestUpdate();
}
}
davidedmundson
edited the content of this paste.
(Show Details)
Sep 15 2020, 2:29 PM
davidedmundson
changed the title of this paste from untitled to
Masterwork From Distant Lands
.
Log In to Comment