Fix build with Qt6.8

handleExpose was removed in 20fb0e7dd5
This commit is contained in:
Fushan Wen 2024-02-08 17:14:20 +08:00
parent f1e50306f8
commit b8a9938c0d
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 QWaylandWindowNewV6Type = requires(T t) { t.sendRecursiveExposeEvent(); };
template<typename T>
concept QWaylandWindowOldV6Type = requires(T t) { t.handleExpose(QRect()); } && !requires(T t) { t.sendRecursiveExposeEvent(); };
class ExposeHelper
{
public:
template<QWaylandWindowOldV6Type T>
[[maybe_unused]] ExposeHelper(T *window, const QSize &pendingSize)
{
window->handleExpose(QRect(QPoint(), pendingSize));
}
template<QWaylandWindowNewV6Type T>
[[maybe_unused]] ExposeHelper(T *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.