Visual patch for GtkButtons



Greetings,

I just checked out Gtk+ from CVS and noticed that it still has an
aesthetic problem with pushbuttons, that is, when one pushes a pushbutton
it is placed in focus and a black box is placed around it. This ruins the
3d depression effect that should otherwise occur. I made some small
changes to the code for gtk_button_paint and gtk_default_draw_focus to
correct this. It now draws a box with a dashed line in a dark grey colour
a few pixels inside the button's frame to indicate focus. It also no
longer adds a 1-pixel margin around the button when it comes into focus.
The result looks *much* nicer for the default style.

-Bradford Hovinen

"Prudence is a rich, ugly old maid courted by Incapacity."

        - William Blake, "Proverbs of Hell," 1793
Index: gtkbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkbutton.c,v
retrieving revision 1.42
diff -r1.42 gtkbutton.c
570a571
> #if 0
577a579
> #endif
594,597c596,599
< 	  x -= 1;
< 	  y -= 1;
< 	  width += 2;
< 	  height += 2;
---
> 	  x += 3;
> 	  y += 3;
> 	  width -= 6;
> 	  height -= 6;
Index: gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.32
diff -r1.32 gtkstyle.c
3024c3024
<   if (detail && !strcmp (detail, "add-mode"))
---
>   if (detail && (!strcmp (detail, "add-mode") || !strcmp (detail, "button")))
3026,3027c3026,3027
<       gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
<       gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
---
>       gdk_gc_set_line_attributes (style->dark_gc[GTK_STATE_NORMAL], 1, GDK_LINE_ON_OFF_DASH, 0, 0);
>       gdk_gc_set_dashes (style->dark_gc[GTK_STATE_NORMAL], 0, "\1\1", 2);
3030c3030
<                           style->black_gc, FALSE,
---
>                           style->dark_gc[GTK_STATE_NORMAL], FALSE,
3033c3033
<       gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
---
>       gdk_gc_set_line_attributes (style->dark_gc[GTK_STATE_NORMAL], 1, GDK_LINE_SOLID, 0, 0);


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