Synchronize PiP's screen detection code with media viewer

This commit is contained in:
Ilya Fedin 2022-03-20 08:36:39 +04:00 committed by John Preston
parent a943a993cb
commit 3967e5d4ff
1 changed files with 10 additions and 1 deletions

View File

@ -464,7 +464,16 @@ PipPanel::Position PipPanel::countPosition() const {
void PipPanel::setPositionDefault() {
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 nullptr;