var trayWindowY;\r
var tbOrientation = systrayBackend.taskbarOrientation();\r
var taskbarRect = systrayBackend.taskbarRect();\r
+ var screenRect = Qt.rect(0, 0, Screen.width, Screen.height)\r
+ if (Qt.platform.os === "linux") {\r
+ screenRect.x = Screen.virtualX\r
+ screenRect.y = Screen.virtualY\r
+ }\r
\r
switch(tbOrientation) {\r
// Platform separation here: Windows and macOS draw coordinates have to be given in screen-coordinates\r
case Systray.Bottom:\r
console.debug("Taskbar is on the bottom.");\r
trayWindowX = trayIconCenter.x - trayWindow.width / 2;\r
- trayWindowY = (Qt.platform.os !== "linux") ? (Screen.height - taskbarRect.height - trayWindow.height - 4)\r
- : (Screen.height + Screen.virtualY - taskbarRect.height - trayWindow.height - 4);\r
+ trayWindowY = screenRect.bottom - taskbarRect.height - trayWindow.height - 4;\r
break;\r
case Systray.Left:\r
console.debug("Taskbar is on the left.");\r
- trayWindowX = (Qt.platform.os !== "linux") ? (taskbarRect.width + 4)\r
- : (Screen.virtualX + taskbarRect.width + 4);\r
+ trayWindowX = screenRect.left + taskbarRect.width + 4;\r
trayWindowY = trayIconCenter.y;\r
break;\r
case Systray.Top:\r
console.debug("Taskbar is on the top.");\r
trayWindowX = trayIconCenter.x - trayWindow.width / 2;\r
- trayWindowY = Screen.virtualY + taskbarRect.height + 4;\r
+ trayWindowY = screenRect.top + taskbarRect.height + 4;\r
break;\r
case Systray.Right:\r
console.debug("Taskbar is on the right.");\r
- trayWindowX = (Qt.platform.os !== "linux") ? (Screen.width - taskbarRect.width - trayWindow.width - 4)\r
- : (Screen.width + Screen.virtualX - taskbarRect.width - trayWindow.width - 4);\r
+ trayWindowX = screenRect.right - taskbarRect.width - trayWindow.width - 4;\r
trayWindowY = trayIconCenter.y;\r
break;\r
}\r
console.debug("Taskbar height:", taskbarRect.height);\r
console.debug("Taskbar width:", taskbarRect.width);\r
\r
- if (Screen.width <= trayWindowX + trayWindow.width) {\r
+ if (screenRect.right <= trayWindowX + trayWindow.width) {\r
console.debug("Out-of-screen condition on the right detected. Adjusting window position.");\r
- if (Qt.platform.os !== "linux") {\r
- trayWindowX = Screen.width - trayWindow.width - 4;\r
- } else {\r
- trayWindowX = Screen.width + Screen.virtualX - trayWindow.width - 4 - (tbOrientation === Systray.Right ? taskbarRect.width : 0);\r
+ trayWindowX = screenRect.right - trayWindow.width - 4;\r
+\r
+ if (Qt.platform.os === "linux") {\r
+ trayWindowX -= tbOrientation === Systray.Right ? taskbarRect.width : 0;\r
}\r
}\r
- if (trayWindowX <= Screen.x && Qt.platform.os !== "linux") {\r
+ if (trayWindowX <= screenRect.left) {\r
console.debug("Out-of-screen condition on the left detected. Adjusting window position.");\r
- trayWindowX = Screen.x + 4;\r
- }\r
- if (trayWindowX <= Screen.virtualX && Qt.platform.os === "linux") {\r
- console.debug("Out-of-screen condition on the left detected. Adjusting window position.");\r
- trayWindowX = Screen.virtualX + 4 + (tbOrientation === Systray.Left ? taskbarRect.width : 0)\r
- }\r
- if (trayWindowY <= Screen.y && Qt.platform.os !== "linux") {\r
- console.debug("Out-of-screen condition on the top detected. Adjusting window position.");\r
- trayWindowY = Screen.y + 4;\r
+ trayWindowX = screenRect.left + 4;\r
+\r
+ if (Qt.platform.os === "linux") {\r
+ trayWindowX += tbOrientation === Systray.Left ? taskbarRect.width : 0;\r
+ }\r
}\r
- if (trayWindowY <= Screen.virtualY && Qt.platform.os === "linux") {\r
+ if (trayWindowY <= screenRect.top) {\r
console.debug("Out-of-screen condition on the top detected. Adjusting window position.");\r
- trayWindowY = Screen.virtualY + 4 + (tbOrientation === Systray.Top ? taskbarRect.height : 0);\r
+ trayWindowY = screenRect.top + 4;\r
+\r
+ if (Qt.platform.os === "linux") {\r
+ trayWindowY += tbOrientation === Systray.Top ? taskbarRect.height : 0;\r
+ }\r
}\r
- if (Screen.height <= trayWindowY - Screen.virtualY + trayWindow.height) {\r
+ if (screenRect.bottom <= trayWindowY + trayWindow.height) {\r
console.debug("Out-of-screen condition on the bottom detected. Adjusting window position.");\r
- if (Qt.platform.os !== "linux") {\r
- trayWindowY = Screen.height - trayWindow.height - 4;\r
- } else {\r
- trayWindowY = Screen.height + Screen.virtualY - trayWindow.height - 4;\r
- }\r
-\r
+ trayWindowY = screenRect.bottom - trayWindow.height - 4;\r
}\r
console.debug("Tray window position: x =",trayWindowX," y =",trayWindowY);\r
trayWindow.setX(trayWindowX);\r