浏览代码

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

Simplify currentScreen in systray.cpp
Claudio Cambra 4 年之前
父节点
当前提交
fe3011cefd
共有 1 个文件被更改,包括 3 次插入7 次删除
  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();