Skip to content

Commit afff962

Browse files
committed
fix: multiscreen minimized button
1 parent 8f81d08 commit afff962

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

app/os_windows.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,20 @@ func windowProc(hwnd syscall.Handle, msg uint32, wParam, lParam uintptr) uintptr
471471
if wParam == windows.SIZE_RESTORED || wParam == windows.SIZE_MAXIMIZED {
472472
w.w.MarkCursorDirty()
473473
}
474+
// Minimizing programmatically (a custom title-bar "minimize" button
475+
// click runs ShowWindow(SW_SHOWMINIMIZED) synchronously) stops the
476+
// WM_POINTERUPDATE stream but does not reliably emit WM_POINTERLEAVE:
477+
// when a maximized/fullscreen window on a secondary monitor is
478+
// iconified, the cursor is left over the now off-screen window and the
479+
// OS sends no pointer-leave. Without a signal the input router keeps the
480+
// last-hovered handler latched — the minimize button stays "stuck"
481+
// highlighted and the click that triggered the minimize keeps its hover
482+
// on restore. Emit Cancel to drain pointer state and clear hover, the
483+
// same defensive signal used in WM_POINTERLEAVE / WM_NCHITTEST.
484+
if wParam == windows.SIZE_MINIMIZED {
485+
w.w.MarkCursorDirty()
486+
w.ProcessEvent(pointer.Event{Kind: pointer.Cancel})
487+
}
474488
// Restoring from minimized can put the window back at the same
475489
// coordinates it had when minimized — including coordinates on a
476490
// monitor that has since been disconnected.

0 commit comments

Comments
 (0)