[nautilus/wip/corey/list-view: 20/21] files-view: Set popover menu's parent to scrolled window
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/list-view: 20/21] files-view: Set popover menu's parent to scrolled window
- Date: Tue, 23 Aug 2022 17:49:06 +0000 (UTC)
commit 60f40431e218964153f223026e7cc2339d445701
Author: Corey Berla <corey berla me>
Date: Sun Aug 21 14:13:06 2022 -0700
files-view: Set popover menu's parent to scrolled window
After closing the background or selection menu (by clicking out of the
menu or escape) the focus goes to the back button in the toolbar,
rather than the last focused item. There's something related to
our FileView that isn't grabbing the focus back. Set the parent
to the scrolled window instead so that we get the focus back.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2433
src/nautilus-files-view.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 258d2466a..8f9b86d99 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -8370,7 +8370,8 @@ nautilus_files_view_pop_up_selection_context_menu (NautilusFilesView *view,
* closed because it wouldn't activate the actions then. */
g_clear_pointer (&priv->selection_menu, gtk_widget_unparent);
priv->selection_menu = gtk_popover_menu_new_from_model (NULL);
- gtk_widget_set_parent (priv->selection_menu, GTK_WIDGET (view));
+ /* If the view is the parent it doesn't get the focus back, so make the scrolled window the parent
instead */
+ gtk_widget_set_parent (priv->selection_menu, priv->scrolled_window);
gtk_popover_set_has_arrow (GTK_POPOVER (priv->selection_menu), FALSE);
gtk_widget_set_halign (priv->selection_menu, GTK_ALIGN_START);
@@ -8422,7 +8423,8 @@ nautilus_files_view_pop_up_background_context_menu (NautilusFilesView *view,
* closed because it wouldn't activate the actions then. */
g_clear_pointer (&priv->background_menu, gtk_widget_unparent);
priv->background_menu = gtk_popover_menu_new_from_model (NULL);
- gtk_widget_set_parent (priv->background_menu, GTK_WIDGET (view));
+ /* If the view is the parent it doesn't get the focus back, so make the scrolled window the parent
instead */
+ gtk_widget_set_parent (priv->background_menu, priv->scrolled_window);
gtk_popover_set_has_arrow (GTK_POPOVER (priv->background_menu), FALSE);
gtk_widget_set_halign (priv->background_menu, GTK_ALIGN_START);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]