GNOME Bugzilla – Bug 63075
gtkcalendar does not use standard focus drawing mechanism
Last modified: 2011-02-04 16:09:17 UTC
gtkcalendar uses its own focus drawing code, not gtk_paint_focus. As part of the patch for bug 61079, gtkcalendar is modified to call gtk_paint_focus() instead, so that it can be consistent with the rest of GTK+.
http://mail.gnome.org/archives/gtk-devel-list/2001-December/msg00018.html Describes what needs to be done to GtkCalendar.
Created attachment 6499 [details] [review] patch to provide fix for this bug
The previous suggestion that the spacing between calendar dates needs only to be increased by one focus-width is incorrect, since the focus rectangle must be drawn entirely within the background rectangle for the date, in order to be visible in high contrast themes. Also the paint_focus call must have an appropriate GTK_WIDGET_STATE set according to whether the focussed cell is selected or not. THe attached patch addresses these issues.
To quibble over the comment about selected backgrounds: The optimum appearance is when the focus rectangle contrasts with both the selected and non-selected background. In this case, it's clearly visible. If you have a monochrome color scheme with an inverted selection, then this is not possible. Two effects are then possible: a) The focus rectangle is drawn in place of the non-selected background surrounding the selected cell and makes the cell visually larger. (Possibbly with a dashed pattern.) b) The focus rectangle is drawn in place of the selected background within the selected cell and makes the cell visually smaller. (Possibly with a dashed pattern.) In theory, it would be possible to mix the two, but that would produce ugly results. I don't think there is any real difference between a) and b) in terms of distinctiveness. The one advantage for b) is that the current values of the parameters DAY_XPAD and DAY_XSEP are 2 and 0 respectively, so currently the focus is drawn inside the selected area instead of outside the selected area.
Applied mostly as provided, with a few cleanups (don't need to pass an area to paint_focus() unless you have clipping,etc.) Wed Feb 13 23:01:20 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkcalendar.c: Patch from Bill Haneman to draw to focus using gtk_paint_focus() with the focus width GtkWidget::focus-width. (#63075)