diff --git a/gtk/DetailsDialog.cc b/gtk/DetailsDialog.cc index fd3a5ec8f..4200412ba 100644 --- a/gtk/DetailsDialog.cc +++ b/gtk/DetailsDialog.cc @@ -2341,6 +2341,13 @@ AddTrackerDialog::AddTrackerDialog( set_title(fmt::format(_("{torrent_name} - Add Tracker"), fmt::arg("torrent_name", tr_torrentName(torrent)))); set_transient_for(parent); + auto* const accept = get_widget_for_response(TR_GTK_RESPONSE_TYPE(ACCEPT)); +#if GTKMM_CHECK_VERSION(4, 0, 0) + set_default_widget(*accept); +#else + set_default(*accept); +#endif + gtr_paste_clipboard_url_into_entry(*url_entry_); } diff --git a/gtk/OptionsDialog.cc b/gtk/OptionsDialog.cc index 63463f014..06b83d511 100644 --- a/gtk/OptionsDialog.cc +++ b/gtk/OptionsDialog.cc @@ -427,16 +427,14 @@ TorrentUrlChooserDialog::TorrentUrlChooserDialog( set_transient_for(parent); auto* const e = gtr_get_widget(builder, "url_entry"); + auto* const accept = get_widget_for_response(TR_GTK_RESPONSE_TYPE(ACCEPT)); gtr_paste_clipboard_url_into_entry(*e); - signal_response().connect([this, e, core](int response) { onOpenURLResponse(response, *e, core); }); +#if GTKMM_CHECK_VERSION(4, 0, 0) + set_default_widget(*accept); +#else + set_default(*accept); +#endif - if (e->get_text_length() == 0) - { - e->grab_focus(); - } - else - { - get_widget_for_response(TR_GTK_RESPONSE_TYPE(ACCEPT))->grab_focus(); - } + signal_response().connect([this, e, core](int response) { onOpenURLResponse(response, *e, core); }); } diff --git a/gtk/ui/gtk3/AddTrackerDialog.ui b/gtk/ui/gtk3/AddTrackerDialog.ui index 9a31dfe9f..399932fbe 100644 --- a/gtk/ui/gtk3/AddTrackerDialog.ui +++ b/gtk/ui/gtk3/AddTrackerDialog.ui @@ -34,6 +34,7 @@ _Add True True + True True True @@ -94,6 +95,7 @@ 400 True True + True True diff --git a/gtk/ui/gtk3/TorrentUrlChooserDialog.ui b/gtk/ui/gtk3/TorrentUrlChooserDialog.ui index 2b71e63ad..9ad13bbc0 100644 --- a/gtk/ui/gtk3/TorrentUrlChooserDialog.ui +++ b/gtk/ui/gtk3/TorrentUrlChooserDialog.ui @@ -34,6 +34,7 @@ _Open True True + True True True @@ -94,6 +95,7 @@ 400 True True + True True diff --git a/gtk/ui/gtk4/AddTrackerDialog.ui b/gtk/ui/gtk4/AddTrackerDialog.ui index b8b09c318..0e8937e32 100644 --- a/gtk/ui/gtk4/AddTrackerDialog.ui +++ b/gtk/ui/gtk4/AddTrackerDialog.ui @@ -42,6 +42,7 @@ 400 1 + 1 1 1 diff --git a/gtk/ui/gtk4/TorrentUrlChooserDialog.ui b/gtk/ui/gtk4/TorrentUrlChooserDialog.ui index fa5d576ad..a96fa6f6c 100644 --- a/gtk/ui/gtk4/TorrentUrlChooserDialog.ui +++ b/gtk/ui/gtk4/TorrentUrlChooserDialog.ui @@ -42,6 +42,7 @@ 400 1 + 1 1 1