commit 21e7ef8a45caabcfe9b8e62fb126ebafe88eda75 Author: David Edmundson Date: Mon Sep 7 11:39:59 2020 +0100 native Change-Id: Idd66e2a515cf4f3489ab09ad9c3ced6249b35a80 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e60f0ba..72c1f850 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,7 @@ if (QT_FEATURE_wayland_client) endif() if (QT_FEATURE_wayland_server) - add_subdirectory(compositor) + # add_subdirectory(compositor) endif() if (QT_FEATURE_wayland_server OR QT_FEATURE_wayland_client) diff --git a/src/client/global/platformheaders.h b/src/client/global/platformheaders.h new file mode 100644 index 00000000..40825c0a --- /dev/null +++ b/src/client/global/platformheaders.h @@ -0,0 +1,75 @@ +//license blah blah + +#ifndef QWAYLANDPLATFORMHEADERS_H +#define QWAYLANDPLATFORMHEADERS_H + +#include + +struct wl_output; +struct wl_surface; +struct xdg_toplevel; +struct xdg_popup; + +QT_BEGIN_NAMESPACE + +namespace QPlatformInterface::Private { + +class QWaylandAbstractShellIntegration; + +struct Q_GUI_EXPORT QWaylandScreen +{ + QT_DECLARE_PLATFORM_INTERFACE(QWaylandScreen) + /** + * Returns the underlying handle for this screen. + * + * Note that in the case where no output is connected a fake QScreen object is created, + * at which point this will return null. + */ + virtual wl_output* output() = 0; +}; + +enum class ShellIntegration +{ + XdgShellTopLevel, + XdgShellPopup + //IVI etc. +}; + +struct Q_WAYLAND_CLIENT_EXPORT QWaylandWindow +{ + QT_DECLARE_PLATFORM_INTERFACE(QWaylandWindow) + /** + * Returns the underlying wl_surface handle for this window. + * + * This is created when the window is created, and destroyed when the window is hidden + * It is recreated only when the window is shown again. + */ + virtual wl_surface* surface() = 0; + virtual QWaylandAbstractShellIntegration *shellIntegration() = 0; + +}; + +struct Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractShellIntegration +{ +public: + virtual ShellIntegration type() = 0; +}; + +struct Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellTopLevel: QWaylandAbstractShellIntegration +{ + ShellIntegration type() override {return ShellIntegration::XdgShellTopLevel;}; + virtual xdg_toplevel* toplevel(); +}; + +struct Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellPopup: QWaylandAbstractShellIntegration +{ + ShellIntegration type() override {return ShellIntegration::XdgShellPopup;}; + virtual xdg_popup* popup(); + //TODO we can then expose all positioner stuff here +}; + +} // QPlatformInterface::Private + +QT_END_NAMESPACE + +#endif diff --git a/src/client/qwaylandscreen.cpp b/src/client/qwaylandscreen.cpp index 854f3b08..11370262 100644 --- a/src/client/qwaylandscreen.cpp +++ b/src/client/qwaylandscreen.cpp @@ -51,6 +51,10 @@ QT_BEGIN_NAMESPACE +//these shouldn't be here +QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QWaylandScreen); +QT_DEFINE_PRIVATE_PLATFORM_INTERFACE(QWaylandWindow); + namespace QtWaylandClient { QWaylandXdgOutputManagerV1::QWaylandXdgOutputManagerV1(QWaylandDisplay* display, uint id, uint version) diff --git a/src/client/qwaylandscreen_p.h b/src/client/qwaylandscreen_p.h index 404d0f1e..3d7004a1 100644 --- a/src/client/qwaylandscreen_p.h +++ b/src/client/qwaylandscreen_p.h @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -72,7 +73,11 @@ private: uint m_version = 1; // TODO: remove when we upgrade minimum libwayland requriement to 1.10 }; -class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output, QtWayland::zxdg_output_v1 +class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public + QPlatformScreen, + QPlatformInterface::Private::QWaylandScreen, + QtWayland::wl_output, + QtWayland::zxdg_output_v1 { public: QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id); @@ -108,7 +113,7 @@ public: #endif uint32_t outputId() const { return m_outputId; } - ::wl_output *output() { return QtWayland::wl_output::object(); } + ::wl_output *output() override { return QtWayland::wl_output::object(); }; static QWaylandScreen *waylandScreenFromWindow(QWindow *window); static QWaylandScreen *fromWlOutput(::wl_output *output); diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 9272d368..2f2a0649 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -64,6 +64,7 @@ #include #include +#include struct wl_egl_window; @@ -84,7 +85,7 @@ class QWaylandShmBackingStore; class QWaylandPointerEvent; class QWaylandSurface; -class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow +class Q_WAYLAND_CLIENT_EXPORT QWaylandWindow : public QObject, public QPlatformWindow, QPlatform::Private::QWaylandWindow { Q_OBJECT public: @@ -133,7 +134,7 @@ public: QPointF mapFromWlSurface(const QPointF &surfacePosition) const; QWaylandSurface *waylandSurface() const { return mSurface.data(); } - ::wl_surface *wlSurface(); + ::wl_surface *wlSurface() override; static QWaylandWindow *fromWlSurface(::wl_surface *surface); QWaylandDisplay *display() const { return mDisplay; }