-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for WM_COMMAND messages in order to handle HMENU user input on Windows #1928
Comments
I'm not entirely happy with adding a |
cc @madsmtm as they seem to work on sth in this direction. Would be interesting to know if it's strictly required to forward these commands or if it can be handled independently from winit using the |
Haven't gotten far enough with the Windows implementation to tell if this is required or not, sorry! |
Okay, I've currently simply gone ahead and just backported the old fix to the newest winit version and added an example, since I need native menus in order to release azul. The patch is just 20 lines long and it works and I can't wait months and years until there is a common consensus on how to do it perfectly. So I'm just using a separate version as a dependency for azul now. You can react to HMENUs on Windows without having to implement |
I have only looked at Windows' menu API briefly, but it does indeed seem like you can't get around handling the
I'd like to re-iterate that I think adding a platform-specific callback should be fine as a stop-gap measure until such consensus can be reached. A PR would be welcome. |
Now that winit seems to have a
with_hmenu
function on Windows, it should be possible to handleWM_COMMAND
messages. In Windows, menu items are associated with a unique ID (u32) and associates it with the HMENU. When the item is clicked, Windows will send aWM_COMMAND
message to the window that owns the HMENU.Back in 2018 I added menu support to winit here: fschutt@601d052
The fix would need to be ported to the current version, but it's very easy to understand. The relevant change would just be:
The text was updated successfully, but these errors were encountered: