[nautilus/wip/antoniof/post-gtk4-switch-fixes: 13/13] query-editor: HACK for search entry event forward




commit 89a4eeb3d77392a7371fddc505613049d00bf803
Author: António Fernandes <antoniof gnome org>
Date:   Thu Dec 23 17:35:23 2021 +0000

    query-editor: HACK for search entry event forward
    
    We should build our own custom entry instead of doing this.

 src/nautilus-query-editor.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 727240a7c..ef15f11cf 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -804,6 +804,7 @@ nautilus_query_editor_handle_event (NautilusQueryEditor   *self,
                                     guint                  keyval,
                                     GdkModifierType        state)
 {
+    GtkWidget *text;
     g_return_val_if_fail (NAUTILUS_IS_QUERY_EDITOR (self), GDK_EVENT_PROPAGATE);
     g_return_val_if_fail (controller != NULL, GDK_EVENT_PROPAGATE);
 
@@ -815,5 +816,19 @@ nautilus_query_editor_handle_event (NautilusQueryEditor   *self,
         return GDK_EVENT_PROPAGATE;
     }
 
-    return gtk_event_controller_key_forward (controller, GTK_WIDGET (self->entry));
+    text = gtk_widget_get_first_child (GTK_WIDGET (self->entry));
+    while (text != NULL)
+    {
+        if (GTK_IS_TEXT (text))
+        {
+            break;
+        }
+        text = gtk_widget_get_next_sibling (text);
+    }
+
+    if (text == NULL)
+    {
+        return FALSE;
+    }
+    return gtk_event_controller_key_forward (controller, text);
 }


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