Ben Gardiner
Ben Gardiner

Reputation: 1

Capturing key_released signal of return key in GTK4

I'm writing a simple application to emit MIDI with my keyboard. I'm mapping an octave to each row of the keyboard, and the second row ranges from 'a' to the Return key (I'd rather not use Caps Lock for obvious reasons). I just want to get it working, so I'm not worried about it being pretty.

My problem: I have a GtkEventControllerKey attached to the window that sends MIDI events through the ALSA sequencer; MIDI ON for each key_pressed signal and MIDI OFF for each key_released signal. However, the controller only receives a "key_pressed" signal and no "key_released" signal for the return key.

What do I do about this? I'm imagining it has something to do with the return key being used for the "activate" signal by default.

As I mentioned, it must have something with Gtk assigning behavior to the return key by default: something to do with the "activate" signal, as far as I can gather.

Right now, to avoid having the "activate" signal do anything, I just select a button that does nothing. I don't know if this has anything to do with the absence of the "key_released" signal.

I'd rather unbind the "activate_signal" from the return key entirely, but it doesn't matter to me, so long as I can get all 48 keys working and playing music.

Upvotes: 0

Views: 36

Answers (0)

Related Questions