[gtk/wip/baedert/for-master] popovermenu: Only close if there's a new focus widget



commit 8deedef13f1b686d1398696a196aca078498de11
Author: Timm Bäder <mail baedert org>
Date:   Sun Oct 6 12:50:22 2019 +0200

    popovermenu: Only close if there's a new focus widget
    
    Makes sense and otherwise we end up closing the popover for no reason

 gtk/gtkpopovermenu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c
index 44cfa0cea0..a778e8e51f 100644
--- a/gtk/gtkpopovermenu.c
+++ b/gtk/gtkpopovermenu.c
@@ -216,10 +216,12 @@ focus_out (GtkEventController *controller,
            GtkPopoverMenu     *menu)
 {
   gboolean contains_focus;
+  GtkWidget *new_focus;
 
   g_object_get (controller, "contains-focus", &contains_focus, NULL);
 
-  if (!contains_focus)
+  new_focus = gtk_root_get_focus (gtk_widget_get_root (GTK_WIDGET (menu)));
+  if (!contains_focus && new_focus != NULL)
     {
       if (menu->parent_menu &&
           GTK_POPOVER_MENU (menu->parent_menu)->open_submenu == (GtkWidget*)menu)


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