summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkElements.c
diff options
context:
space:
mode:
authorcsaba <csaba>2024-07-28 11:19:38 (GMT)
committercsaba <csaba>2024-07-28 11:19:38 (GMT)
commitabd2b62e940a7cee9d3f598d73298b9131b0f431 (patch)
tree4ee2980afa5bdd70ddd31b87e42124b4bb74d99e /generic/ttk/ttkElements.c
parentd68f02fce179fa48c0a7fef7359b6ea08b63e631 (diff)
downloadtk-abd2b62e940a7cee9d3f598d73298b9131b0f431.zip
tk-abd2b62e940a7cee9d3f598d73298b9131b0f431.tar.gz
tk-abd2b62e940a7cee9d3f598d73298b9131b0f431.tar.bz2
Proposed fix for ticket [0d48797195]: Ugly and inconsistent look of the focus element and active listbox item.
Diffstat (limited to 'generic/ttk/ttkElements.c')
-rw-r--r--generic/ttk/ttkElements.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index 365314f..d52c428 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -372,24 +372,31 @@ static void DrawFocusRing(
Ttk_Box b)
{
XColor *color = Tk_GetColorFromObj(tkwin, colorObj);
- unsigned long mask = 0UL;
- XGCValues gcvalues;
+ XGCValues gcValues;
GC gc;
+ Display *disp = Tk_Display(tkwin);
+
+ if (thickness < 1 && solid) {
+ thickness = 1;
+ }
+
+ gcValues.foreground = color->pixel;
+ gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
- gcvalues.foreground = color->pixel;
- gcvalues.line_width = thickness < 1 ? 1 : thickness;
if (solid) {
- gcvalues.line_style = LineSolid;
- mask = GCForeground | GCLineStyle | GCLineWidth;
+ XRectangle rects[4] = {
+ {b.x, b.y, b.width, thickness}, /* N */
+ {b.x, b.y + b.height - thickness, b.width, thickness}, /* S */
+ {b.x, b.y + thickness, thickness, b.height - 2*thickness}, /* W */
+ {b.x + b.width - thickness, b.y + thickness, /* E */
+ thickness, b.height - 2*thickness}
+ };
+
+ XFillRectangles(disp, d, gc, rects, 4);
} else {
- gcvalues.line_style = LineOnOffDash;
- gcvalues.dashes = 1;
- gcvalues.dash_offset = 1;
- mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth;
+ TkDrawDottedRect(disp, d, gc, b.x, b.y, b.width, b.height);
}
- gc = Tk_GetGC(tkwin, mask, &gcvalues);
- XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1);
Tk_FreeGC(Tk_Display(tkwin), gc);
}