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()