Key handling changes in OpenMPT 1.32

Started by Saga Musix, September 27, 2024, 10:33:18

Previous topic - Next topic

Saga Musix

This is a quick description of a few things related to key handling that will change in the upcoming OpenMPT 1.32; if you are using current OpenMPT testing versions you are encouraged to check if shortcuts, navigation, etc. still work as expected for you or if something unexpected changed.

What happened? Well, for the last 18+ years, OpenMPT has used a global keyboard hook to intercept key presses. This hook handled all the global shortcuts, as well listening to the status of modifier keys (Shift, Ctrl, Alt). There were various issues with this approach: The global hook caused some general keyboard input issues on some Wine systems, and modifier keys could get "stuck" on all OpenMPT installations, sometimes causing key presses to not be recognized anymore until the "stuck" modifier was pressed again. This change is also a tiny puzzle piece on the long road to a platform-independent OpenMPT.

In general, the intent was to keep existing behaviour mostly the same as before. Here are some things we know that changed:

  • Global shortcuts now have a lower priority than context-specific shortcuts. This matches the expectations from other context relationships (e.g. Note Column shortcuts have a higher priority than - and thus can override - general Pattern Editor shortcuts). This means that if you had a global shortcut and assigned the same keys to, say, a pattern editor shortcut, the pattern editor shortcut now takes priority if the pattern editor is active.
  • Behaviour change with "special keys": It is possible to use the Windows key as an additional modifier key in OpenMPT, and there is some code that prevents the start menu from opening if this key is pressed while OpenMPT is focussed. Similarly, when using the Caps Lock, Num Lock and Scroll Lock keys, OpenMPT would return the respective indicator lights on the keyboard to their previous state (i.e. Caps Lock would not turn on ALL-CAPS WRITING). These features are still present, but are no longer active when file dialogs, message boxes, or any other context in which OpenMPT does not accept keyboard shortcuts is active. So if you set the Windows key to, say, stop playback, the start menu will no longer be suppressed while you are browsing for a module in a file picker. Previously the start menu would have been suppressed in this situation even though playback would not have been stopped anyway.
  • Like in other applications, global shortcuts no longer work while a menu (either main menu or context menu) is open. This never worked for context-specific shortcuts anyway.

If you notice any changes beyond the ones described above, please let us know (here or on the issue tracker). As you can probably imagine, keyboard handling is an accumulated mess of over 18 years of bugfixes and special cases, and I already had to fix several special cases. If there are any more bugs left, I would hope to find and fix them before an official OpenMPT 1.32 release.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.