Install Libraries: Enter submits the sudo password dialog

Pressing Enter in the password entry did nothing (the default-widget
chain does not fire under a nested gtk_dialog_run). Wire the entry
activate signal directly to Accept so Enter submits, matching the
usual password-dialog convention.
This commit is contained in:
cnmcdee committed 2026-12-01 01:49:36 +00:00
1 parent 6568b6f882
commit 5f12f0423e
1 file changed
+9
+9
View File
@@ -4485,6 +4485,15 @@ static bool ask_sudo_password(std::string& pw_out) {
GtkWidget* entry = gtk_entry_new();
gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
// Enter in the entry must submit even if the default-widget chain
// does not fire (verified live: Return alone did not submit, so
// wire the entry's activate signal directly to Accept).
g_signal_connect(entry, "activate",
G_CALLBACK(+[](GtkEntry*, gpointer user_data) {
gtk_dialog_response(GTK_DIALOG(user_data),
GTK_RESPONSE_ACCEPT);
}),
dlg);
GtkWidget* box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
gtk_container_set_border_width(GTK_CONTAINER(box), 12);
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);