How to get widgets under the mouse position?

like QApplication::widgetAt(int x, int y) or QApplication::topLevelAt(int x, int y) on QT

Depending on your actual use case, you can rely either on gtk_widget_pick or gdk_device_get_surface_at_position in combination with gdk_seat_get_pointer.

Thank you for your reply, I use GtkSharp, GtkSharp does not seem to have a similar api.

You should always state which version of GTK you’re using, and whenever you’re using a language binding, you should state which one it is you’re using as well—otherwise any topic turns into a game of 20 questions.

If you’re using GTK 3 you will need to open code a hierarchy traversal from the top level, using the allocation of each widget to determine whether the coördinates are within that allocated rectangle.

Sorry, I should state that the version I am using is 3.24.

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