Ubuntu GDK C++ how to get the code of a key using CAPSLOCK

46 Views Asked by At

In Ubuntu C++ I use gdk_keymap_get_entries_for_keycode() to get the keyval of a key. This works well for all keys with my shiftstates:

If I pass

  • keycode 38, shiftstate 0 into gdk_keymap_get_entries_for_keycode() I get *keyvals[0] = 97 (=a)
  • keycode 38, shiftstate 1 into gdk_keymap_get_entries_for_keycode() I get *keyvals[1] = 65 (=A)

Now I want to take the capslock into consideration as well. So I want to get the following results:

  • keycode 38, shiftstate 0, Caps 0 => I want to get: 97 (=a)
  • keycode 38, shiftstate 1, Caps 0 => I want to get: 65 (=A)
  • keycode 38, shiftstate 0, Caps 1 => I want to get: 65 (=A)
  • keycode 38, shiftstate 1, Caps 1 => I want to get: 97 (=a)

I know Can I determine the capslock-state with gdk_keymap_get_caps_lock_state() but

how can I use this state to find the appropriate code of a character?

0

There are 0 best solutions below