Tk Source Code

View Ticket
Login
Ticket UUID: 1151064
Title: Aqua: XDrawLine draws nothing with Tk_GCForColor
Type: Bug Version: None
Submitter: muonics Created on: 2005-02-24 14:38:24
Subsystem: 66. Aqua Window Operations Assigned To: das
Priority: 4 Severity:
Status: Closed Last Modified: 2026-10-22 17:22:34
Resolution: Fixed Closed By: serhiy.storchaka
    Closed on: 2026-09-25 06:54:05
Description:
The line width for the GC returned by Tk_GCForColor is
zero.  This results in XDrawLine drawing nothing under
Aqua, where other platforms a line is drawn with a
default width of 1.

Reference Tile Bug #1115785 for more details.
User Comments: serhiy.storchaka added on 2026-09-25 06:54:05:

Fixed in 8.4.10 and 8.5.0 by [3f64acc36d] (trunk: [67cb6f9bd1]): new GCs get line width 1 by default, as suggested below. Closing.


muonics added on 2005-03-13 10:39:11:
Logged In: YES 
user_id=498198

The lines in question are drawn with GCs created using
Tk_GCForColor.  There is no way to specify a line width with
that, unless you change it with XChangeGC, which (according
to Joe) you're not really supposed to do with GC obtained
through Tk_GCForColor.  At any rate, it's a bug on the mac
because the line width for such GCs is 1 everywhere else. 
Thus the lines are drawn everywhere but the mac.

wolfsuit added on 2005-03-13 09:57:47:
Logged In: YES 
user_id=169107

This is simple to fix, the patch is just to change the default line_width in 
tk/xlib/xgc.c from 0 to 1 in XCreateGC.  But why is Tile drawing lines 
without specifying the linewidths?  Tk always specifies width (which is why 
this behavior never showed up.)  And in Tk_GetGC - which is generally 
how Tk gets its GC's for drawing, it also sets the line width to 0 if it is not 
specified.

wolfsuit added on 2005-03-13 09:51:38:
Logged In: YES 
user_id=169107

This is simple to fix, the patch is just to change the default line_width in 
tk/xlib/xgc.c from 0 to 1 in XCreateGC.  But why is Tile drawing lines 
without specifying the linewidths?  Tk always specifies width (which is why 
this behavior never showed up.)  And in Tk_GetGC - which is generally 
how Tk gets its GC's for drawing, it also sets the line width to 0 if it is not 
specified.