From 2ba9c4b4a7d9ffc3161e2db1774743182a365d99 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 10 Aug 2011 16:00:38 +0200 Subject: 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 --- gtk/gtkcheckbutton.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'gtk/gtkcheckbutton.c') 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); -- cgit v1.2.1