I want to find out which widget is in a given direction in GTK+, i.e. doing what the "move-focus" signal does, but without actually changing the focus. What I have in mind is a function that takes a GtkWidget \* and a GtkDirectionType and returns the GtkWidget in the given direction (if any).

What I want this for is to ultimately enumerate the widgets inside a specific GtkFrame in my UI definition, in order from left to right. I.e. basically create a list of widgets from leftmost to rightmost, inside my GtkFrame (or in the general case, inside any container).

I've tried to search the GTK documentation but haven't found anything that doesn't also change focus.
['https://Stackoverflow.com/questions/23231397', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3332264/']
Failing any other approach, the way I'm going forward with is to copy a selected set of static functions from the library implementation of GtkContainer and put them in a file in my own application, modifying them to suit my needs.

More specifically, the function gtk\_container\_focus\_sort\_left\_right() and any local functions that it depends on. This includes the GCompareFunc left\_right\_compare() and get\_allocation\_coords().
Assuming the directions you care about are "Forward" and "Backward", it sounds like you want to use [`gtk_container_get_focus_chain()`](https://developer.gnome.org/gtk3/stable/GtkContainer.html#gtk-container-get-focus-chain) on the frame: it does pretty much what it says on the tin: you get a list of widgets in order of focus when tabbing.