Skip to content
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

Fix "ambiguity" with Russian keyboard layout #26774

Merged
merged 2 commits into from
Mar 7, 2025

Conversation

cbjeukendrup
Copy link
Contributor

@cbjeukendrup cbjeukendrup commented Feb 26, 2025

Resolves: #25824

When using Russian keyboard layout, and there is a Z shortcut and a Ctrl+Z shortcut, we add four shortcuts:

  • Z and Я
  • Ctrl+Z and Ctrl+Я

When pressing Ctrl+Z, Qt thinks there are two possible keys:

17:42:43.971 | DEBUG | main_thread     | Qt              | 	- QKeyCombination(ControlModifier, Key(1071)) / QKeySequence("Ctrl+Я") / ⌘Я
17:42:43.971 | DEBUG | main_thread     | Qt              | 	- QKeyCombination(NoModifier, Key_Z) / QKeySequence("Z") / Z

(output seen after QLoggingCategory::setFilterRules("qt.gui.shortcutmap.debug=true\nqt.qpa.keymapper.debug=true\nqt.qpa.keymapper.keys.debug=true");)

The latter, Z with no modifier, makes no sense to me, but whatever; Qt thinks it must be.

As a result, Qt thinks the shortcuts are ambiguous: it doesn't know whether to activate Z or Ctrl+Я.

The solution is to avoid adding Z as a shortcut; it won't be necessary anyway, as Я suffices.

Same story goes for other single-letter shortcuts.

Should be tested very carefully, also with other keyboard layouts than Russian (for example, what effect will it have for AZERTY users...)

@DmitryArefiev
Copy link
Contributor

@cbjeukendrup This should be tested on macOS only?

@DmitryArefiev
Copy link
Contributor

DmitryArefiev commented Mar 4, 2025

Tested on macOS13.6

Cmd+X, Cmd+C, Cmd+V, Cmd+Z, Cmd+W are working fine

@cbjeukendrup But Cmd+A doesn't work in PR's build using RU layout (works in master)

Resolves: musescore#25824

When using Russian keyboard layout, and when there is a `Z` shortcut and a `Ctrl+Z` shortcut, and you press `Ctrl+Z`, we add four shortcuts:
- `Z` and `Я`
- `Ctrl+Z` and `Ctrl+Я`

When pressing `Ctrl+Z`, Qt thinks there are two possible keys:
```
17:42:43.971 | DEBUG | main_thread     | Qt              | 	- QKeyCombination(ControlModifier, Key(1071)) / QKeySequence("Ctrl+Я") / ⌘Я
17:42:43.971 | DEBUG | main_thread     | Qt              | 	- QKeyCombination(NoModifier, Key_Z) / QKeySequence("Z") / Z
```
(output seen after `QLoggingCategory::setFilterRules("qt.gui.shortcutmap.debug=true\nqt.qpa.keymapper.debug=true\nqt.qpa.keymapper.keys.debug=true");`)

The latter, `Z` with no modifier, makes no sense to me, but whatever; Qt thinks it must be.

As a result, Qt thinks the shortcuts are ambiguous: it doesn't know whether to activate `Z` or `Ctrl+Я`.

The solution is to avoid adding `Z` as a shortcut; it won't be necessary anyway, as `Я` suffices.

Same story goes for other single-letter shortcuts.
Addresses musescore#26774 (comment). Apparently the issue with ambiguous keys doesn't apply to the A key. It is totally unclear why. The possibility that there are other keys to which this applies too, has not been ruled out.
@cbjeukendrup
Copy link
Contributor Author

@DmitryArefiev I pushed an update, hopefully it works now! And yes, absolutely only macOS is affected by this PR.

@DmitryArefiev
Copy link
Contributor

@cbjeukendrup Now all good. Thanks!

Tested #25824 on Mac13.7.2 - FIXED

@DmitryArefiev DmitryArefiev merged commit 51ba630 into musescore:master Mar 7, 2025
11 checks passed
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 7, 2025
Addresses musescore#26774 (comment). Apparently the issue with ambiguous keys doesn't apply to the A key. It is totally unclear why. The possibility that there are other keys to which this applies too, has not been ruled out.
@Jojo-Schmitz Jojo-Schmitz mentioned this pull request Mar 7, 2025
@cbjeukendrup cbjeukendrup deleted the shortcuts_russian branch March 9, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System shortcuts (Cmd+X, Cmd+C, Cmd+V, Cmd+Z etc.) don't work when non-qwerty input (RU) enabled on macOS
3 participants