GNOME Bugzilla – Bug 61079
Default draw_focus doesn't support RC themeing
Last modified: 2011-02-04 16:09:32 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.
Created attachment 5683 [details] [review] proposed patch to implement desired feature
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.
Created attachment 5915 [details] [review] improved attachment, fix for more general case. includes widget drawing tweaks to remove assumptions about focus linewidth.
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.
Created attachment 6039 [details] [review] a more recent version of the patch, slightly improved.
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...)
Only additional issue here is 72027, closing this bug for clarity.