Only one widget at a time can have a global input focus, which is the focus that the user sees on the screen and where keystrokes appear. If gtk_widget_has_focus(widget)returns TRUE, it widgethas a global input focus. You cannot have web browsing and vbox has global input focus at the same time.
What you can do is call gtk_container_get_focus_child()in the composite widget, and if the return value is a composite widget, then the focus is somewhere inside the composite widget.
Or you can connect to the signals "focus-in-event", and "focus-out-event"in the composite widget. I am sure that they will notify you when one of the contained widgets gains or loses focus. (Remember to call gdk_window_set_events(widget->window, gdk_window_get_events(widget->window) | GDK_FOCUS_CHANGE_MASK)your widget first, as described in the GTK docs.)
source
share