mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Use base::QScreenNearestTo in PipPanel
This commit is contained in:
parent
4fde7852b1
commit
53869ed994
1 changed files with 2 additions and 8 deletions
|
@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_media_view.h"
|
#include "styles/style_media_view.h"
|
||||||
|
#include "base/qt_adapters.h"
|
||||||
|
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
|
@ -48,14 +49,7 @@ constexpr auto kMsInSecond = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QRect ScreenFromPosition(QPoint point) {
|
[[nodiscard]] QRect ScreenFromPosition(QPoint point) {
|
||||||
const auto screen = [&]() -> QScreen* {
|
const auto screen = base::QScreenNearestTo(point);
|
||||||
for (const auto screen : QGuiApplication::screens()) {
|
|
||||||
if (screen->geometry().contains(point)) {
|
|
||||||
return screen;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}();
|
|
||||||
const auto use = screen ? screen : QGuiApplication::primaryScreen();
|
const auto use = screen ? screen : QGuiApplication::primaryScreen();
|
||||||
return use
|
return use
|
||||||
? use->availableGeometry()
|
? use->availableGeometry()
|
||||||
|
|
Loading…
Add table
Reference in a new issue