Add modern window context menu - #20673
Open
NNN (hellodda) wants to merge 2 commits into
Open
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Replaces the legacy Win32 system menu with a modern XAML-based
WindowContextMenuimplementation (MenuFlyout). This enables the title bar context menu to fully adapt to the application's XAML theme (Dark/Light mode) while maintaining full backward compatibility with native system commands.References and Relevant Issues
Detailed Description of the Pull Request / Additional comments
Key Implementation Details:
MenuFlyoutIntegration: CreatedWindowContextMenuinheriting fromMenuFlyoutto replace the legacy Win32 popup menu with modern UI/UX matching the application theme.SetWindowSubclass) to interceptWM_CONTEXTMENU,WM_NCRBUTTONUP,WM_NCRBUTTONDOWN,WM_STYLECHANGED, andWM_SIZEmessages.GetDpiForWindow. Handles keyboard invocation (Shift+F10/Appskey with(X: -1, Y: -1)coordinates) by automatically centering the menu relative to the parent window.GetSystemMenuviaGetMenuItemInfoWand strips accelerator keys (&escaping and\tshortcut strings) so text renders cleanly in XAML.HMENUby third-party window managers or extensions.WS_THICKFRAME) and state (SIZE_MAXIMIZED). Maps click events back to nativeWM_SYSCOMMANDmessages (SC_RESTORE,SC_MOVE,SC_SIZE,SC_MINIMIZE,SC_MAXIMIZE,SC_CLOSE).Validation Steps Performed
WM_SYSCOMMANDto the host window.Shift+F10and theAppskey to verify the menu centers correctly on screen without crashing or rendering off-screen.PR Checklist