Skip to content

GTK4: correct focus grabbing recursion

Maxim Zakharov requested to merge Maxime2/gtk:gtk_widget_real_focus-fix into master

I am porting a GTK3 application into GTK4. This application has a complex input window with number of various widgets. The widget which receives focus by default depends on application logic and is set by gtk_widget_grab_focus() called on that widget. In most cases this widget is of GtkEntry.

However, the focus actually goes to the next widget on the window.

I think the problem is in an incorrect base of recursion of gtk_widget_focus_move() calls started in gtk_window_focus(). The proposed change fixes the issue for me. Though would be better if someone who is more familiar with the original design has a look.

Merge request reports