Commit Graph

318 Commits

Author SHA1 Message Date
Stef Walter
d462f86aad GtkCssProvider: don't segfault when CSS file is not found
* Fix null dereference in gtk_css_provider_take_error()
 * And another in gtk_css_provider_emit_error()

https://bugzilla.gnome.org/show_bug.cgi?id=664537
2011-11-30 00:23:07 -05:00
Alexander Larsson
f59836a4d0 Build in default win32 css as gtk-win32 2011-11-18 16:54:04 +01:00
Rui Matos
70f87b8bd5 gtk: Add a GTK_STATE_FLAG_WINDOW_UNFOCUSED widget state flag
This allows themes to style widgets differently according to whether the
toplevel window they are in is presented as focused.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:33:22 +00:00
Marc-André Lureau
3b436eec6d css: start background-repeat
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
2011-11-08 11:10:44 -05:00
Michael Natterer
2688ccdbc4 gtk: clean up the private horror
- 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
2011-10-22 23:53:55 +02:00
Cosimo Cecchi
1f2cfb5619 all: add an 'only-child' pseudo-class selector
Add an :only-child pseudo-class selector, which selects single children
of a parent container.

https://bugzilla.gnome.org/show_bug.cgi?id=660833
2011-10-04 11:47:47 -04:00
Benjamin Otte
b01e20f1d1 cssprovider: Remove unused enums 2011-09-26 16:00:26 +02:00
Morten Welinder
9d96830571 cssprovider: Remove outdated docs 2011-09-22 21:44:05 +02:00
Dan Winship
e028a5c090 gtkcssprovider: fix a crash in gtk_css_provider_parsing_error
"info" was being declared in two different scopes, and the one that
was freed wasn't the one that was set.
2011-09-09 09:37:44 -04:00
Eitan Isaacson
6eb777a8af Change gtk_css_provider_propagate_error's signature.
Update to new parsing-error signal.

