Properly pass the focus of a composite widget to its child

I have composite widget that when focused must pass the focus to one of its children. After creating my grab_focus() virtual method (which indeed passes the focus to the child), I am still struggling to make the focus behave normally.

I had a look at what GtkEntry does with its internal GtkText widget, and I noticed that besides grab_focus() it also declares a focus() virtual method. However it uses gtk_widget_focus_child() for it, which is a private function.

It is not the first time that I notice useful functions in the GTK libraries that are kept private. Would it be possible in future GTK releases to make gtk_widget_focus_child() and similar utilities public (specifying that they are meant to be used in custom widget implementations)? I am generally speaking about all these private utilities that have less safeguards and checks (because these are indeed not needed when a function is used internally).

Besides the answer to the last question, what strategy should I adopt to pass the focus to the child and still keep the "has-focus" property of the parent set to true?

And last but not least: Why, despite I have "can-focus", "can-target", "focusable" and "focus-on-click" all set to true, I can get the focus only via keyboard but not via mouse click?

More generally, what behaviours should I expect when the focus of a composite widget relies on one of its children?

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