From: Claudio Cambra Date: Mon, 14 Feb 2022 11:12:45 +0000 (+0100) Subject: Simplify currentScreen X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~17^2~130^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f6b377ab17fb56d2035d6ba4cef0a5c5190e7d3d;p=nextcloud-desktop.git Simplify currentScreen Signed-off-by: Claudio Cambra --- diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 263a91972..b5c8d6556 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();