godot icon indicating copy to clipboard operation
godot copied to clipboard

[4.0b6] KEY_MASK_CMD_OR_CTRL in PopupMenu accelerators do not get called

Open Jimmio92 opened this issue 2 years ago • 2 comments

Godot version

4.0b6

System information

Win 10 x64

Issue description

I realize there are problems with accelerators as far back as 3.2; this one seems it would really help cross platform compatibility if it's fixed, hence my reporting it. Apologies if once again I missed this bug reported elsewhere -- seems to happen to me a lot.

If you provide KEY_MASK_CMD_OR_CTRL|KEY_N to an accelerator, it correctly shows it in the list of accelerators on Windows as Ctrl+N. I assume this would also show correctly on Mac as CMD+N. The issue comes when the keys are pressed. It receives KEY_MASK_CTRL|KEY_N, not KEY_CMD_OR_CTRL|KEY_N.

Steps to reproduce

Set a PopupMenu programmatically from GDScript using MASK_CMD_OR_CTRL. Notice it's never called. Switch it to MASK_CTRL. Notice it now works as expected on Windows, but would not work as expected on Mac for example.

Minimal reproduction project

testcase_for_key_mask_cmd_or_ctrl.zip

Jimmio92 avatar Nov 27 '22 20:11 Jimmio92

Citing CONTRIBUTING.md

On the contributors' end, recreating a test project from scratch takes valuable time that can be saved by uploading a minimal project.

To speed up our work, please upload a minimal project that isolates and reproduces the issue. This is always the best way for us to fix it. We recommend attaching a ZIP file with the minimal project directly to the bug report, by drag and dropping the file in the GitHub edition field. This ensures the file can remain available for a long period of time. Only use third-party file hosts if your ZIP file isn't accepted by GitHub because it's too large.

We recommend always attaching a minimal reproduction project, even if the issue may seem simple to reproduce manually.

Please join a MRP.

adamscott avatar Nov 28 '22 00:11 adamscott

Uploaded one (edited original post); Ctrl+A and it fails to print "A!". Ctrl+B and it succeeds printing "B!". The menu at the top is also clickable and works as expected.

I didn't bother wasting the time originally as it's specified in the docs that the KEY_MASK_CMD_OR_CTRL isn't to be used... yet it works as intended and solves a cross-platform compatibility issue.... at least half way. Seems a bug to me that it only half works.

Jimmio92 avatar Nov 28 '22 00:11 Jimmio92

cc @bruvzg

Calinou avatar Dec 01 '22 22:12 Calinou

I can confirm this issue still exists on v4.2. Is there any workaround for mac users?

ibe-denaux avatar Mar 28 '24 10:03 ibe-denaux