summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-05-12 18:00:19 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-05-12 18:07:33 +0000
commit04754d753b1370b0026b83d89bfa6d14bd343028 (patch)
treefcdaee7016076c96b511d8b017cb135debda5907
parentf8c1f7173adda4170b87f9988e70fa628ef9caf5 (diff)
downloadgtk+-04754d753b1370b0026b83d89bfa6d14bd343028.tar.gz
Reinstate the activate-focus keybinding
Commit 3b62d9c027186fe0fddfb9 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
-rw-r--r--gtk/gtkwindow.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index d9bcf9ad65..fa65a9933d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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)
{