How to stop GtkSearchEntry from eating escape key events?

Hi there,

GtkSearchEntry is handling the escape key on its own to emit the stop-search signal. What’s the least hacky way to prevent it from doing that, so that the event bubbles up?

I can catch the escape key by connecting to the key press event with after=false, but I’m not quite sure how to proceed from there. Create the appropriate event and call gtk_main_do_event or gdk_event_put?


The easiest way would probably be to add an event controller to the target parent widget (not the SearchEntry) and set it to GTK_PHASE_CAPTURE. That would be if you want to take the event before it’s handled by the SearchEntry.

If you want to handle the event in the SearchEntry and then do something else after, you can just put a signal handler on stop-search.

Thanks a lot, that’s definitely a lot nicer than the ideas I came up with: