I'm looking to get capture keypresses in my program, but am hitting a wall.
- I'm working from this answer: How do I Check for the Key Pressed in GTK3 (C)? (last answer)
- I swapped in
GtkEventControllerKey
forGtkEventKey
which I understand is the proper way now.
Here's my code:
void on_window_main_key_press_event(GtkWidget *widget, GtkEventControllerKey *key, gpointer user_data) {
guint TheKeyThatWasPressed = key->keyval;
}
Which yields the error:
error: invalid use of incomplete typedef ‘GtkEventControllerKey’ {aka ‘struct _GtkEventControllerKey’}
147 | guint TheKeyThatWasPressed = key->keyval;
I hope I have understood you correctly. Want to keep track of which keys have been pressed? Here's an example of how I would solve this problem.