From f1bb8e43010f7eadec10e95f773333749615f72b Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Sat, 22 Apr 2023 20:43:10 +0000 Subject: Revert "files-view: Focus view items directly" This reverts commit 9ecd422cc78efad939d072e61c13e1c3a7726fc9. Its commit message is misleading. Maybe it had such a side effect, but the issue it fixed was actually a GTK bug which got fixed in the meantime: https://gitlab.gnome.org/GNOME/gtk/-/commit/8455b9ac74d5337429a1a14eb> Also, reverting it fixes a new bug: the first item is selected when the item which was selected has been deleted. Next item should be selected instead. --- src/nautilus-files-view.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index 2d7ae526b..c022386b2 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -3216,47 +3216,6 @@ slot_active_changed (NautilusWindowSlot *slot, } } -static gboolean -nautilus_files_view_focus (GtkWidget *widget, - GtkDirectionType direction) -{ - NautilusFilesView *view; - NautilusFilesViewPrivate *priv; - GtkWidget *focus; - GtkWidget *main_child; - - view = NAUTILUS_FILES_VIEW (widget); - priv = nautilus_files_view_get_instance_private (view); - focus = gtk_window_get_focus (GTK_WINDOW (gtk_widget_get_root (widget))); - - /* In general, we want to forward focus movement to the main child. However, - * we must chain up for default focus handling in case the focus in in any - * other child, e.g. a popover. */ - if (focus != NULL && - gtk_widget_is_ancestor (focus, widget) && - !gtk_widget_is_ancestor (focus, priv->scrolled_window)) - { - if (GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->focus (widget, direction)) - { - return TRUE; - } - else - { - /* The default handler returns FALSE if a popover has just been - * closed, because it moves the focus forward. But we want to move - * focus back into the view's main child. So, fall through. */ - } - } - - main_child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (priv->scrolled_window)); - if (main_child != NULL) - { - return gtk_widget_child_focus (main_child, direction); - } - - return FALSE; -} - static gboolean nautilus_files_view_grab_focus (GtkWidget *widget) { @@ -9522,7 +9481,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass) oclass->get_property = nautilus_files_view_get_property; oclass->set_property = nautilus_files_view_set_property; - widget_class->focus = nautilus_files_view_focus; widget_class->grab_focus = nautilus_files_view_grab_focus; -- cgit v1.2.1