fceux icon indicating copy to clipboard operation
fceux copied to clipboard

[Qt] keyboard control does not work on non-English layouts

Open ClusterM opened this issue 3 years ago • 5 comments

Describe the bug All letter keys on keyboard do not work when non-English layout is active.

To Reproduce Steps to reproduce the behavior:

  1. Open Optiopns -> GamePad config
  2. Change keyboard layout to non-English (e.g. Russian or Armenian for example)
  3. Try to bind any A-Z key to any button
  4. There is no effect. Also if you bind keys on English layout, these keys will not work if a non-English layout is enabled.

Expected behavior Letter keys on should work when non-English layout is active.

(please complete the following information):

  • Same problem on Kubuntu Linux and Windows 10
  • Qt, b912004f69c7a7ace4b709658c54340466fc1070

ClusterM avatar May 18 '22 11:05 ClusterM

ugh, I only have english keyboards, there is no way I can test new code in this area. Is non-English keyboards something that fceux normally supports?

thor2016 avatar Aug 29 '22 22:08 thor2016

ugh, I only have english keyboards, there is no way I can test new code in this area. Is non-English keyboards something that fceux normally supports?

Layout != Keyboard. You can add any layout in system settings.

ClusterM avatar Aug 30 '22 07:08 ClusterM

After researching Qt keyboard layout behaviors, it doesn't look like Qt has a good solution for this. The GUI is coded to expect enum Qt::Key values. These values are only for English keyboards. I could try to write a translation function to try to and map the received key code to a Qt::Key value, but there is a lot of variability between keyboard layouts and it would not be a fix all solution. Seems like the return on investment here is pretty low. The Linux Gnome desktop makes it pretty easy to swap between keyboard layouts. My thoughts on this are if the English layout works with fceux, then use the English layout. Sorry to disappoint. I will leave this open for someone who is more motivated to make this work.

thor2016 avatar Sep 02 '22 01:09 thor2016

Key != Letter. Windows version binds keys, not letters. In Windows version I can change layout to Russyan, press "Я" and it will be binded as "A" because it uses key scan codes. Qt::Key defines scan code, not letter, isn't it?

ClusterM avatar Sep 06 '22 17:09 ClusterM

Keyboard shortcuts work in popular cross-platform browsers like Firefox and Chrome/Brave regardless of keyboard layout. I also tested some Qt5 KDE applications (kate, kwrite, krita) in Linux, and they all seem fine (Ctrl + N or O under Persian layout works).

Bilingual people who write in 2 languages have to change layout back and forth, and sometimes change layout by accident and later be confused why a shortcut doesn't work!

Although there is generally a checkbox option in Linux "Separate layout for each window", which makes it remember the layout for each window. So this can be a workaround.

I have a lot of experience with Gtk, but very little with Qt.

ilius avatar Sep 06 '22 18:09 ilius