소스 검색

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