Skip to content

Commit 95652d8

Browse files
committed
Merge remote-tracking branch 'origin/pr/60'
* origin/pr/60: Always insert spaces into search bar Pull request description: Fixes QubesOS/qubes-issues#8789. Follow up to #47, cc @marmarta. This combines elements of different versions of that PR. Alternative: could let a focused search bar insert the space itself by wrapping all of this in in the previously present ```py if not isinstance(self.get_active_window().get_focus(), Gtk.SearchEntry): ``` Developed and tested on top of branch `release4.2`. Tested scenarios from previous PR: - Pressing space does not interfere with arrow key navigation on any page. - Spaces can be inserted in the middle of the search text. Still weird: - Pressing space when the search bar is not focused never focuses it (unlike letter keys). - Pressing space when the search page is not visible does not show the search page (unlike letter keys) but does still add a space to the invisible search bar. - The `_key_press` and `_key_pressed` methods appear to handle the same events. Combining them would make it easier to address the previous point.
2 parents 6939189 + 213143d commit 95652d8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

qubes_menu/appmenu.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,12 @@ def _key_press(self, _widget, event):
344344
if event.keyval == Gdk.KEY_Escape:
345345
self.hide_menu()
346346
if event.keyval == Gdk.KEY_space:
347-
current_widget = self.get_active_window().get_focus()
348-
if isinstance(current_widget,
349-
Gtk.SearchEntry):
350-
p = current_widget.get_position()
351-
current_widget.insert_text(" ", p)
352-
current_widget.set_position(p + 1)
353-
return True
347+
search_page = self.handlers.get('search_page')
348+
if isinstance(search_page, SearchPage):
349+
p = search_page.search_entry.get_position()
350+
search_page.search_entry.insert_text(" ", p)
351+
search_page.search_entry.set_position(p + 1)
352+
return True
354353
return False
355354

356355
def _focus_out(self, _widget, _event: Gdk.EventFocus):

0 commit comments

Comments
 (0)