diff options
author | Claudio Cambra <claudio.cambra@gmail.com> | 2022-02-14 14:12:45 +0300 |
---|---|---|
committer | Claudio Cambra <claudio.cambra@gmail.com> | 2022-02-14 14:12:45 +0300 |
commit | 6ebf489a512fab10dee3103044096b4e0b4ac827 (patch) | |
tree | 6b426167e4f95bb83bdb43f0876166473b86e0d6 | |
parent | 79a5e58e61e384a058a50c4b9f789851c3375846 (diff) |
Simplify currentScreenbugfix/simplify-current-screen
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r-- | src/gui/systray.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 707609612..18259f27b 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -308,15 +308,11 @@ void Systray::forceWindowInit(QQuickWindow *window) const QScreen *Systray::currentScreen() const { - const auto screens = QGuiApplication::screens(); - const auto cursorPos = QCursor::pos(); + const auto screen = QGuiApplication::screenAt(QCursor::pos()); - for (const auto screen : screens) { - if (screen->geometry().contains(cursorPos)) { - return screen; - } + if(screen) { + return screen; } - // Didn't find anything matching the cursor position, // falling back to the primary screen return QGuiApplication::primaryScreen(); |