Re: gtk-style-context notes



On Thu, 2010-10-14 at 12:19 +0200, Carlos Garnacho wrote:
> Hi Benjamin :),
> 
> On Wed, 2010-10-13 at 18:40 +0200, Benjamin Berg wrote:
> > Hello,
> > 
> > So, some notes about the gtk-style-context branch.
> 
> Thanks for reviewing the branch. FYI, I'm currently in the process of
> documenting the changes, I was planning to send a mail here once there's
> some docs that cover the different aspects.

One other aspect I'd like to mention is the theme engine API. Currently
it's possible for theme engines to hook into the gtkrc parsing and add a
custom parser. I noticed that there is a function that allows theme
engines to register new properties, but how would a theme engine like
the pixbuf engine be able to parse custom syntax?

Also, some engines (such as the windows engine, see msw_style.c) want to
set style property values based on platform API calls. Currently this
has to be done by constructing a string and calling gtk_rc_parse_string.
Will there be an better way to do this in the style-context branch?


> > 
> > The gtk-style-context branch mirrors the current drawing functions very
> > closely. I know that this requires quite some work, but there are some
> > things that can easily be changed now:

We've talked in the past about moving away from abstract drawing
functions to more widget focused functions. This would help custom
widgets that want to mimic existing widgets and it would also make it
easier for other toolkits to mimic GTK+. What are your thoughts on this?


> >  * Make focus just a simple flag (that can also be checked from the CSS)
> 
> There is GTK_STATE_FLAG_FOCUSED in GtkStateFlags, it can already be used
> as any other state flag (including transition animations), but you are
> right in that this isn't hooked to the CSS parser yet, should be matter
> of adding a new scanner symbol in gtkcssprovider.c, create_scanner().

If there is a flag for focused widgets, would this mean you could remove
the "render_focus" function? Or would this function just be omitted from
widgets that support the focus flag?


> > 
> > It may be possible to get rid of the text/base vs. fg/bg color pairs,
> > and instead just use one set of colors with different values depending
> > on the widgets (ie. any "input" widget like GtkEntry, GtkTextView,
> > GtkTreeView would get a white background, while the rest is gray).
> 
> I've been thinking back and forth about that. As far as I can see,
> mostly depends on what the plans are for GtkStyle if this branch gets
> merged in, If we only have GtkStyleContext, we can have per-class and
> per-region styling, so for example a spinbutton can use different colors
> when rendering the entry than the buttons and we could do away with just
> fg/bg.
> 
> If GtkStyle is to stay for easier compatibility, we still need
> meaningful data in the GtkStyle struct, or we'll screw up any widget
> external to GTK+ wanting text/base.

It's quite common for developers to use the wrong combination of colours
(e.g. using text and bg together), so it would be great if they could be
consolidated. If GtkStyle needs to stay for compatibility, maybe one of
the colour pairs could be generated using some heuristics?


Regards,

Thomas




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