[gnome-text-editor] searchbar: fix navigation with arrows



commit f1bfd38b10d6d3bc7acc65f9cfa6267514c4ec5f
Author: Christian Hergert <chergert redhat com>
Date:   Mon Sep 27 11:59:39 2021 -0700

    searchbar: fix navigation with arrows
    
    This broke in the GTK 4 port so there wasn't a way to navigate with
    arrows as we expected.
    
    Related #156

 src/editor-search-bar.c  | 4 +++-
 src/editor-search-bar.ui | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-search-bar.c b/src/editor-search-bar.c
index 3b6a3fe..893eff9 100644
--- a/src/editor-search-bar.c
+++ b/src/editor-search-bar.c
@@ -323,15 +323,17 @@ on_search_key_pressed_cb (GtkEventControllerKey *key,
   g_assert (GTK_IS_EVENT_CONTROLLER_KEY (key));
   g_assert (EDITOR_IS_SEARCH_BAR (self));
 
-  if (state == 0)
+  if ((state & (GDK_CONTROL_MASK | GDK_ALT_MASK)) == 0)
     {
       switch (keyval)
         {
         case GDK_KEY_Up:
+        case GDK_KEY_KP_Up:
           _editor_search_bar_move_previous (self, FALSE);
           return TRUE;
 
         case GDK_KEY_Down:
+        case GDK_KEY_KP_Down:
           _editor_search_bar_move_next (self, FALSE);
           return TRUE;
 
diff --git a/src/editor-search-bar.ui b/src/editor-search-bar.ui
index 1cdd66f..ff5a6d3 100644
--- a/src/editor-search-bar.ui
+++ b/src/editor-search-bar.ui
@@ -19,6 +19,7 @@
             </layout>
             <child>
               <object class="GtkEventControllerKey">
+                <property name="propagation-phase">capture</property>
                 <signal name="key-pressed" handler="on_search_key_pressed_cb"/>
               </object>
             </child>


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