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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user