Skip to content

Commit 0729bd7

Browse files
ilya-fedinjohn-preston
authored andcommitted
Initial screen from geometry
1 parent 27e1867 commit 0729bd7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Telegram/SourceFiles/window/main_window.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ QRect MainWindow::countInitialGeometry(
720720
return screen;
721721
}
722722
}
723-
return nullptr;
723+
return QGuiApplication::screenAt(position.rect().center());
724724
}();
725725
if (!screen) {
726726
return initial.rect();
@@ -752,8 +752,10 @@ QRect MainWindow::countInitialGeometry(
752752
).arg(spaceForInner.width()
753753
).arg(spaceForInner.height()));
754754

755-
const auto x = spaceForInner.x() - screenGeometry.x();
756-
const auto y = spaceForInner.y() - screenGeometry.y();
755+
const auto x = spaceForInner.x()
756+
- (position.moncrc ? screenGeometry.x() : 0);
757+
const auto y = spaceForInner.y()
758+
- (position.moncrc ? screenGeometry.y() : 0);
757759
const auto w = spaceForInner.width();
758760
const auto h = spaceForInner.height();
759761
if (w < st::windowMinWidth || h < st::windowMinHeight) {
@@ -791,8 +793,10 @@ QRect MainWindow::countInitialGeometry(
791793
position.h -= newDistance;
792794
}
793795
}
794-
position.x += screenGeometry.x();
795-
position.y += screenGeometry.y();
796+
if (position.moncrc) {
797+
position.x += screenGeometry.x();
798+
position.y += screenGeometry.y();
799+
}
796800
if ((position.x + st::windowMinWidth
797801
> screenGeometry.x() + screenGeometry.width())
798802
|| (position.y + st::windowMinHeight
@@ -1113,9 +1117,6 @@ WindowPosition PositionWithScreen(
11131117
).arg(geometry.y()
11141118
).arg(geometry.width()
11151119
).arg(geometry.height()));
1116-
position.x -= geometry.x();
1117-
position.y -= geometry.y();
1118-
position.moncrc = Platform::ScreenNameChecksum(chosen->name());
11191120
return position;
11201121
}
11211122

0 commit comments

Comments
 (0)