-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed subclassing in both implementations of `show_context_menu_f…
…or_hwnd` - Removed `CONTEXT_MENU_SUBCLASS_ID` and `CONTEXT_SUMENU_SUBCLASS_ID` constants - Adding entry in `.changes`
- Loading branch information
Showing
2 changed files
with
15 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"muda": "patch" | ||
--- | ||
|
||
These changes are to address a design flaw in how `muda` handles context menus on Windows. | ||
|
||
The normal way menus with `muda` are used on Windows is they get attached to a window, and the window is subclassed to intercept commands (`WM_COMMAND`) and some drawing behaviors (I'm not 100% sure on this, but this appears in place to support theming and dark mode). When the `Menu` is dropped, it will be unattached from all windows and the subclasses will be removed. | ||
|
||
Context menus seem to follow a slightly different pattern. When `show_context_menu_for_hwnd()` is called, the subclass is attached to the window, but never removed. This behavior is problematic because the menu can be dropped without the subclass removed, causing a crash. Furthermore, having this subclass attached unnecessarily is not necessarily a good idea. | ||
|
||
These changes to `muda` refactor menu support on Windows to remove the HWND subclassing when the context menu is active. | ||
|
||
These changes also address a memory leak where when an HWND is subclassed, the reference to the menu object was placed in a `Box` seemingly unnecessarily, and this `Box` never seems to be dropped. This was changed to using straight references. |
This file contains 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