Re: RFC: Re-Design GtkStyle to only pass cairo-context?
- From: "Kalle Vahlman" <kalle vahlman gmail com>
- To: "Clemens Eisserer" <linuxhippy gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: RFC: Re-Design GtkStyle to only pass cairo-context?
- Date: Tue, 8 Jan 2008 09:42:29 +0200
2008/1/7, Clemens Eisserer <linuxhippy gmail com>:
> Hello Kalle,
>
> > I guess it could work if one derives a GtkCairoStyle from GtkStyle and
> > add the cairo-based API to that. That way casts to GtkStyle should
> > work and engines could implement the old api with the wrapper
> > approach.
> >
> > Or was that what you meant already?-)
> Not really, because as far as I understand this would break existing
> themes, wouldn't it? Would this tradeof be accepted, in favour of a
> cleaner API?
No, it won't break them since you can always use the derived class
like you would use the parent.
> The wrappers could be even implemented in GTK+ itself, removing legacy
> code from the themes.
>
> My idea was to re-implement the whole group of gtk_paint functions
> again as e.g. gtk_cairo_paint - and gtk calls still the old functions
> which are by default only wrappers to the new gtk_cairo_paint if the
> theme engine does not overwrite them (-> if it overwrites it, its an
> old theme engine and we don't use cairo). However this would not allow
> to pass cairo-contexts to the gtk_paint functions, to be honest your
> approach sounds much cleaner and better.
I've implemented a mockup of how this could go (attached):
gtkcairostyle.h:
gtkcairostyle.c:
GtkCairoStyle class to replace GtkStyle, doubles also as an
implementation for a cairo-using "theme" (implementing the
paint_slider method).
gtkcairostyle-test.c:
A test application that draws the slider graphics with either the
default style object or with the aforementioned cairo style, also
doubles as GTK+ by implementing the gtk_cairo_paint_slider() method.
The upper half is drawn in cairo way if possible and in old style if
not. The lower half is drawn with the old API regardless of the style
in use.
Looks to work fine, remember to CC me when you submit the patch to bugzilla ;)
Or is there a bug open for this?
--
Kalle Vahlman, zuh iki fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]