From 47268d21ceb0878b0d01534d8a33d1d28f5320a1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 1 Sep 2022 16:31:28 +0400 Subject: [PATCH] Get wayland serial with new Qt 6.4 API --- .../linux/ui_linux_wayland_integration.cpp | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/ui/platform/linux/ui_linux_wayland_integration.cpp b/ui/platform/linux/ui_linux_wayland_integration.cpp index 32666b3..8dba5e9 100644 --- a/ui/platform/linux/ui_linux_wayland_integration.cpp +++ b/ui/platform/linux/ui_linux_wayland_integration.cpp @@ -15,23 +15,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include - -// private QtWaylandClient headers are using keywords :( -#ifdef QT_NO_KEYWORDS -#define signals Q_SIGNALS -#define slots Q_SLOTS -#endif // QT_NO_KEYWORDS - -#include -#include -#include - #include Q_DECLARE_METATYPE(QMargins); -using QtWaylandClient::QWaylandWindow; - namespace Ui { namespace Platform { namespace { @@ -198,21 +185,20 @@ void WaylandIntegration::showWindowMenu( const auto seat = reinterpret_cast( native->nativeResourceForIntegration(QByteArray("wl_seat"))); - - const auto serial = [&]() -> std::optional { - const auto waylandWindow = static_cast( - widget->windowHandle()->handle()); - if (!waylandWindow) { - return std::nullopt; - } - return waylandWindow->display()->defaultInputDevice()->serial(); - }(); - if (!toplevel || !seat || !serial) { + const auto serial = uint32_t(reinterpret_cast( + native->nativeResourceForIntegration(QByteArray("serial")))); + + if (!toplevel || !seat) { return; } - xdg_toplevel_show_window_menu(toplevel, seat, *serial, point.x(), point.y()); + xdg_toplevel_show_window_menu( + toplevel, + seat, + serial, + point.x(), + point.y()); } } // namespace Platform