Re: 3.0 refactoring issues



On Sun, 2010-10-10 at 03:01 +0900, Tristan Van Berkom wrote:
> On Sat, 2010-10-09 at 13:18 -0400, Matthias Clasen wrote:
> > On Sat, Oct 9, 2010 at 2:56 AM, Tristan Van Berkom
> [...]
> > > And... please, please... if removing the expose completely
> > > is acceptable... can we then go ahead and remove ->size_request()
> > > as well ?
> > 
> > That is a fair question, I'd say, and we should consider it. One
> > question is how straightforward the conversion is.
> 
> The conversion is as simple as:
> 
>   a.) If you care about writing clean code, you break the request into
>       two separate APIs get_preferred_width & get_preferred_height
> 
>   b.) If you are in a hurry, you take your old size_request() vfunc
>       and invoke it for both calls to 
>       get_preferred_width() & get_preferred_height()
> 
> Option 'a' has the advantage of not calling the size_request twice
> and running a few extra calculations during requests (which is what
> happens now anyway for widgets that are not yet converted; ever since 
> we removed the ->requisition cache).
> 
> All in all I'd say, much more straightforward than converting old 
> expose functions to use new cairo drawing APIs.

*cough*, should have brought this up in the last meeting, however
another thing worthy of note here is that "size-request" signal
is unconditionally invoked for every request call (that is not
cached of course).

The reason we cant just have the default GtkWidgetClass vfunc invoke
"size-request" is because we have to expect that people outside GTK+
implement "size-request" on widgets they derived from widgets in GTK+
that do actually implement the vfuncs (i.e. GtkBin widgets mostly,
buttons etc... GTK+ even relies on this behaviour for things like
toggle-buttons).

As we know the whole size requesting process is heavy-duty enough,
removing size-request completely should be a big win in performance
of resizing widgets.

Cheers,
      -Tristan


> 
> Cheers,
>     -Tristan
> 
> PS: Sorry if my mail sounded over-dramatic.
> 
> I did find gdk_window_set_background_pattern() which 
> led me to cairo_pattern_create_for_surface()... however
> it was not clear to me from the cairo API docs if
> cairo_pattern_create_for_surface() was going to:
> 
>   a.) create a pattern from the surface (which would
>       in my case be created from a pixbuf)
> 
> or
> 
>   b.) create a pattern that is safe to use while
>       painting to the said surface it was created for
> 
> Even looking at the cairo docs again right now, it looks
> to me that the pattern is created *for* use with the 
> surface and not *from* the image data in the said surface.
> 
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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