Commit Graph

27463 Commits

Author SHA1 Message Date
Benjamin Otte
ec34c4bd83 themingeninge: Handle translations properly
We want to keep the location of where to render, but transform th
context by the pango transform.
2011-05-22 05:56:12 +02:00
Benjamin Otte
03fbb1f34f label: Account for y-translation when rotating 2011-05-22 05:56:11 +02:00
Benjamin Otte
bd610582b8 tests: Add parser test for shorthands 2011-05-22 05:56:11 +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
70e654f1a5 stylepropertis: Use set_by_property() in set_valist()
... instead of duplicating code. This causes an extra g_value_copy().
If that turns out to be a performance issue, we can invent something
that handles this (like passing a gboolean take_value).

The reason for this duplication deletion is that we want to complicate
the setting code to handle shorthands by unpacking them and storing the
separate values.
2011-05-22 01:25:16 +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
b67ae42ecd styleproperties: Use peek_property() in get_valist() 2011-05-22 01:23:43 +02:00
Benjamin Otte
0a368fe622 styleproperties: Validate values when setting them
Note that validation is not necessary when resolving, because all values
are valid for those cases.
2011-05-22 01:23:36 +02:00
Benjamin Otte
e7db090620 styleproperties: Remove needless check 2011-05-21 22:49:43 +02:00
Benjamin Otte
b889f499a7 styleproperties: Use peek_property in get_property
... instead of duplicating the code.
2011-05-21 22:49:43 +02:00
Benjamin Otte
5f5cc79623 styleproperties: Adapt _gtk_style_properties_peek_property()
Optionally return the GtkStyleProperty that was looked up. This feature
isn't used yet, but will soon be.
2011-05-21 22:49:43 +02:00
Benjamin Otte
727a839d71 styleproperties: Move the style property handling code
... from gtkstyleproperties.c to gtkstyleproperty.c
2011-05-21 22:49:43 +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
e64b220791 stringfuncs: Remove _gtk_css_parse_url() from header
No code changes, just moving the function in the c file so it doesn't
need to be forward-declared.
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
Benjamin Otte
777a6846db styleproperties: Put gtk_style_property_lookup() in private header 2011-05-21 22:49:43 +02:00
Benjamin Otte
0f211f78a5 styleproperties: Class ref no longer necessary
Now that we initialize the pspecs on-demand, we can avoid the class ref.
2011-05-21 22:49:43 +02:00
Benjamin Otte
85e900b522 styleproperties: Init the default properties when they're needed
Instead of initing the default style properties in the class_init
func of the style properties, init them when they are first needed -
when they are queried or when new ones are registered.

That way, they will always be available.
2011-05-21 22:49:42 +02:00
Benjamin Otte
a2200e8971 styleproperties: constify gtk_style_property_lookup() 2011-05-21 22:49:42 +02:00
Benjamin Otte
1bd065fa4d styleproperties: Rename the storage struct for style pspecs
PropertyNode => GtkStyleProperty
2011-05-21 22:49:42 +02:00
Benjamin Otte
d7c9d8ce15 tests: Add forgotten file
File was forgotten in 8fd6bd323c
2011-05-21 22:48:52 +02:00
Diego Celix
ea79cd4314 gtk/gtkstatusbar: gtk_misc_set_alignment replacing
Replacing the function gtk_misc_set_alignment () with
gtk_widget_set_halign () and gtk_widget_set_valign () in
gtk/gtkstatusbar.c

https://bugzilla.gnome.org/show_bug.cgi?id=650664
2011-05-21 09:16:00 -04:00
Matthias Clasen
e578489579 Allow NULL permissions
This is useful in some scenarios.
2011-05-21 09:12:40 -04:00
Benjamin Otte
d333911d30 docs: Add missing <row> 2011-05-21 03:41:52 +02:00
Cosimo Cecchi
8c65d9181d themingengine: use the text-shadow property to render text shadow
This also avoids hardcoding a shadow for insensitive text in the engine,
as it can now be applied from the theme directly.

https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:49:54 -04:00
Cosimo Cecchi
73e0070774 shadow: add a method to paint the shadow for a PangoLayout
https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:49:54 -04:00
Cosimo Cecchi
c3f3e4a670 styleproperties: resolve properties of type GTK_TYPE_SHADOW
https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:49:50 -04:00
Cosimo Cecchi
016f540931 styleproperties: add a "text-shadow" style property
And document its use in the CSS parser gtk-doc.

https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:44:15 -04:00
Cosimo Cecchi
5b6253252e css: add a parser for GTK_TYPE_SHADOW properties
https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:44:12 -04:00
Cosimo Cecchi
fcc78bedc8 shadow: add a GtkShadow private type
This will be used as a base both for parsing text-shadow and box-shadow
properties. The type is private, as there's no real use in exporting
this in a public API.

https://bugzilla.gnome.org/show_bug.cgi?id=649314
2011-05-20 18:44:07 -04:00
Cosimo Cecchi
8301b24ee5 assistant: pack the sidebar in a frame instead of an event box
This has mostly two advantages:
- the most obvious one is the theme can render a border around the
  sidebar if it wants to.
