mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Get media viewer screen by checking the screen by active window position
QWindow::screen seem to be buggy on Windows and doesn't always follow window moves
This commit is contained in:
parent
b32b10a4e1
commit
4e090fcfda
1 changed files with 10 additions and 1 deletions
|
@ -481,7 +481,16 @@ void OverlayWidget::refreshLang() {
|
||||||
|
|
||||||
void OverlayWidget::moveToScreen(bool inMove) {
|
void OverlayWidget::moveToScreen(bool inMove) {
|
||||||
const auto widgetScreen = [&](auto &&widget) -> QScreen* {
|
const auto widgetScreen = [&](auto &&widget) -> QScreen* {
|
||||||
if (auto handle = widget ? widget->windowHandle() : nullptr) {
|
if (!widget) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (!Platform::IsWayland()) {
|
||||||
|
if (const auto screen = QGuiApplication::screenAt(
|
||||||
|
widget->geometry().center())) {
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (const auto handle = widget->windowHandle()) {
|
||||||
return handle->screen();
|
return handle->screen();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue