#pragma once #include #include #include #include #include #include #include #include namespace ZShell::internal { class WallpaperService; class WallpaperSurface : public QtWayland::zwlr_layer_surface_v1, public QtWayland::wp_viewport, public QtWayland::wp_fractional_scale_v1 { public: WallpaperSurface( WallpaperService* service, wl_surface* surface, wl_output* output, const QString& screen); ~WallpaperSurface() override; [[nodiscard]] const QString& screen() const { return m_screen; } [[nodiscard]] const QSize& size() const { return m_size; } [[nodiscard]] const QSize& bufferSize() const { return m_bufferSize; } [[nodiscard]] EGLSurface eglSurface() const { return m_eglSurface; } void redraw(); private: void zwlr_layer_surface_v1_configure( uint32_t serial, uint32_t width, uint32_t height) override; void zwlr_layer_surface_v1_closed() override; void wp_fractional_scale_v1_preferred_scale(uint32_t scale) override; void updateBuffer(); WallpaperService* m_service; QString m_screen; wl_surface* m_surface; wl_egl_window* m_window = nullptr; EGLSurface m_eglSurface = EGL_NO_SURFACE; QSize m_size; QSize m_bufferSize; qreal m_scale = 1.0; bool configured = false; }; } // namespace ZShell::internal