Re: GtkCanvas requirements?



Hi,

Carlos Garnacho wrote:
What are we missing in the current core? What benefits would bring a new
one?

I certainly have not sat down and exhaustively tried to figure this out.

There is a fair bit of cruft in the core; if you were starting over, I'm sure you'd want to just kill GdkWindow for example, and many other "Xlib leakages" such as how some of the events work. You'd want to be Cairo-only, use interfaces instead of objects for the core APIs (widget, container), rethink GtkContainer and its common subclasses (as HippoCanvas does), fix the theme system, blah blah. The list could get pretty long.

The question is which of these are cosmetic cleanups that aren't really worth it and which add new capabilities, and how long is the new capabilities list. Probably not nearly as long as the cosmetic list.

Replacing the core with a more canvas-ish solution would not have to be done all in one shot, though; the WidgetCanvasItem and CanvasWidget provide a lot of interoperability. You could also have some of the existing widgets implement the CanvasItem interface directly, for example GtkEntry could be both a GtkWidget and a CanvasItem.

There's no real disruption to the current core while building a new canvas-style core either, in fact I'd suggest evolving the canvas stuff outside of GTK+ for at least a couple of years. It is probably also true that certain "heavy" widgets such as TextView and TreeView never benefit from conversion to a canvas-like model.

New capabilities I can quickly think of, all of which might be possible to retrofit into GtkWidget/GtkContainer themselves:
 - better layout
 - overlapping/alpha-blending
 - reduced overhead / more lightweight objects (speculative)
 - better containers replacing [HV]Box/Misc (see HippoCanvasBox and
   xalign, yalign, padding, border properties)
 - printing trees of items
 - general ability to draw an item to stuff other than the screen
 - support for nonrectangular items (e.g. a diagonal line)
 - nicer event system (e.g. easier enter/leave tracking, remove
   only-useful-for-toplevels stuff from main item interface)

In the end I'm guessing this is just too much work. At the same time, for some apps already we see that even a simple answer like HippoCanvas has important advantages over GtkWidget.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]