Re: API Change request: gtk_paint_focus and GtkStyleClass->draw_focus



Bill Haneman wrote:

>Owen wrote:

> >  * Just always use widget->state. The results really aren't bad;
> >    we only have problems:
> >
> >     - If we area drawing a "subwidget" that has a state
> >       independent of the widget
> >     - If the foreground in the state of the subwidget is
> >       significantly different from foreground of the
> >       state of the widget.
> >     - If focus indication is necessary for the subwidget.
> >
> >   Examples do exist - an example might be a black-and-white high-contrast
> >   theme where selected rows of are drawn in black on white and other
> >   rows white on black - but they certainly aren't common.
> 
> This is exactly the reason why we can't use widget->state, as detailed
> in my original report.  The cases you mention above are very important
> cases, not edge cases.  They are in fact predominant for high-contrast
> themes.

Umm, re-reading my own message I'm afraid I came across as a little
imperious, not really the effect I was after :-)  I agree that for the
default GtkStyle most users won't see this as a problem.  The
black-and-white high-contrast case is probably worst-case, as you
suggest.  The problem is that this "worst case" is exactly the one where
clear visibility of focus indication is most important for
accessibility.  I attach my own sample "HighContrastAccessible" theme
gtkrc file.  Note that the gtkrc file relies on other parts of my focus
patch to work properly, so using the gtkrc file will just illustrate the
fg/bg combinations but won't show the improved focus drawing unless one
applies the patch previously sent to the gtk-devel-list.

> The "uncommon" case you mention applies to all lists and treeviews in
> GTK+-2.0 using high-contrast themes.
> 
> >  * A gross hack -- callers that need to paint with something
> >    other than widget->state can do:
> >
> >     GtkStateType saved_state = widget->state;
> >     widget->state = subwidget_state;
> >     gtk_paint_focus (style, window, area, widget, ...);
> >     widget->state = saved_state;

I thought about this.  Unpleasant...

> > We could also do this as a compatible API change:
> >
> >  *  We add gtk_paint_focus_extended() and a paint_focus_extended()
> >     virtual function to GtkStyle. (Default implementation of
> >     paint_focus() calls paint_focus_extended().)
...
> > Still, I can't really claim that any of the three solutions listed
> > above actually benefits GTK+ users more than just going ahead and
> > making the change, fixing up uses on CVS, and documenting it in the
> > release announcement for 1.3.12. (Though they might be more gentle
> > to my pride in being able to stick to an API freeze.)
> >
> > So, unless people have convincing arguments otherwise, I'll go ahead
> > and make the change.

Thanks for looking at this!

-Bill

> >
> > Regards,
> >                                         Owen
# High-Contrast, Large Print Theme v0.1
# This is the whole basic theme, just this one gtkrc file.
# It uses components of the standard theme engine
# Written by Bill Haneman, based on Standard theme by T. Liebeck, 
# which was in turn based on lots of different gtkrc files but
# primarily the one for the metal theme.
# email: bill haneman sun com

gtk-cursor-aspect-ratio = 0.1

style "default"
{
  font_name = "sans 18"

  GtkWidget::focus-line-width = 1
  GtkWidget::focus-line-pattern = "\1\1"
  GtkWidget::interior_focus = 1
  GtkWidget::focus-padding = 0
  GtkEntry::cursor_color    = { 0.80, 0.00, 0.00 }
  GtkEntry::cursor_line_thickness = 1  
  GtkTextView::cursor_line_thickness = 2

  fg[NORMAL]      = { 0.00, 0.00, 0.00 }
  text[NORMAL]      = { 0.00, 0.00, 0.00 }
  bg[NORMAL]      = { 1.00, 1.00, 1.00 }
  base[NORMAL]    = { 1.00, 1.00, 1.00 }

  fg[INSENSITIVE]      = { 0.6, 0.6, 0.6 }
  bg[INSENSITIVE]      = { 0.75, 0.75, 0.77 }
  base[INSENSITIVE]      = { 0.75, 0.75, 0.77 }

  fg[PRELIGHT]    = { 0.80, 0.80, 1.00 }
  text[PRELIGHT]    = { 0.80, 0.80, 1.00 }
  bg[PRELIGHT]    = { 0.00, 0.00, 0.00 }
  base[PRELIGHT]    = { 0.00, 0.00, 0.00 }

  fg[ACTIVE]      = { 0.00, 0.00, 0.00 }
  text[ACTIVE]      = { 0.00, 0.00, 0.00 }
  bg[ACTIVE]      = { 0.65, 0.65, 0.50 }
  base[ACTIVE]      = { 0.65, 0.65, 0.50 }

  fg[SELECTED]    = { 1.00, 1.00, 1.00 }
  text[SELECTED]    = { 1.00, 1.00, 1.00 }
  bg[SELECTED]    = { 0.00, 0.00, 0.00 }
  base[SELECTED]    = { 0.10, 0.20, 0.20 }

  xthickness = 3
  ythickness = 3
 
}

class "GtkWidget" style "default"


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