gtkpopover: Fix key navigation
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 7 Jun 2018 12:09:01 +0000 (14:09 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 21 Jun 2018 10:50:57 +0000 (12:50 +0200)
This has been broken since we switched key event delivery to follow
the same semantics than pointer/touch. There, GTK+ grabs will influence
the topmost widget during event delivery, rendering the toplevel
unable to handle key navigation. The toplevel must handle those key
events in an explicit manner then.

We don't render the keyboard focus rectangle yet, but I assume that's
something else.

gtk/gtkpopover.c

index a520f235ed18727a223202968b55bb5af94abc60..3263f067758864b07627ae05fc65b688435185cb 100644 (file)
@@ -293,7 +293,13 @@ key_controller_key_pressed (GtkEventControllerKey *key,
           focus = gtk_window_get_focus (GTK_WINDOW (toplevel));
 
           if (focus && gtk_widget_is_ancestor (focus, GTK_WIDGET (popover)))
-            return gtk_event_controller_key_forward (key, focus);
+            {
+              if (gtk_event_controller_key_forward (key, focus))
+                return TRUE;
+            }
+
+          /* Piggyback on the toplevel to have it handle key navigation */
+          return gtk_event_controller_key_forward (key, toplevel);
         }
     }