window: tie focus to surface state changes

We don't get a focus-out on the event controller, when
the surface is losing keyboard focus, since we are not
moving our focus to some other widget, so we are never
unsetting the mnemonics-visible property. Do that in
response to surface state changes instead.
This commit is contained in:
Matthias Clasen 2020-04-02 17:21:01 -04:00
parent 6e6b4a851f
commit 1f8e633fff

View File

@ -5088,7 +5088,16 @@ surface_state_changed (GtkWidget *widget)
priv->state = new_surface_state;
if (changed_mask & GDK_SURFACE_STATE_FOCUSED)
ensure_state_flag_backdrop (widget);
{
gboolean focused = new_surface_state & GDK_SURFACE_STATE_FOCUSED;
ensure_state_flag_backdrop (widget);
_gtk_window_set_is_active (window, focused);
if (!focused)
gtk_window_set_mnemonics_visible (window, FALSE);
}
if (changed_mask & GDK_SURFACE_STATE_FULLSCREEN)
{