|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the following assertion in GTK+ versions before 3.15.3:
Gtk-CRITICAL **: gtk_widget_is_ancestor: assertion 'GTK_IS_WIDGET (widget)' failed
This assertion occurs when:
1. No widget has been given input focus,
2. A popover (e.g. the tab label context menu) is shown, and
3. The window regains focus.
This is because of the following code in window_focus_in() in
gtk/gtkpopover.c (from 3.14.x):
focus = gtk_window_get_focus (GTK_WINDOW (widget));
if (!gtk_widget_is_ancestor (focus, GTK_WIDGET (popover)))
gtk_widget_grab_focus (GTK_WIDGET (popover));
When no widget has focus, the first argument to gtk_widget_is_ancestor()
(which is checked with a GTK_IS_WIDGET() assertion) is NULL.
So, some widget needs to have focus before a popover is shown and the
window regains focus.
Arguably, this is a bug in GTK+, and it has been fixed in GTK+ 3.15.3:
https://git.gnome.org/browse/gtk+/commit/gtk/gtkpopover.c?id=e26fddc
With that change, the above lines from window_focus_in() now read:
focus = gtk_window_get_focus (GTK_WINDOW (widget));
if (focus == NULL || !gtk_widget_is_ancestor (focus, GTK_WIDGET (popover)))
gtk_widget_grab_focus (GTK_WIDGET (popover));
That is, if focus is NULL, don't check if popover is an ancestor of it.
Instead just give focus to popover.
|