2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Remove unneeded primary screen fallbacks

QWidget::screen automatically fallbacks to primary screen as the last effort, so this is not needed
This commit is contained in:
Ilya Fedin
2022-04-19 08:43:43 +04:00
committed by John Preston
parent 9a4d2bc8f9
commit bf4fc2596a
3 changed files with 7 additions and 13 deletions

View File

@@ -815,7 +815,7 @@ void MainWindow::updateUnreadCounter() {
}
QRect MainWindow::computeDesktopRect() const {
return (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
return screen()->availableGeometry();
}
void MainWindow::savePosition(Qt::WindowState state) {
@@ -954,12 +954,12 @@ void MainWindow::showRightColumn(object_ptr<TWidget> widget) {
}
int MainWindow::maximalExtendBy() const {
auto desktop = (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
auto desktop = screen()->availableGeometry();
return std::max(desktop.width() - body()->width(), 0);
}
bool MainWindow::canExtendNoMove(int extendBy) const {
auto desktop = (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
auto desktop = screen()->availableGeometry();
auto inner = body()->mapToGlobal(body()->rect());
auto innerRight = (inner.x() + inner.width() + extendBy);
auto desktopRight = (desktop.x() + desktop.width());
@@ -967,7 +967,7 @@ bool MainWindow::canExtendNoMove(int extendBy) const {
}
int MainWindow::tryToExtendWidthBy(int addToWidth) {
auto desktop = (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
auto desktop = screen()->availableGeometry();
auto inner = body()->mapToGlobal(body()->rect());
accumulate_min(
addToWidth,