[gnome-software: 2/3] overview-page: Make the flowbox child non-focusable




commit 3b4f8de5b65d3d71518e3ca11acfd6323c1894d2
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jul 20 16:49:30 2021 +0200

    overview-page: Make the flowbox child non-focusable
    
    This avoids focusing the flowbox child which isn't activatable, to then
    have to tab into the actual app button, which *is* activateable and has
    exactly the same focus ring. This hence makes keyboard navigation less
    confusing.

 src/gs-overview-page.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index 6294928c0..d0ef6728d 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -203,6 +203,7 @@ gs_overview_page_get_recent_cb (GObject *source_object, GAsyncResult *res, gpoin
        guint i;
        GsApp *app;
        GtkWidget *tile;
+       GtkWidget *child;
        g_autoptr(GError) error = NULL;
        g_autoptr(GsAppList) list = NULL;
 
@@ -234,7 +235,15 @@ gs_overview_page_get_recent_cb (GObject *source_object, GAsyncResult *res, gpoin
                tile = gs_summary_tile_new (app);
                g_signal_connect (tile, "clicked",
                          G_CALLBACK (app_tile_clicked), self);
-               gtk_container_add (GTK_CONTAINER (self->box_recent), tile);
+               child = gtk_flow_box_child_new ();
+               /* Manually creating the child is needed to avoid having it be
+                * focusable but non activatable, and then have the child
+                * focusable and activatable, which is annoying and confusing.
+                */
+               gtk_widget_set_can_focus (child, FALSE);
+               gtk_widget_show (child);
+               gtk_container_add (GTK_CONTAINER (child), tile);
+               gtk_container_add (GTK_CONTAINER (self->box_recent), child);
        }
        gtk_widget_set_visible (self->box_recent, TRUE);
        gtk_widget_set_visible (self->recent_heading, TRUE);


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