From a307e7a798d43aa8c07907c208de3788b1a6aa62 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 3 Sep 2024 10:09:41 +0400 Subject: [PATCH] Replace fullscreen mask workaround with Qt one --- .../media/view/media_view_overlay_widget.cpp | 32 ++++--------------- .../platform/win/integration_win.cpp | 9 +++++- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 73771158c..e072ca63a 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -998,35 +998,15 @@ void OverlayWidget::updateGeometry(bool inMove) { void OverlayWidget::updateGeometryToScreen(bool inMove) { const auto available = _window->screen()->geometry(); - const auto openglWidget = _opengl - ? static_cast(_widget.get()) - : nullptr; - const auto possibleSizeHack = Platform::IsWindows() && openglWidget; - const auto useSizeHack = possibleSizeHack - && (openglWidget->format().renderableType() - != QSurfaceFormat::OpenGLES); - const auto use = useSizeHack - ? available.marginsAdded({ 0, 0, 0, 1 }) - : available; - const auto mask = useSizeHack - ? QRegion(QRect(QPoint(), available.size())) - : QRegion(); - if (inMove && use.contains(_window->geometry())) { - return; - } - if ((_window->geometry() == use) - && (!possibleSizeHack || _window->mask() == mask)) { + if (_window->geometry() == available) { return; } DEBUG_LOG(("Viewer Pos: Setting %1, %2, %3, %4") - .arg(use.x()) - .arg(use.y()) - .arg(use.width()) - .arg(use.height())); - _window->setGeometry(use); - if (possibleSizeHack) { - _window->setMask(mask); - } + .arg(available.x()) + .arg(available.y()) + .arg(available.width()) + .arg(available.height())); + _window->setGeometry(available); } void OverlayWidget::updateControlsGeometry() { diff --git a/Telegram/SourceFiles/platform/win/integration_win.cpp b/Telegram/SourceFiles/platform/win/integration_win.cpp index 0a44470da..9a75a3a65 100644 --- a/Telegram/SourceFiles/platform/win/integration_win.cpp +++ b/Telegram/SourceFiles/platform/win/integration_win.cpp @@ -19,8 +19,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "tray.h" #include "styles/style_window.h" -#include #include +#include #include #include @@ -28,6 +28,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Platform { void WindowsIntegration::init() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + using namespace QNativeInterface::Private; + const auto native = qApp->nativeInterface(); + if (native) { + native->setHasBorderInFullScreenDefault(true); + } +#endif // Qt >= 6.5.0 QCoreApplication::instance()->installNativeEventFilter(this); _taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated"); }