Skip to content

Use native Windows API for converting keystrokes to characters

Isopod requested to merge Isopod/gtk:win32-native-input into gtk-3-24

GTK on Windows currently uses its own incomplete emulation for converting keystrokes into characters. This leads to some problems of GTK applications not behaving as a Windows user would expect.

The correct way to handle keyboard input on Windows is to call TranslateMessage() and interpret the WM_CHAR messages sent by Windows. This way a GTK application will behave exactly like a native Windows application, including all the nasty edgecases like modifier combinations, dead keys and so forth. This is exactly what this merge request does.

I built my changes on top of the IME input module, since I would have to handle those messages anyway and there was no point in reinventing the wheel. Hence I made the IME module the default for all locales.

It works perfectly for me. I have tested my changes with

  • German keyboard layout
  • NEO 2 German keyboard layout (it has special modifier keys)
  • American layout
  • Japanese IME (I don't speak Japanese, but it seems to be working correctly as far as I can tell)

This merge request fixes the following issues:

Edited by Isopod

Merge request reports