Commit Graph

27403 Commits

Author SHA1 Message Date
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
Benjamin Otte
399a439103 cssprovider: Add a new setter for rulesets
We now have set-by-pspec (which is used for normal style properties) and
set-by-name (which is used by widget properties).
2011-05-18 22:17:58 +02:00
Benjamin Otte
0318ab2ce1 cssprovider: Refactor handling of rulesets
Keep rulesets as an on-stack/heap structure instead of allocating all
instances separately.
Also, pass a ruleset to the ruleset parser, so we can make the ruleset
parser do lots of fancy things that might be useful for performance.
2011-05-18 22:17:58 +02:00
Benjamin Otte
151294576d cssprovider: Refactor code to have a gtk_css_ruleset_matches() 2011-05-18 22:17:58 +02:00
Benjamin Otte
71c748b47e cssprovider: Rename "SelectorStyleInfo" to "Ruleset"
No code changes, just clarification of the name
2011-05-18 22:17:58 +02:00
Benjamin Otte
b37f9fdf81 css: Implement inherit properties
Huge performance hit (slows down things roughly by a factor of 3), but
necessary for CSS conformance and for implementing "inherit" and
percentages.
2011-05-18 22:17:58 +02:00
Benjamin Otte
25c396409c reftests: Check style property order
Ensure that style properties are read in the correct order, by having a
property twice with vastly different values.
2011-05-18 22:17:58 +02:00
Benjamin Otte
c1dc3e9372 css: Refactor code to do property lookups earlier
We want to ook up the property in the CSS parser, so we can do fancy
things with it. We currently don't but we want to later.
2011-05-18 22:17:57 +02:00
Benjamin Otte
82399bf457 styleproperties: Speed up by not optimizing
g_quark_try_string() takes a lock and then does a hashtable lookup. So
just using a string hash table for properties is faster.
2011-05-18 22:17:57 +02:00
Benjamin Otte
4c92fb2b5d styleproperties: Speed up style_property_lookup()
Use the already existing bsearch version instead of iterating the array
manually.
2011-05-18 22:17:57 +02:00
Benjamin Otte
beba515243 styleproperties: Use the pspec as the hash table key
The code used the quarked name before, but when we already have the
pspec we want to have a lookup that does not involve quarking. And
lookup is equally fast if we only have the name.
2011-05-18 22:17:57 +02:00