mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 00:47:22 +00:00
Fix thumbnail popup x position on Wayland layer-shell
On a zwlr_layer_shell surface the compositor does not send the window's screen position back to the client, so mapToGlobal returns dock-local coordinates instead of screen-absolute ones. Compute position from screen.virtualX + targetDelegate.x directly; the dock is full-width and bottom-anchored so no global mapping is needed.
This commit is contained in:
parent
84a6fa8054
commit
8632d47d68
1 changed files with 9 additions and 9 deletions
|
|
@ -1016,21 +1016,21 @@ MouseArea {
|
||||||
// Position above the hovered dock icon, in global coordinates
|
// Position above the hovered dock icon, in global coordinates
|
||||||
x: {
|
x: {
|
||||||
if (!targetDelegate) return 0
|
if (!targetDelegate) return 0
|
||||||
var delegateGlobal = targetDelegate.mapToGlobal(0, 0)
|
var win = root.Window.window
|
||||||
var win = targetDelegate.Window.window
|
|
||||||
var screenLeft = win && win.screen ? win.screen.virtualX : 0
|
var screenLeft = win && win.screen ? win.screen.virtualX : 0
|
||||||
var screenRight = screenLeft + (win && win.screen ? win.screen.width : Screen.width)
|
var screenRight = screenLeft + (win && win.screen ? win.screen.width : Screen.width)
|
||||||
var centered = delegateGlobal.x + (targetDelegate.width - width) / 2
|
// The dock window is full-width, anchored to the screen's left edge.
|
||||||
return Math.max(screenLeft, Math.min(screenRight - width, centered))
|
// targetDelegate.x is dock-local, so the global center of the icon is:
|
||||||
|
var globalCenter = screenLeft + targetDelegate.x + targetDelegate.width / 2
|
||||||
|
return Math.max(screenLeft, Math.min(screenRight - width, globalCenter - width / 2))
|
||||||
}
|
}
|
||||||
y: {
|
y: {
|
||||||
if (!targetDelegate) return 0
|
var win = root.Window.window
|
||||||
var delegateGlobal = targetDelegate.mapToGlobal(0, 0)
|
|
||||||
var win = targetDelegate.Window.window
|
|
||||||
var screenTop = win && win.screen ? win.screen.virtualY : 0
|
var screenTop = win && win.screen ? win.screen.virtualY : 0
|
||||||
var screenBottom = screenTop + (win && win.screen ? win.screen.height : Screen.height)
|
var screenBottom = screenTop + (win && win.screen ? win.screen.height : Screen.height)
|
||||||
var above = delegateGlobal.y - height - Kirigami.Units.smallSpacing
|
// Dock is bottom-anchored; its top edge is at screenBottom - dock window height.
|
||||||
return Math.max(screenTop, Math.min(screenBottom - height, above))
|
var dockTop = screenBottom - (win ? win.height : root.height)
|
||||||
|
return Math.max(screenTop, dockTop - height - Kirigami.Units.smallSpacing)
|
||||||
}
|
}
|
||||||
|
|
||||||
onShowingChanged: {
|
onShowingChanged: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue