diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp index 58baad02412..5cbbecc5396 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2.cpp @@ -36,12 +36,6 @@ QWaylandXdgExporterV2::~QWaylandXdgExporterV2() { destroy(); } - -QtWaylandClient::QWaylandXdgExportedV2 *QWaylandXdgExporterV2::exportToplevel(wl_surface *surface) -{ - return new QWaylandXdgExportedV2(export_toplevel(surface)); -} - } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h index b260dbacbac..c993e390a24 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgexporterv2_p.h @@ -40,7 +40,6 @@ class QWaylandXdgExporterV2 : public QtWayland::zxdg_exporter_v2 public: QWaylandXdgExporterV2(wl_registry *registry, uint32_t id, int version); ~QWaylandXdgExporterV2() override; - QWaylandXdgExportedV2 *exportToplevel(wl_surface *surface); }; } diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 977657e59f6..498710bebe7 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -711,9 +711,18 @@ QString QWaylandXdgSurface::externWindowHandle() return QString(); } if (!m_toplevel->m_exported) { - m_toplevel->m_exported.reset(m_shell->exporter()->exportToplevel(m_window->wlSurface())); + auto *exporterWrapper = static_cast( + wl_proxy_create_wrapper(m_shell->exporter()->object())); + auto exportQueue = wl_display_create_queue(m_shell->display()->wl_display()); + wl_proxy_set_queue(reinterpret_cast(exporterWrapper), exportQueue); + m_toplevel->m_exported.reset(new QWaylandXdgExportedV2( + zxdg_exporter_v2_export_toplevel(exporterWrapper, m_window->wlSurface()))); // handle events is sent immediately - m_shell->display()->forceRoundTrip(); + wl_display_roundtrip_queue(m_shell->display()->wl_display(), exportQueue); + + wl_proxy_set_queue(reinterpret_cast(m_toplevel->m_exported->object()), nullptr); + wl_proxy_wrapper_destroy(exporterWrapper); + wl_event_queue_destroy(exportQueue); } return m_toplevel->m_exported->handle(); }