Skip to content

Commit 174a567

Browse files
committed
fix(windows): resync embedded player geometry after restore
On Windows, transitioning the top-level window through minimize → maximize left the embedded mpv HWND offset a few pixels up-and-left. Nudge the native QWindow.width on visibility changes to force a SetWindowPos.
1 parent c863a7c commit 174a567

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

qt/qml/views/player/MpvqcPlayerWindows.qml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,29 @@ import QtQuick
77
import pyobjects
88

99
WindowContainer {
10+
id: root
11+
1012
window: MpvWindowPyObject {}
13+
14+
// Workaround: on Windows, when the top-level transitions through
15+
// minimize → maximize, the embedded child HWND ends up offset by a few
16+
// pixels up-and-left from its correct position. Nudging the native
17+
// QWindow.width forces a SetWindowPos on the child and corrects it.
18+
Connections {
19+
target: root.Window.window
20+
21+
function onVisibilityChanged(visibility: int): void {
22+
if (visibility !== Window.Minimized) {
23+
Qt.callLater(root._resyncChildGeometry);
24+
}
25+
}
26+
}
27+
28+
function _resyncChildGeometry(): void {
29+
const w = root.width;
30+
if (w > 1) {
31+
root.window.width = w - 1;
32+
root.window.width = w;
33+
}
34+
}
1135
}

0 commit comments

Comments
 (0)