summaryrefslogtreecommitdiff
path: root/gtk/gtkcheckbutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-08-10 16:00:38 +0200
committerMatthias Clasen <mclasen@redhat.com>2011-08-10 16:34:20 +0200
commit2ba9c4b4a7d9ffc3161e2db1774743182a365d99 (patch)
tree71eafdf29308d8cf5b2adba4df97461ee9b5568a /gtk/gtkcheckbutton.c
parent6596dbff312ecdc65681c37f3de21217d7731388 (diff)
downloadgtk+-2ba9c4b4a7d9ffc3161e2db1774743182a365d99.tar.gz
Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed by the Gtk/VisibleFocus X setting. Its three values control how focus rectangles are displayed. 'always' is equivalent to the traditional GTK+ behaviour of always rendering focus rectangles. 'never' does what it says, and is intended for keyboardless situations, e.g. tablets. 'automatic' hides focus rectangles initially, until the user interacts with the keyboard, at which point focus rectangles become visible. https://bugzilla.gnome.org/show_bug.cgi?id=649567
Diffstat (limited to 'gtk/gtkcheckbutton.c')
-rw-r--r--gtk/gtkcheckbutton.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 3b8b950b82..7982e7fe53 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -172,26 +172,27 @@ gtk_check_button_paint (GtkWidget *widget,
cairo_t *cr)
{
GtkCheckButton *check_button = GTK_CHECK_BUTTON (widget);
- gint border_width;
- gint interior_focus;
- gint focus_width;
- gint focus_pad;
-
- gtk_widget_style_get (widget,
- "interior-focus", &interior_focus,
- "focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
- NULL);
gtk_check_button_draw_indicator (check_button, cr);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- if (gtk_widget_has_focus (widget))
+ if (gtk_widget_has_visible_focus (widget))
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
GtkStyleContext *context;
GtkStateFlags state;
GtkAllocation allocation;
+ gint border_width;
+ gint interior_focus;
+ gint focus_width;
+ gint focus_pad;
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ gtk_widget_style_get (widget,
+ "interior-focus", &interior_focus,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
gtk_widget_get_allocation (widget, &allocation);
context = gtk_widget_get_style_context (widget);