Skip to content

Show Windows 11 Snap Layouts flyout on the maximize button#4976

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/win11-snap-layouts-maximize
Jun 22, 2026
Merged

Show Windows 11 Snap Layouts flyout on the maximize button#4976
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/win11-snap-layouts-maximize

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request adds support for Windows 11 Snap Layouts integration with the custom maximize button in the main window. It ensures that the maximize button correctly reports its hit test area to Windows, allowing the Snap Layouts flyout to appear, and emulates proper hover and press visuals for a consistent user experience. Several native interop methods and structures are introduced to handle these new interactions.

Snap Layouts Integration and Button Behavior:

  • Added handling for relevant Windows messages (WM_NCHITTEST, WM_NCMOUSEMOVE, etc.) in the window procedure to report the maximize button area as HTMAXBUTTON, enabling Snap Layouts support and emulating hover/press/click visuals for the custom maximize button.
  • Implemented HitTestMaximizeButton to determine if a screen point is within the maximize button, and SetMaximizeButtonVisual to update its appearance based on hover/press state.
  • Introduced internal state fields (_maxButtonHover, _maxButtonPressed) to track the maximize button's visual state.

Native Methods and Structures:

  • Added P/Invoke declarations for PostMessage and TrackMouseEvent, and defined the TRACKMOUSEEVENT struct to support non-client mouse tracking and message posting.

Constants:

  • Introduced several Windows message and hit test constants necessary for handling non-client maximize button interactions.

@GabrielDuf Gabriel Dufresne (GabrielDuf) merged commit 5ca89b3 into main Jun 22, 2026
3 checks passed
@GabrielDuf Gabriel Dufresne (GabrielDuf) deleted the fix/win11-snap-layouts-maximize branch June 22, 2026 13:35
@GabrielDuf Gabriel Dufresne (GabrielDuf) linked an issue Jun 22, 2026 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] snap layout passed away

2 participants