Skip to content

Instantly share code, notes, and snippets.

@IBBoard
Created March 29, 2022 19:55
Show Gist options
  • Select an option

  • Save IBBoard/8fc8178532e0e69db9d24842b5a620b1 to your computer and use it in GitHub Desktop.

Select an option

Save IBBoard/8fc8178532e0e69db9d24842b5a620b1 to your computer and use it in GitHub Desktop.
A (hopefully functioning) patch to make https://aur.archlinux.org/packages/nautilus-typeahead work with Nautilus 42 and the new GtkEventControllerKey event pattern
@@ -214,7 +214,7 @@
static NautilusView *
nautilus_window_slot_get_view_for_location (NautilusWindowSlot *self,
GFile *location)
-@@ -640,18 +744,72 @@ nautilus_window_slot_handle_event (NautilusWindowSlot *self,
+@@ -640,18 +744,73 @@ nautilus_window_slot_handle_event (NautilusWindowSlot *self,
}
}
@@ -241,9 +241,10 @@
+
+ /* Make a copy of the current text */
+ old_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->isearch_entry)));
-+ new_event = gdk_event_copy ((GdkEvent *) controller->current_event);
-+ g_object_unref (((GdkEventKey *) new_event)->window);
-+
++ new_event = gdk_event_new (GDK_KEY_PRESS);
++ ((GdkEventKey *) new_event)->group = gtk_event_controller_key_get_group (controller);
++ ((GdkEventKey *) new_event)->keyval = keyval;
++ ((GdkEventKey *) new_event)->state = state;
+ ((GdkEventKey *) new_event)->window =
+ g_object_ref (gtk_widget_get_window (self->isearch_window));
+ gtk_widget_realize (self->isearch_window);
@@ -275,7 +276,7 @@
+ g_free (old_text);
+
+ if (self->isearch_imcontext_changed || (retval && text_modified)) {
-+ if (isearch_start (self, gdk_event_get_device ((GdkEvent *) controller->current_event))) {
++ if (isearch_start (self, NULL)) {
+ gtk_widget_grab_focus (GTK_WIDGET (self));
+ return TRUE;
+ }
@@ -543,7 +543,7 @@
+ file_list = nautilus_view_get_selection (slot->content_view);
+ nautilus_files_view_activate_files (NAUTILUS_FILES_VIEW (slot->content_view),
+ file_list,
-+ NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB, TRUE);
++ NAUTILUS_OPEN_FLAG_NEW_TAB, TRUE);
+ nautilus_file_list_free (file_list);
+}
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment