From fdfd438ec51df5d75c4caf177a4708d6b520d4de Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Wed, 22 Apr 2026 19:21:14 -0400 Subject: [PATCH] Restore entry autocomplete via deprecated Gtk.EntryCompletion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GTK 4 port had dropped the entry completion wiring from SearchableEntrybox. Gtk.EntryCompletion is deprecated but still functions; its intended replacement (Gtk.SuggestionEntry) has not landed yet. Rewire the existing liststore + match_func onto an EntryCompletion attached to the entry — the rest of the widget already assumes autocomplete works. Co-Authored-By: Claude Opus 4.6 --- GTK4-MIGRATION.md | 14 ++++++++++++++ lutris/gui/widgets/searchable_entrybox.py | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/GTK4-MIGRATION.md b/GTK4-MIGRATION.md index d0110234e..4e78dbfe1 100644 --- a/GTK4-MIGRATION.md +++ b/GTK4-MIGRATION.md @@ -267,6 +267,20 @@ This avoids the GTK 3 pattern of connecting to `destroy` on every window to remove stale dict entries, which is fragile under GTK 4 where windows participate in `Gtk.Application`'s lifecycle automatically. +## Gtk.EntryCompletion + +`Gtk.EntryCompletion` is deprecated in GTK 4 but still ships and still +works. Its intended replacement, `Gtk.SuggestionEntry`, has not yet +landed — it is slated for GTK 5. Until then, widgets that need an +autocomplete dropdown under a `Gtk.Entry` (we have one, +`SearchableEntrybox`) keep using `Gtk.EntryCompletion` as-is. + +A hand-rolled replacement was attempted (non-autohiding `Gtk.Popover` +with a `Gtk.FilterListModel`-backed `Gtk.ListView`); it works, but the +focus dance required to keep typing alive while the popover is visible +isn't worth carrying for the duration of the GTK 4 cycle. When +`Gtk.SuggestionEntry` lands, swap `SearchableEntrybox` over to it. + ## GridView Thumb-Drag Flicker (Unresolved) **Symptom**: In the games grid, holding the scrollbar thumb still — not moving diff --git a/lutris/gui/widgets/searchable_entrybox.py b/lutris/gui/widgets/searchable_entrybox.py index 9d36ff617..a7762e6b2 100644 --- a/lutris/gui/widgets/searchable_entrybox.py +++ b/lutris/gui/widgets/searchable_entrybox.py @@ -21,6 +21,15 @@ class SearchableEntrybox(Gtk.Box): self.liststore = Gtk.ListStore(str, str) self.entry = Gtk.Entry() + # Gtk.EntryCompletion is deprecated in GTK 4 and the replacement + # (Gtk.SuggestionEntry) has not landed yet — we use it as-is until + # then. When it's removed, this is the thing to swap out. + self._completion = Gtk.EntryCompletion() + self._completion.set_model(self.liststore) + self._completion.set_text_column(0) + self._completion.set_match_func(self.search_store) + self.entry.set_completion(self._completion) + # Popover menu for the choice list self._popup_menu_model = Gio.Menu() self._popup_action_group = Gio.SimpleActionGroup()