Merge pull request #4279 from nextcloud/bugfix/simplify-current-screen

Simplify currentScreen in systray.cpp
This commit is contained in:
Claudio Cambra 2022-03-02 14:44:59 +01:00 committed by GitHub
commit fe3011cefd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -308,15 +308,11 @@ void Systray::forceWindowInit(QQuickWindow *window) const
QScreen *Systray::currentScreen() const QScreen *Systray::currentScreen() const
{ {
const auto screens = QGuiApplication::screens(); const auto screen = QGuiApplication::screenAt(QCursor::pos());
const auto cursorPos = QCursor::pos();
for (const auto screen : screens) { if(screen) {
if (screen->geometry().contains(cursorPos)) { return screen;
return screen;
}
} }
// Didn't find anything matching the cursor position, // Didn't find anything matching the cursor position,
// falling back to the primary screen // falling back to the primary screen
return QGuiApplication::primaryScreen(); return QGuiApplication::primaryScreen();