Reinstate the activate-focus keybinding

Commit 3b62d9c027 was a bit overzealous in
removing not just the public API for activating the focus
widget, but also the plumbing needed to make the keybinding
work.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1879
This commit is contained in:
Matthias Clasen 2019-05-12 18:00:19 +00:00
parent f8c1f7173a
commit 04754d753b

View File

@ -431,6 +431,7 @@ static void gtk_window_move_focus (GtkWidget *widget,
GtkDirectionType dir);
static void gtk_window_real_activate_default (GtkWindow *window);
static void gtk_window_real_activate_focus (GtkWindow *window);
static void gtk_window_keys_changed (GtkWindow *window);
static gboolean gtk_window_enable_debugging (GtkWindow *window,
gboolean toggle);
@ -804,6 +805,7 @@ gtk_window_class_init (GtkWindowClass *klass)
container_class->forall = gtk_window_forall;
klass->activate_default = gtk_window_real_activate_default;
klass->activate_focus = gtk_window_real_activate_focus;
klass->keys_changed = gtk_window_keys_changed;
klass->enable_debugging = gtk_window_enable_debugging;
klass->close_request = gtk_window_close_request;
@ -6232,6 +6234,15 @@ get_active_region_type (GtkWindow *window, gint x, gint y)
return GTK_WINDOW_REGION_CONTENT;
}
static void
gtk_window_real_activate_focus (GtkWindow *window)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
if (priv->focus_widget && gtk_widget_is_sensitive (priv->focus_widget))
gtk_widget_activate (priv->focus_widget);
}
static gboolean
gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window)
{