diff options
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r-- | gtk/gtkwindow.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 3e54b4a573..29aa75ee63 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1789,6 +1789,31 @@ gtk_window_capture_motion (GtkWidget *widget, } static void +activate_default_cb (GSimpleAction *action, + GVariant *parameter, + gpointer data) +{ + gtk_window_activate_default (GTK_WINDOW (data)); +} + +static void +add_actions (GtkWindow *window) +{ + GActionEntry entries[] = { + { "activate-default", activate_default_cb, NULL, NULL, NULL }, + }; + + GActionGroup *actions; + + actions = G_ACTION_GROUP (g_simple_action_group_new ()); + g_action_map_add_action_entries (G_ACTION_MAP (actions), + entries, G_N_ELEMENTS (entries), + window); + gtk_widget_insert_action_group (GTK_WIDGET (window), "gtk", actions); + g_object_unref (actions); +} + +static void gtk_window_init (GtkWindow *window) { GtkWindowPrivate *priv = gtk_window_get_instance_private (window); @@ -1881,6 +1906,8 @@ gtk_window_init (GtkWindow *window) g_signal_connect_swapped (priv->key_controller, "focus-out", G_CALLBACK (gtk_window_focus_out), window); gtk_widget_add_controller (widget, priv->key_controller); + + add_actions (window); } static GtkGesture * |