Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts: src/client/qwaylanddisplay.cpp src/client/qwaylandwindow.cpp Change-Id: I30ddf5305b3087b93cf4d6e562fd0146dea61cc0
This commit is contained in:
commit
aab418b27b
@ -114,6 +114,10 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make sure we don't pass NULL surfaces to libwayland (crashes)
|
||||
Q_ASSERT(parent->wlSurface());
|
||||
Q_ASSERT(window->wlSurface());
|
||||
|
||||
return mSubCompositor->get_subsurface(window->wlSurface(), parent->wlSurface());
|
||||
}
|
||||
|
||||
|
@ -125,9 +125,10 @@ void QWaylandWindow::initWindow()
|
||||
if (shouldCreateSubSurface()) {
|
||||
Q_ASSERT(!mSubSurfaceWindow);
|
||||
|
||||
QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
|
||||
if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) {
|
||||
mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss);
|
||||
auto *parent = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
|
||||
if (parent->wlSurface()) {
|
||||
if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent))
|
||||
mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface);
|
||||
}
|
||||
} else if (shouldCreateShellSurface()) {
|
||||
Q_ASSERT(!mShellSurface);
|
||||
|
@ -164,6 +164,16 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
class Subsurface : public QObject, public QtWaylandServer::wl_subsurface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Subsurface(wl_client *client, int id, int version)
|
||||
: QtWaylandServer::wl_subsurface(client, id, version)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class SubCompositor : public Global, public QtWaylandServer::wl_subcompositor
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -171,7 +181,20 @@ public:
|
||||
explicit SubCompositor(CoreCompositor *compositor, int version = 1)
|
||||
: QtWaylandServer::wl_subcompositor(compositor->m_display, version)
|
||||
{}
|
||||
// TODO
|
||||
QVector<Subsurface *> m_subsurfaces;
|
||||
|
||||
signals:
|
||||
void subsurfaceCreated(Subsurface *subsurface);
|
||||
|
||||
protected:
|
||||
void subcompositor_get_subsurface(Resource *resource, uint32_t id, ::wl_resource *surface, ::wl_resource *parent) override
|
||||
{
|
||||
QTRY_VERIFY(parent);
|
||||
QTRY_VERIFY(surface);
|
||||
auto *subsurface = new Subsurface(resource->client(), id, resource->version());
|
||||
m_subsurfaces.append(subsurface); // TODO: clean up?
|
||||
emit subsurfaceCreated(subsurface);
|
||||
}
|
||||
};
|
||||
|
||||
struct OutputMode {
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
// Convenience functions
|
||||
Output *output(int i = 0) { return getAll<Output>().value(i, nullptr); }
|
||||
Surface *surface(int i = 0) { return get<WlCompositor>()->m_surfaces.value(i, nullptr); }
|
||||
Subsurface *subSurface(int i = 0) { return get<SubCompositor>()->m_subsurfaces.value(i, nullptr); }
|
||||
XdgSurface *xdgSurface(int i = 0) { return get<XdgWmBase>()->m_xdgSurfaces.value(i, nullptr); }
|
||||
XdgToplevel *xdgToplevel(int i = 0) { return get<XdgWmBase>()->toplevel(i); }
|
||||
XdgPopup *xdgPopup(int i = 0) { return get<XdgWmBase>()->popup(i); }
|
||||
|
@ -312,9 +312,9 @@ void *MockCompositor::run(void *data)
|
||||
Impl::Compositor compositor(controller);
|
||||
|
||||
controller->m_compositor = &compositor;
|
||||
controller->m_waitCondition.wakeOne();
|
||||
|
||||
while (!controller->m_ready) {
|
||||
controller->m_waitCondition.wakeOne();
|
||||
controller->dispatchCommands();
|
||||
compositor.dispatchEvents(20);
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ private slots:
|
||||
void waitForFrameCallbackGl();
|
||||
#endif
|
||||
void negotiateShmFormat();
|
||||
|
||||
// Subsurfaces
|
||||
void createSubsurface();
|
||||
void createSubsurfaceForHiddenParent();
|
||||
};
|
||||
|
||||
void tst_surface::createDestroySurface()
|
||||
@ -160,5 +164,42 @@ void tst_surface::negotiateShmFormat()
|
||||
});
|
||||
}
|
||||
|
||||
void tst_surface::createSubsurface()
|
||||
{
|
||||
QRasterWindow window;
|
||||
window.resize(64, 64);
|
||||
window.show();
|
||||
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
|
||||
exec([=] { xdgToplevel()->sendCompleteConfigure(); });
|
||||
QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
|
||||
|
||||
QRasterWindow subWindow;
|
||||
subWindow.setParent(&window);
|
||||
subWindow.resize(64, 64);
|
||||
subWindow.show();
|
||||
QCOMPOSITOR_TRY_VERIFY(subSurface());
|
||||
}
|
||||
|
||||
// Used to cause a crash in libwayland (QTBUG-79674)
|
||||
void tst_surface::createSubsurfaceForHiddenParent()
|
||||
{
|
||||
QRasterWindow window;
|
||||
window.resize(64, 64);
|
||||
window.show();
|
||||
QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
|
||||
exec([=] { xdgToplevel()->sendCompleteConfigure(); });
|
||||
QCOMPOSITOR_TRY_VERIFY(xdgSurface()->m_committedConfigureSerial);
|
||||
|
||||
window.hide();
|
||||
|
||||
QRasterWindow subWindow;
|
||||
subWindow.setParent(&window);
|
||||
subWindow.resize(64, 64);
|
||||
subWindow.show();
|
||||
|
||||
// Make sure the client doesn't quit before it has a chance to crash
|
||||
xdgPingAndWaitForPong();
|
||||
}
|
||||
|
||||
QCOMPOSITOR_TEST_MAIN(tst_surface)
|
||||
#include "tst_surface.moc"
|
||||
|
Loading…
x
Reference in New Issue
Block a user