At 10:06 24.05.01 -0400, Owen Taylor wrote: > >Hans Breuer <hans breuer org> writes: > >> while trying to keep Gtk+2.0 up-to-date on win32, I stumbled >> over just another limitation in the Windoze API. It is >> not possible to draw a really dotted line (one pixel drawn, one >> pixel empty) with standard GDI (Win9x) functions. The 'dotted' line >> style draws and leaves _four_ pixels instead. As a result >> the focus indication looks somewhat ugly. > >Well the interface you need to implement in GTK+ > >void gdk_gc_set_dashes (GdkGC *gc, > gint dash_offset, > gint8 dash_list[], > gint n); > Which is obviously implemented long time ago (though it still inherits the GDI limitations) ... To give you an impression of what is possible with standard GDI functions I've attached a small image. It contains vertical lines with all available linestyles. The border is drawn with DrawFocusRect(). >>From gtkstyle.c/gtk_default_draw_focus: > > if (detail && !strcmp (detail, "add-mode")) > gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2); > else > gdk_gc_set_dashes (style->black_gc, 0, "\1\1", 2); > >[ "add-mode" is basically unused ] > >So if you have to implement it with: > > You use the GDI dotted style if it is 4/4 > You use the GDI "focus" style if it is 1/1 The "focus" style isn't available for drawing lines with GDI (win9x). It is only available from DrawFocusRect(), which can't be (miss-)used to draw lines because of it's XOR semantics. IMO it would be a really small compromise to wrap the focus rectangle drawing into it's own gdk function, but obviously it is simplier to put all the burden on the non X backends ... > You draw lots of little lines if it is anything else > >Well, that would be painful, but... > ... who cares for the win32 port ... Hans
Attachment:
lines.png
Description: Binary data
-------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert