I'm struggling to understand how this if statement works:
if (keyval == GDK_PLUS &&
(event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
founded here https://developer.gnome.org/gdk3/stable/gdk3-Keyboard-Handling.html#gdk-keymap-translate-keyboard-state
Full example code:
#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
My objective is to understand it so I can port it to Vala since the example given in Valadocs is the same written here in C, and not in Vala.