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:
Ilya Fedin 2022-03-16 01:08:41 +04:00 committed by John Preston
parent b32b10a4e1
commit 4e090fcfda
1 changed files with 10 additions and 1 deletions

View File

@ -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;