From d33293ba6b52ecc90cba9637207c174eb16533c1 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 31 Jan 2026 11:10:23 +0400 Subject: [PATCH] Add name argument to PositionWithScreen --- Telegram/SourceFiles/calls/calls_panel.cpp | 3 ++- Telegram/SourceFiles/iv/iv_delegate_impl.cpp | 3 ++- .../media/view/media_view_overlay_widget.cpp | 3 ++- Telegram/SourceFiles/window/main_window.cpp | 15 ++++++++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 2c8b1e308e..4462eec6ca 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -259,7 +259,8 @@ void Panel::savePanelGeometry() { realPosition = ::Window::PositionWithScreen( realPosition, window(), - { st::callWidthMin, st::callHeightMin }); + { st::callWidthMin, st::callHeightMin }, + u"Call"_q); if (realPosition.w >= st::callWidthMin && realPosition.h >= st::callHeightMin && realPosition != savedPosition) { diff --git a/Telegram/SourceFiles/iv/iv_delegate_impl.cpp b/Telegram/SourceFiles/iv/iv_delegate_impl.cpp index e97de87bf8..3cbb597033 100644 --- a/Telegram/SourceFiles/iv/iv_delegate_impl.cpp +++ b/Telegram/SourceFiles/iv/iv_delegate_impl.cpp @@ -100,7 +100,8 @@ void DelegateImpl::ivSaveGeometry(not_null window) { realPosition = Window::PositionWithScreen( realPosition, window, - { st::ivWidthMin, st::ivHeightMin }); + { st::ivWidthMin, st::ivHeightMin }, + u"IV"_q); if (realPosition.w >= st::ivWidthMin && realPosition.h >= st::ivHeightMin && realPosition != savedPosition) { diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index e5bcdf5edd..14b2fbc43d 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -1003,7 +1003,8 @@ void OverlayWidget::savePosition() { realPosition = Window::PositionWithScreen( realPosition, _window, - { st::mediaviewMinWidth, st::mediaviewMinHeight }); + { st::mediaviewMinWidth, st::mediaviewMinHeight }, + u"Viewer"_q); if (realPosition.w >= st::mediaviewMinWidth && realPosition.h >= st::mediaviewMinHeight && realPosition != savedPosition) { diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 9844db6e64..092c0a46c3 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -985,7 +985,8 @@ WindowPosition MainWindow::withScreenInPosition( return PositionWithScreen( position, this, - { st::windowMinWidth, st::windowMinHeight }); + { st::windowMinWidth, st::windowMinHeight }, + u"Window"_q); } bool MainWindow::minimizeToTray() { @@ -1094,7 +1095,8 @@ int32 DefaultScreenNameChecksum(const QString &name) { WindowPosition PositionWithScreen( WindowPosition position, const QScreen *chosen, - QSize minimal) { + QSize minimal, + const QString &name) { if (!chosen) { return position; } @@ -1112,7 +1114,8 @@ WindowPosition PositionWithScreen( position.y = available.y() + available.height() - position.h; } const auto geometry = chosen->geometry(); - DEBUG_LOG(("Window Pos: Screen found, geometry: %1, %2, %3, %4" + DEBUG_LOG(("%1 Pos: Screen found, geometry: %2, %3, %4, %5" + ).arg(name ).arg(geometry.x() ).arg(geometry.y() ).arg(geometry.width() @@ -1123,12 +1126,14 @@ WindowPosition PositionWithScreen( WindowPosition PositionWithScreen( WindowPosition position, not_null widget, - QSize minimal) { + QSize minimal, + const QString &name) { const auto screen = widget->screen(); return PositionWithScreen( position, screen ? screen : QGuiApplication::primaryScreen(), - minimal); + minimal, + name); } } // namespace Window