Add name argument to PositionWithScreen

This commit is contained in:
Ilya Fedin
2026-01-31 11:10:23 +04:00
committed by John Preston
parent 64c5796d1a
commit d33293ba6b
4 changed files with 16 additions and 8 deletions
+2 -1
View File
@@ -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) {
+2 -1
View File
@@ -100,7 +100,8 @@ void DelegateImpl::ivSaveGeometry(not_null<Ui::RpWindow*> 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) {
@@ -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) {
+10 -5
View File
@@ -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<const QWidget*> 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