https://bugzilla.gnome.org/show_bug.cgi?id=657882
2011-09-02 09:19:18 -07:00
Benjamin Otte
26e9d07718 API: cssprovider: Change parsing-error signal
Instead of path, line and position, emit the section the error happened
in. This has a lot more information to consume.
2011-08-26 16:26:28 +02:00
Benjamin Otte
0d1b73f857 cssprovider: Store sections with parsed values
Also create a separate section for values to associate the values with.
Finally, use this section information when delayed-parsing a widget
style property.
2011-08-26 16:26:27 +02:00
Benjamin Otte
ebf0b6ee4d cssprovider: Handle non-NULL-terminated data
Do a dumb copy if that happens.
2011-08-26 16:26:27 +02:00
Benjamin Otte
d985b95ef9 cssprovider: Keep only the curent section while parsing
We don't need a list of sections, the section can give us the parent
when we need it (d'oh).
2011-08-26 16:26:27 +02:00
Benjamin Otte
19c44967cb cssprovider: Remove dead code
The code isn't used anymore since the introduction of rulesets.
2011-08-26 16:26:27 +02:00
Benjamin Otte
00d14e3515 API: css: Add GtkCssSection
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.
2011-08-26 16:26:27 +02:00
Benjamin Otte
5a1f371e12 cssprovider: Fix names for first and last child pseudo class
The correct name is :first-child, not :first
2011-07-21 02:43:53 +02:00
Benjamin Otte
1a763044fe cssprovider: Emit an error when parsing a binding fails 2011-07-20 02:36:44 +02:00
Benjamin Otte
b8465d289b cssprovider: Get the location right for semicolon warnings 2011-07-20 02:36:44 +02:00
Benjamin Otte
5eefc37b3f cssprovider: @import <string> is valid CSS
The parser rewrite insisted on @import url(<string>) syntax, but CSS
xplicitly allows omitting the url string.
2011-07-20 02:36:44 +02:00
Benjamin Otte
0d253b67f4 css: Make font property a shorthand
... 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.
2011-06-15 12:52:53 +02:00
Benjamin Otte
3aa73bebea styleproperty: Add border-*-color style properties
And make border-color a shorthand
2011-06-13 15:01:52 +02:00
Benjamin Otte
287069ca3c default theme: Fix menuitem check/radio colors 2011-06-12 23:35:39 +02:00
Benjamin Otte
3712ec71d4 default theme: fix menuitem selections 2011-06-12 23:28:43 +02:00
Benjamin Otte
d7598aabe3 default theme: fix tooltip colors 2011-06-12 23:26:53 +02:00
Cosimo Cecchi
1539ade9d5 cssprovider: add a doc paragraph about box-shadow 2011-06-11 09:29:43 +02:00
Cosimo Cecchi
3d1407a01a border-image: add support for border-image-width too
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.
2011-06-09 20:01:57 -04:00
Cosimo Cecchi
a2a8d3e8f4 docs: expand the docs for border-image
https://bugzilla.gnome.org/show_bug.cgi?id=651194
2011-06-09 05:51:54 +02:00
Benjamin Otte
2e6bb2a0c9 Revert "css: Make font property a shorthand"
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.
2011-06-02 02:31:44 +02:00
Benjamin Otte
a659143d55 docs: There is no font-name style property
It's "font"
2011-06-02 02:03:52 +02:00
Benjamin Otte
fd4ffbb6da styleproperty: Add _gtk_style_property_is_inherit()
And use it instead of gtk_style_param_get_inherit()
2011-06-02 02:03:52 +02:00
Benjamin Otte
cf6bfbdb17 css: Make font property a shorthand
... and implement the CSS font properties:
- font-size
- font-style
- font-family
- font-weight
- font-variant
2011-06-02 02:03:52 +02:00
Benjamin Otte
0aa07c6fd6 cssprovider: Remove colors when resetting 2011-06-02 02:03:52 +02:00
Benjamin Otte
d0e1e2b103 css: Move property parsing into styleproperty file
Just shuffles code around for parsing properties.
2011-06-02 02:03:50 +02:00
Benjamin Otte
5a42464547 css: Rename function to _gtk_style_property_parse_value()
... 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.
2011-06-02 02:03:50 +02:00
Benjamin Otte
35488f5846 css: Rename struct variable
I want to add parse_func as something different soon.
2011-06-02 02:03:50 +02:00
Benjamin Otte
3e7f74c456 styleproperty: Change _css_value_to_string()
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.
2011-06-02 02:03:50 +02:00
Matthias Clasen
0b9cd78017 Add annotations to gtk_css_provider_load_from_data
https://bugzilla.gnome.org/show_bug.cgi?id=646859
2011-05-31 20:37:43 -04:00
Carlos Garnacho
20433efbfa gtkcssprovider: Free shorthand border GValues in the right place
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.
2011-05-30 19:29:22 +02:00
Carlos Garnacho
2c8e01dc80 gtkcssprovider: plug several leaks
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.
2011-05-30 19:26:28 +02:00
Carlos Garnacho
747dc65c2c gtkcssprovider: Use g_slice_dup() to copy GValues around
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.
2011-05-30 19:13:36 +02:00
Benjamin Otte
7de5a4e08d cssprovider: Don't convert widget style properties to CSS
They are still CSS, so converting them is wrong.
2011-05-23 15:56:09 +02:00
Benjamin Otte
7836df29cb cssprovider: Use right hash table when printing
If the CSS provider had widget style properties, printing them would
crash since 82b340f6f0
2011-05-23 15:56:09 +02:00
Benjamin Otte
21236cf270 style: Make margin a shorthand
... and add the real properties:
- margin-top
- margin-left
- margin-bottom
- margin-right
2011-05-22 05:56:12 +02:00
Benjamin Otte
a35aa96149 style: Make padding a shorthand
... and add the real properties:
- padding-top
- padding-left
- padding-bottom
- padding-right
2011-05-22 05:56:12 +02:00
Benjamin Otte
f5c7cefcca style: Convert border-width to a shorthand
Add the corresponding properties it refers to, too:
- border-top-width
- border-left-width
- border-bottom-width
- border-right-width
2011-05-22 05:56:11 +02:00
Benjamin Otte
42a4bd1c5b style: Add support for shorthand properties
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.
2011-05-22 01:25:17 +02:00
Benjamin Otte
73c39f5b16 styleproperties: Add _gtk_style_properties_set_property_by_property()
... as a replacement for _gtk_style_properties_set_property_by_pspec().
We'll need that to handle shorthands.
2011-05-22 01:25:16 +02:00
Benjamin Otte
5eca8f8275 css: Rename gtkcssstrfuncs file to gtkstyleproperty
The idea is to handle the style property registering etc in this file
instead of the styleproperties file. The next commits will move those
files.
2011-05-21 22:49:43 +02:00
Benjamin Otte
548a1302ee cssprovider: Use _gtk_style_property_lookup()
This way we get the actual data node and can use it.
2011-05-21 22:49:43 +02:00