Fix build with Qt6.8

This commit is contained in:
Fushan Wen 2024-02-08 17:14:20 +08:00
parent f1e50306f8
commit 957cbbebe4
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA

View File

@ -16,6 +16,31 @@
#include <QGuiApplication>
namespace
{
template<typename T>
concept QWaylandWindowOldV6Type = requires(T t) { t.handleExpose(QRect()); };
template<typename T>
concept QWaylandWindowNewV6Type = requires(T t) { t.sendRecursiveExposeEvent(); };
class ExposeHelper
{
public:
template<QWaylandWindowOldV6Type V6T>
ExposeHelper(V6T *window, const QSize &pendingSize)
{
window->handleExpose(QRect(QPoint(), pendingSize));
}
template<QWaylandWindowNewV6Type V6T>
ExposeHelper(V6T *window, [[maybe_unused]] const QSize &pendingSize)
{
window->sendRecursiveExposeEvent();
}
};
}
namespace LayerShellQt
{
QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window)
@ -92,7 +117,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint
if (!m_configured) {
m_configured = true;
window()->resizeFromApplyConfigure(m_pendingSize);
window()->handleExpose(QRect(QPoint(), m_pendingSize));
ExposeHelper helper(window(), m_pendingSize);
} else {
// Later configures are resizes, so we have to queue them up for a time when we
// are not painting to the window.