mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-15 02:44:45 +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:
parent
9a4d2bc8f9
commit
bf4fc2596a
@ -509,10 +509,7 @@ void OverlayWidget::updateGeometry(bool inMove) {
|
||||
if (Platform::IsWayland()) {
|
||||
return;
|
||||
}
|
||||
const auto screen = _widget->screen()
|
||||
? _widget->screen()
|
||||
: QApplication::primaryScreen();
|
||||
const auto available = screen->geometry();
|
||||
const auto available = _widget->screen()->geometry();
|
||||
const auto openglWidget = _opengl
|
||||
? static_cast<QOpenGLWidget*>(_widget.get())
|
||||
: nullptr;
|
||||
|
@ -477,14 +477,11 @@ void PipPanel::setPositionDefault() {
|
||||
if (parentScreen && myScreen && myScreen != parentScreen) {
|
||||
widget()->setScreen(parentScreen);
|
||||
}
|
||||
const auto screen = parentScreen
|
||||
? parentScreen
|
||||
: QGuiApplication::primaryScreen();
|
||||
auto position = Position();
|
||||
position.snapped = RectPart::Top | RectPart::Left;
|
||||
position.screen = screen->geometry();
|
||||
position.screen = parentScreen->geometry();
|
||||
position.geometry = QRect(0, 0, st::pipDefaultSize, st::pipDefaultSize);
|
||||
setPositionOnScreen(position, screen->availableGeometry());
|
||||
setPositionOnScreen(position, parentScreen->availableGeometry());
|
||||
}
|
||||
|
||||
void PipPanel::setPositionOnScreen(Position position, QRect available) {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user