Also, in places where we're computing a new CssValue based on an
old one, make sure that if nothing changes we're returning a reference
to the old one, rather than creating a new identical instance.
It was problematic to maintain Raleigh going forward, as any
changes in it affected all themes. Also, its more robust if
each theme is a full standalone css rather than relying on
an inherited css base.
So, this changes Raleigh to a standalone theme that we can tweak
without accidentally breaking other themes, and makes the
default theme empty. In fact, we don't even add the default
provider anymore as its always empty.
The freeing the GResource in gtk_css_provider_reset caused problems
because it was called from gtk_css_provider_load_from_path() inside
gtk_css_provider_get_named(). We fix this by delaying the
setting of priv->resource until we successfully loaded the file.
This lets themes install a .gresource for efficient loading
of resources. This resource file will (if it exists) be automatically
loaded (mmaped) when the theme is used and unloaded when not used.
We don't want to include the whitespace after an import statement.
Because people tend to add newlines after @import, we report the wrong
lines for failed imports. And that's bad.
'window-unfocused' is too long and mentions "focus" which is historically
loaded with the meaning "input focus".
'backdrop' isn't generally used in GUI speak and still conveys the state the
widgets in an unfocused or background toplevel window are in.
We can't print shorthands, so don't try.
In particular, I want to get away from shorthands being representable
using GValue, and this function kinda requires that.
Passing the length of the widget path that is relevant is not necessary
anymore, it was only useful for inheritance. Instead, we now pass the
state flags and let the selector do the state matching for us.
We now use the GtkStleProviderPrivate interface, which hopefully is
faster and more conformant to CSS. Long term, it definitely should be
both.
I would have liked to split this up into multiple commits, but couldn't
find a way.
By default, a background image is stretched. Instead, it is worth to
have a tiled background.
This patch allows background surfaces to be repeated or not, and should
be compatible with future extensions and CSS.
https://bugzilla.gnome.org/show_bug.cgi?id=663522
- add gtkmodulesprivate.h and move stuff there from gtkprivate.h
- add gtkprivate.c and move stuff there from gtkmain.c
- add gtkwin32.c and move stuff there from gtkmain.c
- don't redefine GTK_DATADIR and friends in gtkprivate.h
- have _gtk_get_datadir() and friends on all platforms
- remove the horrid hacks where gtkprivate.h can't be included,
or must be included later due to redefinition of the compile-time
directories
Also create a separate section for values to associate the values with.
Finally, use this section information when delayed-parsing a widget
style property.
This struct keeps track of an area of text in a CSS file and uses it
when specifying information. Also, the cssprovider keeps track of
sections when parsing a file.
... and implement the CSS font properties:
- font-size
- font-style
- font-family
- font-weight
- font-variant
This is the second try at this. The first was backed out previously due
to bugginess. Let's hope this one survives a bit longer.
Also makes the font-family CSS test work again.
It's useful to set a slice size != border-width, as backgrounds are
clipped to border-width too.
As slices can be half-transparent and overlap the background,
this would not fill the border box properly if we only use a single
property for specifying the width.
Also, this brings us even closer to CSS3.
The hack in gtk_style_context_get_font() was causing segfaults in
combobox code. This is not acceptable and I'm not awake enough to fix
it, so just reverting until it's fixed sanely is easiest.
This reverts commit cf6bfbdb17.
... and take an optional style property as argument. This way, we can
allow custom parse functions for properties. The style property needs to
be optional so that we can use it for widget style properties, too.
Name it _gtk_style_property_print_value() and actually pass it the style
property. This way, we can later change it to use custom print functions
for different style properties.
The call to gtk_border_free() within unpack_border() felt completely
in the wrong place, as the border actually pertains to the GValue
being unpacked. Plus, the GValue itself was also being leaked.
In finalize(), clear all rulesets.
In parse_declaration(), Free the GValue under unhandled error situations.
In gtk_css_provider_load_internal(), Do not leak the file contents.
GValues stored in GtkCssRulesets are gslice managed, so don't
g_memdup() GValues from shorthand properties. This fixes
memory corruptions when reloading contents in a GtkCssProvider.
Shorthand properties are basically the same a in CSS. For storage in
style properties or the CSS provider, they are unpacked into the real
values, so it is possible to partially override them.
No properties are yet converted to the new world yet, this is just the
code for supporting them.