From 8c1bef929e4f07bee2fdce4055d4349d835e5425 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Aug 2022 01:36:52 +0400 Subject: [PATCH] A better way of PiP aspect ratio handling on Wayland --- .../SourceFiles/media/view/media_view_pip.cpp | 31 ++++--------------- .../platform/linux/specific_linux.cpp | 2 -- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_pip.cpp b/Telegram/SourceFiles/media/view/media_view_pip.cpp index 6d23f07f07..c5b198d8ce 100644 --- a/Telegram/SourceFiles/media/view/media_view_pip.cpp +++ b/Telegram/SourceFiles/media/view/media_view_pip.cpp @@ -38,17 +38,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include -#include - -#ifdef QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB -// private QtWaylandClient headers are using keywords :( -#ifdef QT_NO_KEYWORDS -#define signals Q_SIGNALS -#define slots Q_SLOTS -#endif // QT_NO_KEYWORDS - -#include -#endif // QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB +#include +#include namespace Media { namespace View { @@ -599,11 +590,6 @@ void PipPanel::handleResize(QSize size) { if (!Platform::IsWayland()) { return; } - - const auto d = dynamic_cast(rp()->rpPrivate()); - if (!d) { - return; - } // Apply aspect ratio. const auto max = std::max(size.width(), size.height()); @@ -622,15 +608,10 @@ void PipPanel::handleResize(QSize size) { size.height()) : scaled; - d->data.crect = QRect(d->data.crect.topLeft(), normalized); - -#ifdef QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB - using QtWaylandClient::QWaylandEglWindow; - if (const auto waylandEglWindow = dynamic_cast( - widget()->windowHandle()->handle())) { - waylandEglWindow->ensureSize(); - } -#endif // QT_WAYLAND_EGL_CLIENT_HW_INTEGRATION_LIB + setGeometry(QRect(widget()->geometry().topLeft(), normalized)); + QWindowSystemInterface::handleGeometryChange( + widget()->windowHandle(), + widget()->windowHandle()->handle()->geometry()); } void PipPanel::handleScreenChanged(QScreen *screen) { diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 56b04763bc..33f520bbbc 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -491,7 +491,6 @@ void start() { LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName())); #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION - qputenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION", "desktop-app-wayland-egl"); qputenv("QT_WAYLAND_SHELL_INTEGRATION", "desktop-app-xdg-shell;xdg-shell"); #endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION @@ -631,7 +630,6 @@ void start() { #ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION InvokeQueued(qApp, [] { - qunsetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); qunsetenv("QT_WAYLAND_SHELL_INTEGRATION"); }); #endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION