How do I react to a hover event in GTK?

I want to run some code on a custom widget when the mouse is hovered over it.

I assumed this would be handled by a subclass of GtkGesture, but seemingly no such thing exists.
I know you can use the :hover pseudo class in css, but I want to run actual code when the widget is hovered over.

Event controllers are internal to GTK, so they cannot be derived from outside the toolkit.

If you want to track your pointer moving across a widget, as well as entering and leaving it, you can use the GtkEventControllerMotion event controller; it has three signals:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.