client: Implement QNativeInterface::Private::QWaylandWindow
Task-number: QTBUG-94729 Change-Id: Ib79f3199a4518700aa032c5ca4760a2b53c401e5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
d62c5761e8
commit
9e23cbc94c
@ -18,6 +18,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandFullScreenShellV1Surface : public QWaylandS
|
||||
{
|
||||
public:
|
||||
QWaylandFullScreenShellV1Surface(QtWayland::zwp_fullscreen_shell_v1 *shell, QWaylandWindow *window);
|
||||
std::any surfaceRole() const override { return m_shell->object(); }
|
||||
|
||||
private:
|
||||
QtWayland::zwp_fullscreen_shell_v1 *m_shell = nullptr;
|
||||
|
@ -57,6 +57,8 @@ public:
|
||||
void applyConfigure() override;
|
||||
bool wantsDecorations() const override;
|
||||
|
||||
std::any surfaceRole() const override { return object(); };
|
||||
|
||||
protected:
|
||||
void requestWindowStates(Qt::WindowStates states) override;
|
||||
|
||||
|
@ -417,6 +417,15 @@ void *QWaylandXdgSurface::nativeResource(const QByteArray &resource)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::any QWaylandXdgSurface::surfaceRole() const
|
||||
{
|
||||
if (m_toplevel)
|
||||
return m_toplevel->object();
|
||||
if (m_popup)
|
||||
return m_popup->object();
|
||||
return {};
|
||||
}
|
||||
|
||||
void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states)
|
||||
{
|
||||
if (m_toplevel)
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
void *nativeResource(const QByteArray &resource);
|
||||
|
||||
std::any surfaceRole() const override;
|
||||
|
||||
protected:
|
||||
void requestWindowStates(Qt::WindowStates states) override;
|
||||
void xdg_surface_configure(uint32_t serial) override;
|
||||
|
@ -143,7 +143,7 @@ void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourc
|
||||
if (lowerCaseResource == "vksurface") {
|
||||
if (window->surfaceType() == QSurface::VulkanSurface && window->handle()) {
|
||||
// return a pointer to the VkSurfaceKHR value, not the value itself
|
||||
return static_cast<QWaylandVulkanWindow *>(window->handle())->surface();
|
||||
return static_cast<QWaylandVulkanWindow *>(window->handle())->vkSurface();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtCore/private/qglobal_p.h>
|
||||
|
||||
#include <any>
|
||||
|
||||
struct wl_surface;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -80,6 +82,8 @@ public:
|
||||
QPlatformWindow *platformWindow();
|
||||
struct wl_surface *wlSurface();
|
||||
|
||||
virtual std::any surfaceRole() const { return std::any(); };
|
||||
|
||||
protected:
|
||||
void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0});
|
||||
void repositionFromApplyConfigure(const QPoint &position);
|
||||
|
@ -26,7 +26,7 @@ QWaylandWindow::WindowType QWaylandVulkanWindow::windowType() const
|
||||
return QWaylandWindow::Vulkan;
|
||||
}
|
||||
|
||||
VkSurfaceKHR *QWaylandVulkanWindow::surface()
|
||||
VkSurfaceKHR *QWaylandVulkanWindow::vkSurface()
|
||||
{
|
||||
if (m_surface)
|
||||
return &m_surface;
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
WindowType windowType() const override;
|
||||
|
||||
VkSurfaceKHR *surface();
|
||||
VkSurfaceKHR *vkSurface();
|
||||
|
||||
private:
|
||||
VkSurfaceKHR m_surface = VK_NULL_HANDLE;
|
||||
|
@ -59,6 +59,11 @@ QWaylandWindow::QWaylandWindow(QWindow *window, QWaylandDisplay *display)
|
||||
static WId id = 1;
|
||||
mWindowId = id++;
|
||||
initializeWlSurface();
|
||||
|
||||
connect(this, &QWaylandWindow::wlSurfaceCreated, this,
|
||||
&QNativeInterface::Private::QWaylandWindow::surfaceCreated);
|
||||
connect(this, &QWaylandWindow::wlSurfaceDestroyed, this,
|
||||
&QNativeInterface::Private::QWaylandWindow::surfaceDestroyed);
|
||||
}
|
||||
|
||||
QWaylandWindow::~QWaylandWindow()
|
||||
@ -847,6 +852,15 @@ QWaylandShellSurface *QWaylandWindow::shellSurface() const
|
||||
return mShellSurface;
|
||||
}
|
||||
|
||||
std::any QWaylandWindow::_surfaceRole() const
|
||||
{
|
||||
if (mSubSurfaceWindow)
|
||||
return mSubSurfaceWindow->object();
|
||||
if (mShellSurface)
|
||||
return mShellSurface->surfaceRole();
|
||||
return {};
|
||||
}
|
||||
|
||||
QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
|
||||
{
|
||||
return mSubSurfaceWindow;
|
||||
|
@ -28,10 +28,12 @@
|
||||
#include <QtCore/QMap> // for QVariantMap
|
||||
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <qpa/qplatformwindow_p.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwayland-wayland.h>
|
||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||
#include <QtWaylandClient/qtwaylandclientglobal.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
|
||||
struct wl_egl_window;
|
||||
|
||||
@ -56,7 +58,8 @@ class QWaylandSurface;
|
||||
class QWaylandFractionalScale;
|
||||
class QWaylandViewport;
|
||||
|
||||
class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow
|
||||
class Q_WAYLANDCLIENT_EXPORT QWaylandWindow : public QNativeInterface::Private::QWaylandWindow,
|
||||
public QPlatformWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -115,17 +118,22 @@ public:
|
||||
|
||||
QMargins frameMargins() const override;
|
||||
QMargins customMargins() const;
|
||||
void setCustomMargins(const QMargins &margins);
|
||||
void setCustomMargins(const QMargins &margins) override;
|
||||
QSize surfaceSize() const;
|
||||
QRect windowContentGeometry() const;
|
||||
QPointF mapFromWlSurface(const QPointF &surfacePosition) const;
|
||||
|
||||
QWaylandSurface *waylandSurface() const { return mSurface.data(); }
|
||||
::wl_surface *wlSurface();
|
||||
::wl_surface *surface() const override
|
||||
{
|
||||
return const_cast<QWaylandWindow *>(this)->wlSurface();
|
||||
}
|
||||
static QWaylandWindow *fromWlSurface(::wl_surface *surface);
|
||||
|
||||
QWaylandDisplay *display() const { return mDisplay; }
|
||||
QWaylandShellSurface *shellSurface() const;
|
||||
std::any _surfaceRole() const override;
|
||||
QWaylandSubSurface *subSurfaceWindow() const;
|
||||
QWaylandScreen *waylandScreen() const;
|
||||
|
||||
@ -207,7 +215,7 @@ public:
|
||||
void deliverUpdateRequest() override;
|
||||
|
||||
void setXdgActivationToken(const QString &token);
|
||||
void requestXdgActivationToken(uint serial);
|
||||
void requestXdgActivationToken(uint serial) override;
|
||||
|
||||
void beginFrame();
|
||||
void endFrame();
|
||||
@ -222,7 +230,6 @@ public slots:
|
||||
signals:
|
||||
void wlSurfaceCreated();
|
||||
void wlSurfaceDestroyed();
|
||||
void xdgActivationTokenCreated(const QString &token);
|
||||
|
||||
protected:
|
||||
virtual void doHandleFrameCallback();
|
||||
|
Loading…
x
Reference in New Issue
Block a user