Use base::QScreenNearestTo in PipPanel

This commit is contained in:
Ilya Fedin 2021-02-19 10:03:34 +04:00 committed by John Preston
parent 4fde7852b1
commit 53869ed994
1 changed files with 2 additions and 8 deletions

View File

@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_widgets.h"
#include "styles/style_window.h"
#include "styles/style_media_view.h"
#include "base/qt_adapters.h"
#include <QtGui/QWindow>
#include <QtGui/QScreen>
@ -48,14 +49,7 @@ constexpr auto kMsInSecond = 1000;
}
[[nodiscard]] QRect ScreenFromPosition(QPoint point) {
const auto screen = [&]() -> QScreen* {
for (const auto screen : QGuiApplication::screens()) {
if (screen->geometry().contains(point)) {
return screen;
}
}
return nullptr;
}();
const auto screen = base::QScreenNearestTo(point);
const auto use = screen ? screen : QGuiApplication::primaryScreen();
return use
? use->availableGeometry()