Port to QWaylandWindow::setShellIntegration()

This commit is contained in:
Vlad Zahorodnii
2022-12-08 12:04:35 +02:00
parent 488c6d759c
commit 030df45a0d
8 changed files with 36 additions and 36 deletions

View File

@ -5,11 +5,15 @@
*/
#include "window.h"
#include "../qwaylandlayershellintegration_p.h"
#include <layershellqt_logging.h>
#include <QPointer>
#include <optional>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
using namespace LayerShellQt;
class LayerShellQt::WindowPrivate
@ -121,6 +125,18 @@ Window::Window(QWindow *window)
: QObject(window)
, d(new WindowPrivate(window))
{
window->winId(); // ensure that the platform window is created
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
if (!waylandWindow) {
return;
}
static QWaylandLayerShellIntegration *s_integration = new QWaylandLayerShellIntegration();
if (waylandWindow->shellIntegration() != s_integration) {
waylandWindow->setShellIntegration(s_integration);
}
s_map.insert(d->parentWindow, this);
}