Explorar o código

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

Simplify currentScreen in systray.cpp
Claudio Cambra %!s(int64=4) %!d(string=hai) anos
pai
achega
fe3011cefd
Modificáronse 1 ficheiros con 3 adicións e 7 borrados
  1. 3 7
      src/gui/systray.cpp

+ 3 - 7
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();