[gnome-software] Improve keynav handling



commit a51a756c18cb753a2e815b9ee510e9793546f794
Author: Kalev Lember <klember redhat com>
Date:   Fri Aug 21 22:50:31 2015 +0200

    Improve keynav handling
    
    Try to be more careful with search-as-you-type and make sure we only
    move keyboard focus to the search entry once we are sure that we got new
    text. Doing it that way makes sure we ignore any modifiers, such as
    shift and caps lock and avoid focusing the search entry on those.

 src/gs-shell.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 779fc37..a724e8b 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -408,13 +408,10 @@ window_keypress_handler (GtkWidget *window, GdkEvent *event, GsShell *shell)
        g_signal_handler_disconnect (entry, preedit_change_id);
 
        if ((res && g_strcmp0 (new_text, old_text) != 0) ||
-           preedit_changed)
+           preedit_changed) {
+               gtk_entry_grab_focus_without_selecting (GTK_ENTRY (entry));
                handled = GDK_EVENT_STOP;
-
-       /* We set "editable" so the text in the  entry won't get selected on focus */
-       g_object_set (entry, "editable", FALSE, NULL);
-       gtk_widget_grab_focus (entry);
-       g_object_set (entry, "editable", TRUE, NULL);
+       }
 
        return handled;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]