Package: gdk
Function gdk-keymap-translate-keyboard-state
Lambda Listgdk-keymap-translate-keyboard-state (keymap keycode state group) ArgumentsReturn Value keyval -- an unsigned integer with the keyval effective -- an integer with the effective group level -- an integer with the level consumed -- the gdk-modifier-type flags that were used to determine the group or level Details Translates the contents of the keycode, state, and group
arguments into a keyval, effective group, and level.
Modifiers that affected the translation and are thus unavailable for application use are returned in consumed. The effective return
value is the group that was actually used for the translation. Some keys such as the Enter key are not affected by the active keyboard group. The level is derived from state. For convenience, the gdk-event-key
event already contains the translated keyval, so this function is not as
useful as you might think. The consumed flags gives modifiers that should be masked out from state when comparing this key press to a hot key. For instance, on a US keyboard, the Plus symbol is shifted, so when comparing a key press to a <Control>Plus accelerator the Shift key should be masked out. /* We want to ignore irrelevant modifiers like ScrollLock */ #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK) gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode, event->state, event->group, &keyval, NULL, NULL, &consumed); if (keyval == GDK_PLUS && (event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK) /* Control was pressed */ | See also |
2021-12-13