mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02: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
3 changed files with 7 additions and 13 deletions
|
@ -509,10 +509,7 @@ void OverlayWidget::updateGeometry(bool inMove) {
|
||||||
if (Platform::IsWayland()) {
|
if (Platform::IsWayland()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto screen = _widget->screen()
|
const auto available = _widget->screen()->geometry();
|
||||||
? _widget->screen()
|
|
||||||
: QApplication::primaryScreen();
|
|
||||||
const auto available = screen->geometry();
|
|
||||||
const auto openglWidget = _opengl
|
const auto openglWidget = _opengl
|
||||||
? static_cast<QOpenGLWidget*>(_widget.get())
|
? static_cast<QOpenGLWidget*>(_widget.get())
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
|
@ -477,14 +477,11 @@ void PipPanel::setPositionDefault() {
|
||||||
if (parentScreen && myScreen && myScreen != parentScreen) {
|
if (parentScreen && myScreen && myScreen != parentScreen) {
|
||||||
widget()->setScreen(parentScreen);
|
widget()->setScreen(parentScreen);
|
||||||
}
|
}
|
||||||
const auto screen = parentScreen
|
|
||||||
? parentScreen
|
|
||||||
: QGuiApplication::primaryScreen();
|
|
||||||
auto position = Position();
|
auto position = Position();
|
||||||
position.snapped = RectPart::Top | RectPart::Left;
|
position.snapped = RectPart::Top | RectPart::Left;
|
||||||
position.screen = screen->geometry();
|
position.screen = parentScreen->geometry();
|
||||||
position.geometry = QRect(0, 0, st::pipDefaultSize, st::pipDefaultSize);
|
position.geometry = QRect(0, 0, st::pipDefaultSize, st::pipDefaultSize);
|
||||||
setPositionOnScreen(position, screen->availableGeometry());
|
setPositionOnScreen(position, parentScreen->availableGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PipPanel::setPositionOnScreen(Position position, QRect available) {
|
void PipPanel::setPositionOnScreen(Position position, QRect available) {
|
||||||
|
|
|
@ -815,7 +815,7 @@ void MainWindow::updateUnreadCounter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect MainWindow::computeDesktopRect() const {
|
QRect MainWindow::computeDesktopRect() const {
|
||||||
return (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
|
return screen()->availableGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::savePosition(Qt::WindowState state) {
|
void MainWindow::savePosition(Qt::WindowState state) {
|
||||||
|
@ -954,12 +954,12 @@ void MainWindow::showRightColumn(object_ptr<TWidget> widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MainWindow::maximalExtendBy() const {
|
int MainWindow::maximalExtendBy() const {
|
||||||
auto desktop = (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
|
auto desktop = screen()->availableGeometry();
|
||||||
return std::max(desktop.width() - body()->width(), 0);
|
return std::max(desktop.width() - body()->width(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::canExtendNoMove(int extendBy) const {
|
bool MainWindow::canExtendNoMove(int extendBy) const {
|
||||||
auto desktop = (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
|
auto desktop = screen()->availableGeometry();
|
||||||
auto inner = body()->mapToGlobal(body()->rect());
|
auto inner = body()->mapToGlobal(body()->rect());
|
||||||
auto innerRight = (inner.x() + inner.width() + extendBy);
|
auto innerRight = (inner.x() + inner.width() + extendBy);
|
||||||
auto desktopRight = (desktop.x() + desktop.width());
|
auto desktopRight = (desktop.x() + desktop.width());
|
||||||
|
@ -967,7 +967,7 @@ bool MainWindow::canExtendNoMove(int extendBy) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MainWindow::tryToExtendWidthBy(int addToWidth) {
|
int MainWindow::tryToExtendWidthBy(int addToWidth) {
|
||||||
auto desktop = (screen() ? screen() : QApplication::primaryScreen())->availableGeometry();
|
auto desktop = screen()->availableGeometry();
|
||||||
auto inner = body()->mapToGlobal(body()->rect());
|
auto inner = body()->mapToGlobal(body()->rect());
|
||||||
accumulate_min(
|
accumulate_min(
|
||||||
addToWidth,
|
addToWidth,
|
||||||
|
|
Loading…
Add table
Reference in a new issue