diff options
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkElements.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 7f46d6d..a5bd95c 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -247,6 +247,7 @@ static void FieldElementDraw( int x1 = b.x, x2 = b.x + b.width - 1; int y1 = b.y, y2 = b.y + b.height - 1; int w = WIN32_XDRAWLINE_HACK; + GC bgGC; /* * Draw the outer rounded rectangle @@ -265,7 +266,7 @@ static void FieldElementDraw( /* * Fill the inner rectangle */ - GC bgGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); + bgGC = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); XFillRectangle(disp, d, bgGC, b.x+1, b.y+1, b.width-2, b.height-2); } else { /* @@ -371,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); } |