Skip to content

Use MonitorFromRect for maximized hidden-title-bar WM_NCCALCSIZE on Windows - #101

Merged
lijy91 merged 1 commit into
mainfrom
fix/windows-hidden-titlebar-monitor-issue-53
Nov 24, 2026
Merged

lijy91 merged 1 commit into
mainfrom
fix/windows-hidden-titlebar-monitor-issue-53

Conversation

@lijy91

@lijy91 lijy91 commented Nov 23, 2026

Copy link
Copy Markdown
Member

Summary

Fixes libnativeapi/nativeapi#53:

  • In HandleHiddenTitleBarFrame (src/platform/windows/window_windows.cpp), the maximized WM_NCCALCSIZE branch queried MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST). When restoring from minimized, hwnd still has the minimized placeholder rect at (-32000, -32000), so it picked the primary monitor's work area instead of the secondary monitor's work area.
  • Switch to MonitorFromRect(&proposed, MONITOR_DEFAULTTONEAREST) using the incoming rgrc[0] rect the window is moving to.
  • Add tests/window_hidden_titlebar_nccalcsize_windows_test.cpp covering WM_NCCALCSIZE proposed-rect monitor resolution and minimize → restore client area and WM_NCHITTEST behavior.

Related to libnativeapi/nativeapi#53.

Verification

  • Passed 5 Windows CTest suites: window_hidden_titlebar_nccalcsize_windows_test, window_startup_maximize_windows_test, window_geometry_coalesce_windows_test, window_popup_caption_windows_test, and window_maximize_button_test.

@lijy91
lijy91 merged commit 00a6d6d into main Nov 24, 2026
10 checks passed
@lijy91
lijy91 deleted the fix/windows-hidden-titlebar-monitor-issue-53 branch November 24, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client area

1 participant