mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Always force window frame inside screen geometry.
I hope this fixes #16934.
This commit is contained in:
parent
bc2f96251f
commit
3e681e5449
2 changed files with 21 additions and 18 deletions
|
@ -486,29 +486,32 @@ QRect MainWindow::countInitialGeometry(Core::WindowPosition position) {
|
|||
if (!screen) {
|
||||
return initial;
|
||||
}
|
||||
const auto frame = [&] {
|
||||
if (!Core::App().settings().nativeWindowFrame()) {
|
||||
return QMargins();
|
||||
}
|
||||
const auto inner = geometry();
|
||||
const auto outer = frameGeometry();
|
||||
return QMargins(
|
||||
inner.x() - outer.x(),
|
||||
inner.y() - outer.y(),
|
||||
outer.x() + outer.width() - inner.x() - inner.width(),
|
||||
outer.y() + outer.height() - inner.y() - inner.height());
|
||||
}();
|
||||
|
||||
const auto frame = frameMargins();
|
||||
const auto screenGeometry = screen->geometry();
|
||||
const auto availableGeometry = screen->availableGeometry();
|
||||
const auto spaceForInner = availableGeometry.marginsRemoved(
|
||||
frame);
|
||||
const auto spaceForInner = availableGeometry.marginsRemoved(frame);
|
||||
DEBUG_LOG(("Window Pos: "
|
||||
"Screen found, screen geometry: %1, %2, %3, %4"
|
||||
"Screen found, screen geometry: %1, %2, %3, %4, "
|
||||
"available: %5, %6, %7, %8"
|
||||
).arg(screenGeometry.x()
|
||||
).arg(screenGeometry.y()
|
||||
).arg(screenGeometry.width()
|
||||
).arg(screenGeometry.height()));
|
||||
).arg(screenGeometry.height()
|
||||
).arg(availableGeometry.x()
|
||||
).arg(availableGeometry.y()
|
||||
).arg(availableGeometry.width()
|
||||
).arg(availableGeometry.height()));
|
||||
DEBUG_LOG(("Window Pos: "
|
||||
"Window frame margins: %1, %2, %3, %4, "
|
||||
"available space for inner geometry: %5, %6, %7, %8"
|
||||
).arg(frame.left()
|
||||
).arg(frame.top()
|
||||
).arg(frame.right()
|
||||
).arg(frame.bottom()
|
||||
).arg(spaceForInner.x()
|
||||
).arg(spaceForInner.y()
|
||||
).arg(spaceForInner.width()
|
||||
).arg(spaceForInner.height()));
|
||||
|
||||
const auto x = spaceForInner.x() - screenGeometry.x();
|
||||
const auto y = spaceForInner.y() - screenGeometry.y();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit b35d2d257a421f6adce0e60d62126ee65f46f573
|
||||
Subproject commit 2d53ef070f3dee5f36246c2c7ce830f755847344
|
Loading…
Add table
Reference in a new issue