Skip to content

Commit b34bf25

Browse files
flound1129claude
andcommitted
fix(gtk): prevent PathChooser Enter key hang inside dialogs
When Enter is pressed in a PathChooser text entry, it opens the stored-values popup which does a seat.grab(). Inside a modal dialog, the nested grab deadlocks GTK's event loop, requiring a force quit. Fix: when the widget's toplevel is a Gtk.Dialog, skip the popup and call activate_default() to confirm the dialog. This is needed because entry_text lacks activates-default, so simply propagating Enter does not reach the dialog's default button. Affects all five PathChooser uses in dialogs (move storage, add torrent ×2, preferences ×3). The standalone use in OptionsTab (parented to the main window) is unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e580754 commit b34bf25

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

deluge/ui/gtk3/path_combo_chooser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,8 +1438,12 @@ def _on_entry_text_key_press_event(self, widget, event):
14381438
if self.auto_completer.auto_complete_enabled:
14391439
self.auto_completer.do_completion()
14401440
return True
1441-
# Show popup when Enter is pressed
1441+
# Show popup when Enter is pressed, unless inside a dialog where
1442+
# Enter should confirm the dialog instead of opening the popup.
14421443
elif key_is_enter(keyval):
1444+
if isinstance(self.get_toplevel(), Gtk.Dialog):
1445+
self.get_toplevel().activate_default()
1446+
return True
14431447
# This sets the toggle active which results in
14441448
# on_button_toggle_dropdown_toggled being called which initiates the popup
14451449
self.button_toggle.set_active(True)

0 commit comments

Comments
 (0)