Skip to content

feat(windows): support resizable frameless windows with native shadow - #1829

Closed
zhuzipu wants to merge 6 commits into
r0x0r:masterfrom
zhuzipu:master
Closed

feat(windows): support resizable frameless windows with native shadow#1829
zhuzipu wants to merge 6 commits into
r0x0r:masterfrom
zhuzipu:master

Conversation

@zhuzipu

@zhuzipu zhuzipu commented Jul 26, 2026

Copy link
Copy Markdown

feat(windows): support resizable frameless windows with native shadow

Enable window resizing for frameless windows when shadow=True on Windows.
Previously, setting frameless=True stripped WS_THICKFRAME and the DWM
sizing border was not available, making resizable=True ineffective when
the native shadow was enabled.

The fix follows the approach used by Electron (borderless-window):

  • Subclass the window procedure to intercept WM_NCCALCSIZE and return 0,
    which removes the non-client area while keeping the DWM frame intact.
  • Block WM_NCUAHDRAWCAPTION and WM_NCUAHDRAWFRAME to prevent the themed
    window border from being drawn over the client area.
  • Pass -1 as lParam to WM_NCACTIVATE so DefWindowProc does not repaint
    the non-client border on activation changes.
  • Handle WM_NCHITTEST using client-coordinate hit testing (SM_CXFRAME +
    SM_CXPADDEDBORDER), with diagonal corner handles wider than the sides,
    matching standard Windows behavior.
  • Forward WM_NCPAINT to DefWindowProc so DWM continues to draw the
    native window shadow from the extended frame.
  • Handle WM_SETCURSOR to show the appropriate sizing cursor for each
    hit-test result.
  • Re-add WS_THICKFRAME to the window style so the system engages its
    resize modal loop when an edge hit-test result is returned.
  • In EdgeChrome, when the form is frameless + resizable, size the
    WebView2 control to leave a thin border at the window edges so
    WM_NCHITTEST messages can reach the parent window procedure.

Thanks for TRAE WORK ( AI ) 🎉🎉🎉~

@zhuzipu zhuzipu closed this by deleting the head repository Jul 28, 2026
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.

1 participant