RFC: Re-Design GtkStyle to only pass cairo-context?



Hello,

Many non-gtk applications are using GtkStyle to adjust their
appearance to the currently used GTK theme.
The current GtkStyle-function (gtk_paint_xyz()) take a GdkWindow as
parameter - however I saw many programs which instead passed a
GdkPixmap which also seemd to work (however as far as I understand
there is not any guarantee that it will work with all themes).

My idea would be to replace the GdkWindow in the gtk_paint_ functions
simply with a cairo-context, which could have the following
advantages:

- Cairo would allow to render to any surface supported by cairo - if
the themed application decides to render to an ARGB image buffer, even
alpha-values could be preserved (existing applications use ugly tricks
to do this).
- Transforms could be applied to the context before the drawing
happens, which would e.g. allow rotated buttons in firefox, etc.
- If applications cannot directly use the pixmap rendered to, for
whatever reason, using an system-memory image surface would remove the
need to readback data from X.
- Maybe less context creation, with some clever caching.

Theme and application backward compatibility could be implemented with
wrapper functions which create the cairo-context (for applications
which are not aware of the new API), or switch back to the old
theme-api if a old theme engine is detected (for old theme engines).

I would be really happy to get some feedback on this ...

Thank you in advance, lg Clemens


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