[gtk/matthiasc/for-master: 20/21] colorbutton: Fix focus



commit 8991275fbd0e8d3cb18568eaf054cd577099ac6a
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 3 17:39:49 2020 -0400

    colorbutton: Fix focus
    
    The colorbutton contains a button which contains a colorswatch.
    We want the focus to go straight to the button, nowhere else,
    so mark the swatch as !can-focus.
    
    Adapt tests to match.

 gtk/gtkcolorbutton.c                         | 1 +
 testsuite/gtk/focus-chain/widget-factory.tab | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 1638cdc6ee..13dbc36c79 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -265,6 +265,7 @@ gtk_color_button_init (GtkColorButton *button)
   gtk_widget_set_parent (priv->button, GTK_WIDGET (button));
 
   priv->swatch = gtk_color_swatch_new ();
+  gtk_widget_set_can_focus (priv->swatch, FALSE);
   layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black");
   pango_layout_get_pixel_extents (layout, NULL, &rect);
   g_object_unref (layout);
diff --git a/testsuite/gtk/focus-chain/widget-factory.tab b/testsuite/gtk/focus-chain/widget-factory.tab
index 1812f0c8f6..2a95755abd 100644
--- a/testsuite/gtk/focus-chain/widget-factory.tab
+++ b/testsuite/gtk/focus-chain/widget-factory.tab
@@ -16,7 +16,6 @@ GtkToggleButton
 GtkToggleButton
 GtkButton
 GtkButton
-GtkColorSwatch
 GtkButton
 GtkLinkButton
 GtkSwitch


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