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?

Lukas

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: https://github.com/horizon-eda/horizon/commit/49e0ae7fac482adbcdd3ae93d75ea98049ad9595#diff-0addd54bed54ee9a8d2fecd245b062434fb38ea9c49d0f3d3280943f49383d4eR1296