After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 61079 - Default draw_focus doesn't support RC themeing
Default draw_focus doesn't support RC themeing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2001-09-24 20:19 UTC by bill.haneman
Modified: 2011-02-04 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch to implement desired feature (8.28 KB, patch)
2001-09-24 20:20 UTC, bill.haneman
none Details | Review
improved attachment, fix for more general case. includes widget drawing tweaks to remove assumptions about focus linewidth. (66.89 KB, patch)
2001-10-26 14:12 UTC, bill.haneman
none Details | Review
a more recent version of the patch, slightly improved. (71.01 KB, patch)
2001-11-18 05:43 UTC, bill.haneman
none Details | Review

Description bill.haneman 2001-09-24 20:19:18 UTC
The default GTK+ drawing engine (or rather, the default draw routine) for
focus indication is not themeable with respect to line thickness or dash
pattern.  This has only a minor cosmetic impact, though it restricts theme
flexibility - but it presents a significant barrier to accessibility for
low-vision users.  Though font size and most widget colors can be themed
via RC files to support large fonts and high-contrast, the focus indication
line width and pattern are hard-wired.  Though this can be worked around
via completely rewritten theme engines, these theme engines would still
desire a property-based means of setting focus line thickness.  One would
like to offer a choice of engines for large-print and high-contrast themes,
rather than making such users rely entirely on alternate engines.

Here is a proposed high-contrast/large-print theme, with implied extensions
for focus-indication theming:

# 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-focus-line-width = 3
gtk-focus-line-pattern = "\10\1"

style "default"
{
  font_name = "sans 18"

  GtkEntry::cursor_color    = { 0.80, 0.00, 0.00 }
  GtkEntry::cursor_line_thickness = 2  
  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"

-----

A proposed patch is available that fixes this bug.
Comment 1 bill.haneman 2001-09-24 20:20:18 UTC
Created attachment 5683 [details] [review]
proposed patch to implement desired feature
Comment 2 Owen Taylor 2001-10-19 15:48:45 UTC
OK, looking at this some comments:

 * It would be best to have the cursor and focus
   patches separate.
 
 * I believe the focus should be a style property
   on GtkWidget rather than a global property. If
   it's a style property, then a theme writer
   can use different focus thicknesses for different
   widgets. [ I'd probably use focus_thickness as the
   name ]

 * As well as changing the drawing routines, you really
   need to track down every assumption that the focus
   line takes 1 pixel of space.

   The easiest way to do this would be to make the 
   focus thickness very big (10 pixels, say), then
   check

    GtkButton,GtkCheckButton,GtkEntry,GtkListItem,
    GtkNotebook,GtkOptionMenu,GtkRange,GtkText,
    GtkTextView,GtkToggleItem,GtkTreeItem,GtkTreeView
  
   With the interior-focus style property set to both 0 and 1
   (the above list of widgets was found by grepping
   for gtk_paint_focus).

I do think making the focus line settable is something we
can do for GTK+-2.0.
Comment 3 bill.haneman 2001-10-26 14:12:06 UTC
Created attachment 5915 [details] [review]
improved attachment, fix for more general case. includes widget drawing tweaks to remove assumptions about focus linewidth.
Comment 4 bill.haneman 2001-10-26 14:35:10 UTC
There is a new patch supplied for this bug, which not only provides a
fix for it, but fixes bugs 63071-63075 inclusive.

This patch makes the focus drawing for widgets, using interior or
exteriof focus, not depend on the linewidth, and increases the size
requests for widget allocations to account for the thicker lines if
present.  It also makes several widgets which previously did their own
focus drawing respect the themed focus line gc info which this patch
adds to GtkStyle.
Comment 5 bill.haneman 2001-11-18 05:43:16 UTC
Created attachment 6039 [details] [review]
a more recent version of the patch, slightly improved.
Comment 6 Matthias Clasen 2002-01-09 09:35:39 UTC
Here is Owens mail describing which parts of the patch are 
committed and which are still outstanding:

http://mail.gnome.org/archives/gtk-devel-list/2001-
December/msg00018.html

(I still don't know how to keep URLs intact with the web 
interface...)
Comment 7 Owen Taylor 2002-02-21 17:38:52 UTC
Only additional issue here is 72027, closing this bug for clarity.