firefox/mozilla-1073117-button-focu...

79 lines
3.1 KiB
Diff

# HG changeset patch
# Parent ee674865d97716b0334559abb8eec54eb5c72cb0
# User Martin Stransky <stransky@redhat.com>
Bug 1073117 - Fixed Theme issues with GTK 3.14 - GtkButtons - use border style
property for focus rendering. Don't follow interior-focus which is always true in Gtk 3.14.
r=?karlt
diff --git a/widget/gtk/gtk3drawing.c b/widget/gtk/gtk3drawing.c
--- a/widget/gtk/gtk3drawing.c
+++ b/widget/gtk/gtk3drawing.c
@@ -903,29 +903,18 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
GtkWidgetState* state,
GtkReliefStyle relief, GtkWidget* widget,
GtkTextDirection direction)
{
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style = gtk_widget_get_style_context(widget);
gint x = rect->x, y=rect->y, width=rect->width, height=rect->height;
- gboolean interior_focus;
- gint focus_width, focus_pad;
-
- moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
gtk_widget_set_direction(widget, direction);
-
- if (!interior_focus && state->focused) {
- x += focus_width + focus_pad;
- y += focus_width + focus_pad;
- width -= 2 * (focus_width + focus_pad);
- height -= 2 * (focus_width + focus_pad);
- }
-
+
gtk_style_context_save(style);
gtk_style_context_set_state(style, state_flags);
if (state->isDefault && relief == GTK_RELIEF_NORMAL) {
/* handle default borders both outside and inside the button */
gint default_top, default_left, default_bottom, default_right;
moz_gtk_button_get_default_overflow(&default_top, &default_left,
&default_bottom, &default_right);
@@ -948,30 +937,22 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
/* the following line can trigger an assertion (Crux theme)
file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area):
assertion `GDK_IS_WINDOW (window)' failed */
gtk_render_background(style, cr, x, y, width, height);
gtk_render_frame(style, cr, x, y, width, height);
}
if (state->focused) {
- if (interior_focus) {
- GtkBorder border;
- gtk_style_context_get_border(style, state_flags, &border);
- x += border.left + focus_pad;
- y += border.top + focus_pad;
- width -= 2 * (border.left + focus_pad);
- height -= 2 * (border.top + focus_pad);
- } else {
- x -= focus_width + focus_pad;
- y -= focus_width + focus_pad;
- width += 2 * (focus_width + focus_pad);
- height += 2 * (focus_width + focus_pad);
- }
-
+ GtkBorder border;
+ gtk_style_context_get_border(style, state_flags, &border);
+ x += border.left;
+ y += border.top;
+ width -= (border.left + border.right);
+ height -= (border.top + border.bottom);
gtk_render_focus(style, cr, x, y, width, height);
}
gtk_style_context_restore(style);
return MOZ_GTK_SUCCESS;
}
static gint
moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,