- we also can avoid hardcoding a container border width for the sidebar,
  and just use a padding from the theme. This also allows different
  themes to define a different padding, etc.

The drawback is we must draw the background ourselves, but it's easy
enough.

https://bugzilla.gnome.org/show_bug.cgi?id=650530
2011-05-19 10:54:04 -04:00
Cosimo Cecchi
6bbb9d6f15 assistant: remove an useless gtk_widget_reset_style() call
It's not needed to call _reset_style() here, as we did not add the
widget to the parent container yet.

https://bugzilla.gnome.org/show_bug.cgi?id=650530
2011-05-19 10:54:01 -04:00
Benjamin Otte
3ecb308e56 menu: Only realize menu if it isn't realized yet
Lots of code calls gtk_menu_popup() and we don't want to resize the
window needlessly.
In this particular case, keyboard navigation to submenus caused those
submenus to shrink.

Note: I'm not sure this fix doesn't have nasty side effects, as I'm not
a specialist on menu popup code, so if it does, we'll need to revert it.
Until then, let's keep it, it fixes a bug.
2011-05-19 13:04:19 +02:00
Benjamin Otte
7a0600644c tests: Add missing CSS test 2011-05-19 03:16:03 +02:00
Carlos Garnacho
1b53741e4c gdk: Document gdk_window_add_filter()+XGenericEvents behavior 2011-05-18 22:34:33 +02:00
Carlos Garnacho
a529568f79 gdk: Get the right filter window for XI2 events
GdkDeviceManagerXI2 now implements GdkEventTranslator::get_window,
retrieving the right window from the contained XIEvent.
2011-05-18 22:34:33 +02:00
Carlos Garnacho
55cc9f3339 gdk: Add _gdk_x11_event_translator_get_window()
This method can be implemented by event translators so they
return the right window from XGenericEventCookie events, as
ev->xany.window isn't meaningful for these.

GdkEventSource now also uses this to find out the right window
filters to apply.
2011-05-18 22:34:33 +02:00
Carlos Garnacho
53d77a829a gdk: Move XGetEventData() call to GdkEventSource
This function should be called just once across every possible
event translator and GdkFilterFunc that wants to deal with
any cookie event.
2011-05-18 22:34:32 +02:00
Benjamin Otte
3410b14751 mac keys: Add a missing semicolon 2011-05-18 22:17:59 +02:00
Benjamin Otte
c3701c737c keys.css: Remove semicolons at end of rules
This is not CSS conform (it will break resync code after errors for
generic CSS parsers), so I deprecated the support for that semicolon.
2011-05-18 22:17:59 +02:00
Cosimo Cecchi
d392af2e36 reftests: Check that inherited properties work 2011-05-18 22:17:59 +02:00
Benjamin Otte
a1858c5454 cssprovider: When loading themes, don't pass in an error
We want to parse existing themes as well as possible instead of failing.
And the g_warning() is preserved.
2011-05-18 22:17:59 +02:00
Benjamin Otte
17e3d6f85e cssprovider: Don't propagate deprecation messages to passed-in error
It's an informative message, don't stop parsing the CSS because of it.
2011-05-18 22:17:59 +02:00
Benjamin Otte
d2ef71627b css: Make property parsing functions take a css parser
Instead of reading a string and then passing that in, let the parse
functions use the full power of the parser.
2011-05-18 22:17:59 +02:00
Benjamin Otte
03e84b7ee3 css: Move binding set parsing to strfuncs 2011-05-18 22:17:59 +02:00
Benjamin Otte
c73d1cf2a6 cssstringfuncs: Read colors as symbolic colors always
... and then try to resolve them, so static colors get resolved in
advance, just like it was before.
2011-05-18 22:17:58 +02:00
Benjamin Otte
9e18d8b448 symboliccolor: Allow props == NULL when resolving
If props == NULL in gtk_symbolic_color_resolve(), fail sanely for named
colors. The docs used to say it was not allowed to pass NULL for named
color, but that had problems:
1) You do not know if a color was created that way. This is especially
   hard for generic users (like language bindings).
2) It wasn't even true. Colors using other symbolic colors would also
   fail when trying to resolve their named colors, but the docs didn't
   say so.
And because I want to use the function to resolve static colors early
where possible, I changed things.
2011-05-18 22:17:58 +02:00
Benjamin Otte
8111d99183 cssprovider: Cache if rulesets have inheritable style properties
This provides a huge speedup as we only need to preprocess style
properties when they are indeed inherited. This roughly doubles the
performance of the CSS matcher and brings the time taken by
gtk_css_provider_get_style() from 19% to 7% in my favorite benchmark.
2011-05-18 22:17:58 +02:00
Benjamin Otte
82b340f6f0 cssprovider: Keep two hash tables per ruleset
One for the style properties, one for the widget style properties.
This way we can make one hash table by pspec which means we don't have
to repeat the pspec lookup.
2011-05-18 22:17:58 +02:00