Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@nextcloud.com>2020-07-15 12:23:11 +0300
committerKevin Ottens <ervin@ipsquad.net>2020-07-15 13:22:54 +0300
commit6b8d2270c6ff6b56ddc25f0536db430a3b7dbbf5 (patch)
tree0938437dea821b9c9d6dd879f4432cbbabb47e57 /src/gui/systray.cpp
parent2c50ecd4d39d85c0ca8782b3cd1bdc4329e9016f (diff)
Make sure the tray icon point is in screen coordinates
Previously we were using QCursor::pos() in the Linux case, which is a fair heuristic except it will always be relative to the primary screen and not the current screen. This explains why we had to adjust with the virtual geometry. In the Windows and Mac case we got the position out of QSystemTrayIcon and that one was already relative to the current screen. So now we use QCursor::pos(currentScreen()) which ensures we give the coordinates relatively to the current screen also in the Linux case. Since all platforms are now having that point in the same coordinate system we don't need to mess around with the virtual geometry to compensate. Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Diffstat (limited to 'src/gui/systray.cpp')
-rw-r--r--src/gui/systray.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp
index b2462f6c7..79105c8ce 100644
--- a/src/gui/systray.cpp
+++ b/src/gui/systray.cpp
@@ -279,8 +279,8 @@ QRect Systray::taskbarGeometry() const
QRect Systray::currentScreenRect() const
{
const auto screen = currentScreen();
- const auto rect = screen->geometry();
- return rect.translated(screen->virtualGeometry().topLeft());
+ Q_ASSERT(screen);
+ return screen->geometry();
}
QPoint Systray::computeWindowReferencePoint() const
@@ -378,7 +378,7 @@ QPoint Systray::calcTrayIconCenter() const
return trayIconCenter;
#else
// On Linux, fall back to mouse position (assuming tray icon is activated by mouse click)
- return QCursor::pos();
+ return QCursor::pos(currentScreen());
#endif
}