Skip to content

Fix popovers not restablishing default widget

Nelson Ben requested to merge BUG_popover_focus_new_folder_issue_GTK3 into gtk-3-24

Popovers have special handling to restablish the previous default and focused widget, that code it's in the map() unmap() handlers in gtk/popover.c .

But, at the same time, GtkWindow also does automatic restablishing of previous default and focused widgets, that's in _gtk_window_unset_focus_and_default() function in gtk/gtkwindow.c which is called from gtk_widget_hide() in gtk/gtkwidget.c .

So, when a popover is closed, both code-paths are executed, conflicting with each other and resulting in the popover failing to properly restablish the default widget.

The commit that introduced _gtk_window_unset_focus_and_default() to gtkwindow.c is from 2002 (commit ff9c2c56) so it predates by far the popover.c implementation, therefore the rationale thing to do here is to exempt popovers from being handled in _gtk_window_unset_focus_and_default() (as that function is oblivion to the fact that popovers have their own handling).

So, this commit exempts popovers from being handled in the aforementioned function, but only for the default widget part atm, because although by the previous rationale we should exempt it from the focused widget part too, I could not find a bug in the issue tracker about that, so instead we just exempt the default widget part that we know for sure it fixes issue #2125 (closed)

Closes issue #2125 (closed)

Edited by Nelson Ben

Merge request reports