mirror of
https://github.com/lutris/lutris.git
synced 2026-06-17 10:19:58 -04:00
Restore entry autocomplete via deprecated Gtk.EntryCompletion
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user