- if (gtk_widget_has_focus (widget))
- {
- GtkStateType state;
- GtkStyle *style;
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- GdkWindow *window;
-
- style = gtk_widget_get_style (widget);
- window = gtk_widget_get_window (widget);
- state = gtk_widget_get_state (widget);
-
- if (interior_focus && child && gtk_widget_get_visible (child))
- {
- GtkAllocation child_allocation;
-
- gtk_widget_get_allocation (child, &child_allocation);
- gtk_paint_focus (style, window, state,
- area, widget, "checkbutton",
- child_allocation.x - focus_width - focus_pad,
- child_allocation.y - focus_width - focus_pad,
- child_allocation.width + 2 * (focus_width + focus_pad),
- child_allocation.height + 2 * (focus_width + focus_pad));
- }
- else
- {
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
- gtk_paint_focus (style, window, state,
- area, widget, "checkbutton",
- allocation.x + border_width,
- allocation.y + border_width,
- allocation.width - 2 * border_width,
- allocation.height - 2 * border_width);
- }
- }
+
+ 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);
+
+ if (interior_focus && child && gtk_widget_get_visible (child))
+ {
+ GtkAllocation child_allocation;
+
+ gtk_widget_get_allocation (child, &child_allocation);
+ gtk_render_focus (context, cr,
+ child_allocation.x - allocation.x - focus_width - focus_pad,
+ child_allocation.y - allocation.y - focus_width - focus_pad,
+ child_allocation.width + 2 * (focus_width + focus_pad),
+ child_allocation.height + 2 * (focus_width + focus_pad));
+ }
+ else
+ gtk_render_focus (context, cr,
+ border_width, border_width,
+ allocation.width - 2 * border_width,
+ allocation.height - 2 * border_width);