]> Pileus Git - ~andy/gtk/log
~andy/gtk
11 years agocss: Speed up name matching
Alexander Larsson [Mon, 10 Dec 2012 11:57:10 +0000 (12:57 +0100)]
css: Speed up name matching

We use the new g_type_get_type_registration_serial() so that we can
cache and properly invalidate the result of g_type_from_name().

This bumps the glib requirement to 2.35.3 to get the new function.

https://bugzilla.gnome.org/show_bug.cgi?id=689847

11 years agocss: Clean up tree_match implementations
Alexander Larsson [Mon, 10 Dec 2012 11:28:44 +0000 (12:28 +0100)]
css: Clean up tree_match implementations

A bunch of repeated code is broken out into the helper
gtk_css_selector_tree_match_previous().

11 years agocss: Do get_change directly on the tree without matching first
Alexander Larsson [Mon, 10 Dec 2012 10:27:43 +0000 (11:27 +0100)]
css: Do get_change directly on the tree without matching first

Rather than first collecting matches and then getting the change
for them we do the change collection directly on the tree. This
is about twice as fast.

11 years agocss: Factor out some of the position matching code
Alexander Larsson [Fri, 7 Dec 2012 17:55:49 +0000 (18:55 +0100)]
css: Factor out some of the position matching code

11 years agoAdd missing NULL-check in GtkEntryAccessible
Mario Sanchez Prada [Sun, 9 Dec 2012 10:49:35 +0000 (11:49 +0100)]
Add missing NULL-check in GtkEntryAccessible

Only call to atk_object_set_name if gtk_entry_get_icon_name() is not NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=689923

11 years agoUpdated Spanish translation
Daniel Mustieles [Sat, 8 Dec 2012 18:50:40 +0000 (19:50 +0100)]
Updated Spanish translation

11 years agoFix build by un-translating org.gtk.Settings.FileChooser
Colin Walters [Fri, 7 Dec 2012 19:05:58 +0000 (14:05 -0500)]
Fix build by un-translating org.gtk.Settings.FileChooser

At the moment, gtk+ doesn't depend on intltool, which is the program
that knows how to translate schemas.  Attempting to translate them
causes a build failure, so for now, let's leave them in en_US.

https://bugzilla.gnome.org/show_bug.cgi?id=689584

11 years agoAdd summary and description to "show-hidden" key
Timothy Arceri [Mon, 3 Dec 2012 20:59:49 +0000 (07:59 +1100)]
Add summary and description to "show-hidden" key

https://bugzilla.gnome.org/show_bug.cgi?id=689584

11 years agoscale: render scale mark lines with separator style class
Cosimo Cecchi [Fri, 7 Dec 2012 16:41:03 +0000 (11:41 -0500)]
scale: render scale mark lines with separator style class

So that the theme can distinguish them from the mark text.

11 years agobuild: fix some GCC warnings
Cosimo Cecchi [Fri, 7 Dec 2012 16:34:49 +0000 (11:34 -0500)]
build: fix some GCC warnings

11 years agoquartz: fix crash in the recent clipboard "fix", and really fix it
Michael Natterer [Fri, 7 Dec 2012 11:19:52 +0000 (12:19 +0100)]
quartz: fix crash in the recent clipboard "fix", and really fix it

We must not release the GtkClipboardOwner in pasteboardChangedOwner
becaue we don't own a reference to ourselves (NSPasteboard does).
Instead, release the owner right after setting it, transferring
ownership to NSPasteboard

Also, fix repeated setting of the same owner by keeping the
owner around in GtkCLipboard, and re-use it if "user_data"
doesn't change. To avoid clipboard_unset()ting our own contents
in the process, add an ugly "setting_same_owner" boolean to
GtkClipboardOwner, set it during re-setting the same owner,
and avoid calling clipboard_unset() from pasteboardChangedOwner
if it's TRUE.
(cherry picked from commit 4a8df7a33c298d22bf78b947d0e861fc03ec70e1)

11 years agogtkcssselector: Fix build
Jasper St. Pierre [Thu, 6 Dec 2012 22:48:11 +0000 (17:48 -0500)]
gtkcssselector: Fix build

destroy vs. free strikes again

11 years agogtkcssselector: Don't leak the hash table
Jasper St. Pierre [Thu, 6 Dec 2012 22:38:06 +0000 (17:38 -0500)]
gtkcssselector: Don't leak the hash table

We should probably free the memory we allocate. Sounds like a winning
strategy.

11 years agotreeview: Don't invalidate whole tree unless needed
Alexander Larsson [Thu, 6 Dec 2012 21:28:11 +0000 (22:28 +0100)]
treeview: Don't invalidate whole tree unless needed

We currently invalidate the whole tree every time the style state
changes in the tree view. The primary reason for this is to catch
default font changes as that may affect text cell renderers. But
cell renderers could *potentially* also read other style properties
(although that seems weird and unlikely).

We handle this by invalidating only when some state that affects sizes
is changed. This includes all the font properties.

11 years agotextview: Only clear the layout in style_update if the font actually changes
Alexander Larsson [Thu, 6 Dec 2012 20:16:19 +0000 (21:16 +0100)]
textview: Only clear the layout in style_update if the font actually changes

11 years agocss: Add _gtk_css_style_property_affects_font
Alexander Larsson [Thu, 6 Dec 2012 20:14:02 +0000 (21:14 +0100)]
css: Add _gtk_css_style_property_affects_font

This checks if a style_update affects the font.

11 years agoentry: No need to reset layouts on style_updated
Alexander Larsson [Thu, 6 Dec 2012 18:52:35 +0000 (19:52 +0100)]
entry: No need to reset layouts on style_updated

With pango handling changes to the PangoLayout there now is no
style changes that can affect the layout for the entry, so we don't
have to reset the layout whenever the style is updated.

11 years agoGtkLabel: Rely on the new pango support for context change tracking
Alexander Larsson [Wed, 5 Dec 2012 13:51:23 +0000 (14:51 +0100)]
GtkLabel: Rely on the new pango support for context change tracking

Now that Pango tracks changes to the context automatically there is
no need to do it manually in e.g. style-updated or direction-changed,
in fact the only case we have to care about is when we re-create
the PangoContext due to a screen change, so we only have to clear
the layouts in GtkLabel in screen-changed.

This means we're not clearing all the layouts whenever the state changes,
which happens to every widget when the window is unfocused, which helps
performance a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=340066

11 years agoRequire new pango with automatic tracking of PangoContext changes
Alexander Larsson [Thu, 6 Dec 2012 18:50:47 +0000 (19:50 +0100)]
Require new pango with automatic tracking of PangoContext changes

Pango 1.32.4 has a feature where any PangoLayout automatically handles
the case where a PangoContext is changed. We want to rely on this to
avoid having to clear layouts too often, so we make this a hard dep.

11 years agostylecontext: Deprecate gtk_style_context_get_font()
Benjamin Otte [Thu, 6 Dec 2012 01:55:22 +0000 (02:55 +0100)]
stylecontext: Deprecate gtk_style_context_get_font()

This is for a very simple reason: The getter is returning a const value
and the font isn't const anymore. So we need to store the font
description somewhere but we can't reuse it as it's changing all the
time (yay animations, yay inherited values). Sucks.

So keep the hack in here but deprecate the function.

11 years agoswitch: Remove hack to change text size
Benjamin Otte [Thu, 6 Dec 2012 01:54:18 +0000 (02:54 +0100)]
switch: Remove hack to change text size

The same effect can now be achieved via
  .switch { font-size: smaller; }
so there is no need to hardcode things.

11 years agogtk: Query font size directly
Benjamin Otte [Thu, 6 Dec 2012 01:53:43 +0000 (02:53 +0100)]
gtk: Query font size directly

... instead of calling gtk_style_context_get_font() and then
pango_font_description_get_size().

11 years agogtk: Use gtk_style_context_get()
Benjamin Otte [Thu, 6 Dec 2012 01:51:04 +0000 (02:51 +0100)]
gtk: Use gtk_style_context_get()

... instead of soon-to-be-deprecated gtk_style_context_get_font().

11 years agogtk: Use context's font
Benjamin Otte [Thu, 6 Dec 2012 01:47:24 +0000 (02:47 +0100)]
gtk: Use context's font

Instead of using gtk_style_context_get_font() in
pango_context_get_metrics(), use pango_context_get_font_description().
The context contains the font description we are about to use after all.

11 years agotests: Don't call to-be-deprecated function
Benjamin Otte [Thu, 6 Dec 2012 01:30:57 +0000 (02:30 +0100)]
tests: Don't call to-be-deprecated function

11 years agoaboutdialog: Add text tag to get small text
Benjamin Otte [Thu, 6 Dec 2012 01:18:58 +0000 (02:18 +0100)]
aboutdialog: Add text tag to get small text

This is to get rid of gtk_widget_override_font() and
gtk_style_context_get_font().

FIXME: This should probably be done by the theme somehow?

11 years agostylecontext: Always recompute font
Benjamin Otte [Wed, 5 Dec 2012 17:41:40 +0000 (18:41 +0100)]
stylecontext: Always recompute font

This is necessary  because values in a GtkCssComputedValues can change
now. So if the font-size is inherited or animated, the cached value will
be outdated.

Fixes the fontchooser preview not updating.

11 years agoUpdated Spanish translation
Daniel Mustieles [Wed, 5 Dec 2012 19:10:39 +0000 (20:10 +0100)]
Updated Spanish translation

11 years agoUpdated Spanish translation
Daniel Mustieles [Wed, 5 Dec 2012 19:10:27 +0000 (20:10 +0100)]
Updated Spanish translation

11 years agotreemodelfilter: Make the constructor binding friendly
Jasper St. Pierre [Mon, 16 Jul 2012 01:14:33 +0000 (21:14 -0400)]
treemodelfilter: Make the constructor binding friendly

This means reffing the root in the set property implementation,
rather than in the constructor. We don't need to unref the root
on set, as it's a CONSTRUCT_ONLY property.

https://bugzilla.gnome.org/show_bug.cgi?id=680065

11 years agoGdkBroadwayDisplay: include proper port number in error trace
Aleksander Morgado [Wed, 5 Dec 2012 10:15:42 +0000 (11:15 +0100)]
GdkBroadwayDisplay: include proper port number in error trace

11 years agoGdkBroadwayDisplay: initialize GError before using it
Aleksander Morgado [Wed, 5 Dec 2012 10:15:11 +0000 (11:15 +0100)]
GdkBroadwayDisplay: initialize GError before using it

11 years agoRevert "Don't queue resize for hidden widgets without a size group"
Alexander Larsson [Tue, 4 Dec 2012 20:26:37 +0000 (21:26 +0100)]
Revert "Don't queue resize for hidden widgets without a size group"

This seems to break redraw of the middle pane in glade.

This reverts commit faaae520c98af1c27ca1e97ca8f33655ec6b575e.

11 years agoDon't unnecessarily queue resize in GtkWindow.style_updated
Alexander Larsson [Tue, 4 Dec 2012 15:38:23 +0000 (16:38 +0100)]
Don't unnecessarily queue resize in GtkWindow.style_updated

GtkWindow always queues a resize on style updates if there is
a grip, because it may have been the grip size style properties
that changed. However, even if it *were*, and it likely wasn't
that would not affect the windows size request, so no need
to queue a resize.

11 years agoDon't queue resize for hidden widgets without a size group
Alexander Larsson [Tue, 4 Dec 2012 15:53:06 +0000 (16:53 +0100)]
Don't queue resize for hidden widgets without a size group

queue_resize basically tells the parent widget that it may need
to pick a different size/layout. However, for a hidden child widget
that should never be needed. It may be that the widget is in a
sizegroup that has ignore_hidden == FALSE though, so it may
affect the size group calculations.

However, if a widget is not visible and not in a size group then
its safe to avoid the resize, as the widget will be resized on
becoming visible anyway.

This avoids a lot of size allocation for hidden things like menus
and tooltips.

11 years agocss: Avoid queue_resize in _gtk_widget_style_context_invalidated
Alexander Larsson [Tue, 4 Dec 2012 15:36:37 +0000 (16:36 +0100)]
css: Avoid queue_resize in _gtk_widget_style_context_invalidated

We've already emitted style_updated, and the handler for that queues
a resize if necessary.

11 years agocss: Avoid allocations in gtk_css_value_array_compute
Alexander Larsson [Mon, 3 Dec 2012 13:30:37 +0000 (14:30 +0100)]
css: Avoid allocations in gtk_css_value_array_compute

Almost all array computations lead to no changes (99% in nautilus)
so we avoid the upfront allocation and delay it until we know its
needed. This drops the allocate/free from the profile.

11 years agocss: Start array allocation with a better size
Alexander Larsson [Mon, 3 Dec 2012 13:29:40 +0000 (14:29 +0100)]
css: Start array allocation with a better size

All computed values will compute all normal properties at least, so
we might as well allocate these upfront, which leads to a lot less
reallocations.

11 years agocss: Use internal return_if_fail in some commonly called code
Alexander Larsson [Mon, 3 Dec 2012 12:26:16 +0000 (13:26 +0100)]
css: Use internal return_if_fail in some commonly called code

These are internal apis, and any external issues should have been
caught by checks at public API points. We use the internal checks
here because these checks show up in a non-neglible way on profiles.

11 years agoAdd internal versions of g_return_[val_]_if_fail
Alexander Larsson [Mon, 3 Dec 2012 12:25:14 +0000 (13:25 +0100)]
Add internal versions of g_return_[val_]_if_fail

These are only enabled on debug=yes, so not by default
in released tarballs.

11 years agopo: Fix xgettext failing on unicode strings
Rico Tzschichholz [Tue, 4 Dec 2012 19:06:19 +0000 (20:06 +0100)]
po: Fix xgettext failing on unicode strings

It is needed to use -from-code=utf-8 to override the ASCII default

Caused by ceb866dfe6be6d88b8f83a3cbdb8a2a688419c82

11 years agoreftests: Fix wrong name in test
Benjamin Otte [Tue, 4 Dec 2012 19:01:45 +0000 (20:01 +0100)]
reftests: Fix wrong name in test

Typo in d8306aaeb3376d6d11a05b46171300a2b5747606

11 years agocss: Return 0 as change for the GtkSettingsStyleProvider
Alexander Larsson [Tue, 4 Dec 2012 18:56:18 +0000 (19:56 +0100)]
css: Return 0 as change for the GtkSettingsStyleProvider

11 years agoprinting: Call mark_printer_active() with correct parameters
Marek Kasik [Tue, 4 Dec 2012 14:48:08 +0000 (15:48 +0100)]
printing: Call mark_printer_active() with correct parameters

Revert the second part of the commit
6ad6f719c6b2fc7cf797c86b406f4e61d9fca4d1. mark_printer_active()
was called without its second parameter in g_list_free_full().

11 years agoBug 626499 - GtkClipboard unnotified on change of OS X pasteboard owner
Michael Natterer [Tue, 4 Dec 2012 13:31:13 +0000 (14:31 +0100)]
Bug 626499 - GtkClipboard unnotified on change of OS X pasteboard owner

pasteboardChangedOwner is not called as reliably as we'd want to get it,
so keep track of [pasteboard changeCount] and drop clipboard ownership
when a change happened. Also better unset the clipboard content redundantly
in a few places rather than missing one, and reorder the code in
gtk_clipboard_set_contents() so that the new aggressive unsetting
won't unset the clipboard under our feet when we call
[pasteboard declareTypes].
(cherry picked from commit f2b74db5dcbd28a1e27431f413c66d2a5d50b2bd)

11 years agoEnsure GtkColorButton has a dialog when adding a palette
Pierre-Yves Luyten [Mon, 3 Dec 2012 22:46:18 +0000 (23:46 +0100)]
Ensure GtkColorButton has a dialog when adding a palette

https://bugzilla.gnome.org/show_bug.cgi?id=132333

11 years agogtkroundedbox: Fix a compiler warning
Kalev Lember [Sat, 1 Dec 2012 13:36:13 +0000 (14:36 +0100)]
gtkroundedbox: Fix a compiler warning

Use the correct enum type.

11 years agoUpdated POTFILES.skip
Piotr DrÄ…g [Sat, 1 Dec 2012 20:22:00 +0000 (21:22 +0100)]
Updated POTFILES.skip

11 years agocss: Fix order of enum
Benjamin Otte [Sat, 1 Dec 2012 17:01:39 +0000 (18:01 +0100)]
css: Fix order of enum

We switched around the order in gtkcssenumvalue.h, we need to switch
this order, too. Otherwise the parsing code will go bonkers.

11 years agoreftests: Add a test for the new font size names
Benjamin Otte [Sat, 1 Dec 2012 15:25:10 +0000 (16:25 +0100)]
reftests: Add a test for the new font size names

11 years agocssvalue: Fix the scaling factors for 'smaller' and 'larger'
Benjamin Otte [Sat, 1 Dec 2012 15:23:08 +0000 (16:23 +0100)]
cssvalue: Fix the scaling factors for 'smaller' and 'larger'

They were reversed. Looks like a bad case of copy/paste failure.

11 years agocssvalue: Parse font sizes properly
Benjamin Otte [Sat, 1 Dec 2012 15:22:04 +0000 (16:22 +0100)]
cssvalue: Parse font sizes properly

As the last CSS property, font-size now is a proper number (when it's
not a keyword).

11 years agocssvalue: Change order of values
Benjamin Otte [Sat, 1 Dec 2012 15:20:47 +0000 (16:20 +0100)]
cssvalue: Change order of values

This is necessary so that the (rather stupid) parsing code doesn't parse
"small" and then is happy when it should instead parse "smaller".

11 years agocss: Fix dependencies for font lookup
Benjamin Otte [Sat, 1 Dec 2012 13:00:24 +0000 (14:00 +0100)]
css: Fix dependencies for font lookup

'larger' and 'smaller' depend on the parent value. D'oh.

11 years agogtkliststore: Add explicit braces to avoid dangling else
Kalev Lember [Sat, 1 Dec 2012 12:58:41 +0000 (13:58 +0100)]
gtkliststore: Add explicit braces to avoid dangling else

Otherwise the following else becomes attached to the wrong if.

11 years agocss: Add more features to font-size code
Benjamin Otte [Sat, 1 Dec 2012 13:00:24 +0000 (14:00 +0100)]
css: Add more features to font-size code

We now support the keywords (like xx-small, medium, larger, smaller...)
and I've changed the default value to be "medium".

This required some shuffling of the "get default font size" code. But
all is well now.

11 years agocss: Move default font handling
Benjamin Otte [Sat, 1 Dec 2012 00:49:06 +0000 (01:49 +0100)]
css: Move default font handling

The default font is no longer handled like a custom style sheet that
overrides everything, but as the initial value. This is the same
behavior as in web browsers.

And it allows the theme to actually use the 'font-family' and
'font-size' properties. Of course, a well behaved theme will respect the
setting as much as possible and for example use relative font sizes
(which aren't yet supported, but will be soon).

11 years agostyle: Add _gtk_style_provider_private_get_settings()
Benjamin Otte [Sat, 1 Dec 2012 00:24:12 +0000 (01:24 +0100)]
style: Add _gtk_style_provider_private_get_settings()

This gives a GtkSettings object for resolving system-dependant things -
like the default font family and font size.
No code does this yet, but we have an API.

Only GtkSettings implements this.

11 years agosettings: Implement StyleProvider interface without StyleProperties
Benjamin Otte [Fri, 30 Nov 2012 23:56:12 +0000 (00:56 +0100)]
settings: Implement StyleProvider interface without StyleProperties

I want to deprecate GtkStyleProperties.

11 years agosettings: Never override some font properties
Benjamin Otte [Fri, 30 Nov 2012 23:18:01 +0000 (00:18 +0100)]
settings: Never override some font properties

According to the CSS specification, everything but font-size and
font-family are defined by CSS. So we don't override them anymore.

11 years agoAPI: Deprecate functions to register custom CSS properties
Benjamin Otte [Fri, 30 Nov 2012 21:45:20 +0000 (22:45 +0100)]
API: Deprecate functions to register custom CSS properties

We should slowly transition code to using the GTK-provided CSS. So here
we go.

11 years agostylecontext: Remove unused private functions
Benjamin Otte [Fri, 30 Nov 2012 21:41:22 +0000 (22:41 +0100)]
stylecontext: Remove unused private functions

11 years agocssstyleproperty: Don't mark border width properties as NO_RESIZE
Benjamin Otte [Fri, 30 Nov 2012 19:41:58 +0000 (20:41 +0100)]
cssstyleproperty: Don't mark border width properties as NO_RESIZE

I was to overeager when marking properties in
66d22f101d32630aa3f030585a948d17deb91f4a apparently.

11 years agowidget: Optimize away unndeeded redraws
Benjamin Otte [Fri, 30 Nov 2012 19:40:18 +0000 (20:40 +0100)]
widget: Optimize away unndeeded redraws

If only styles were updated that don't require resizes, don't queue one.

11 years agostyleproperty: Add _gtk_css_style_property_changes_affect_size()
Benjamin Otte [Fri, 30 Nov 2012 19:37:46 +0000 (20:37 +0100)]
styleproperty: Add _gtk_css_style_property_changes_affect_size()

This gives fast access to the question of wether a style update requires
a resize.

11 years agostylecontext: Expose a function to get at the current changes
Benjamin Otte [Fri, 30 Nov 2012 19:36:57 +0000 (20:36 +0100)]
stylecontext: Expose a function to get at the current changes

11 years agostyleproperty: Mark properties as not needing resizes
Benjamin Otte [Fri, 30 Nov 2012 18:00:23 +0000 (19:00 +0100)]
styleproperty: Mark properties as not needing resizes

11 years agostyleproperty: Add an affects-size property
Benjamin Otte [Fri, 30 Nov 2012 17:57:56 +0000 (18:57 +0100)]
styleproperty: Add an affects-size property

This property will be used to avoid gtk_widget_queue_resize() calls in
favor of gtk_widget_queue_draw().

11 years agostylecontext: Pass a bitmask to the changed values
Benjamin Otte [Fri, 30 Nov 2012 12:58:11 +0000 (13:58 +0100)]
stylecontext: Pass a bitmask to the changed values

11 years agoreftests: Fix a reftest
Benjamin Otte [Fri, 30 Nov 2012 13:57:02 +0000 (14:57 +0100)]
reftests: Fix a reftest

Recent Adwaita changes caused diffs. We don't want that, so we run this
test against the default settings.

11 years agoicon cache: Fix double free
Alexander Larsson [Fri, 30 Nov 2012 15:18:14 +0000 (16:18 +0100)]
icon cache: Fix double free

The symbolic icon cache code free crashed with a double free
due to a missing ->next in the loop.

11 years agogtk: convert keyvals to unicode before committing to the imcontext
Michael Natterer [Fri, 30 Nov 2012 14:06:48 +0000 (15:06 +0100)]
gtk: convert keyvals to unicode before committing to the imcontext
(cherry picked from commit 1eb0d98d734d96a6612e320d32a2aded423d2746)

11 years agogtk: add more OSX special casing for the deadacute and deaddoubleacute keys
Michael Natterer [Fri, 30 Nov 2012 13:39:42 +0000 (14:39 +0100)]
gtk: add more OSX special casing for the deadacute and deaddoubleacute keys

So " plus foo prduces foo-with-diaereses and ' plus c produces
c-with-cedilla.
(cherry picked from commit c0102b30894401a9a1d6d93a972bcc6c37f1b5ac)

11 years agocss: Make test pass
Alexander Larsson [Fri, 30 Nov 2012 13:18:39 +0000 (14:18 +0100)]
css: Make test pass

The new css tree may change the order of selectors (keeping the
same semantics). This affects how the selectors are printed later,
which causes some css parsing tests to not match the references.

Fortunately the order is consistent between runs given the same
css, so we just have to switch around the order in some of the
.ref.css files.

11 years agocss: Allocate the css tree in a single chunk
Alexander Larsson [Thu, 29 Nov 2012 19:52:46 +0000 (20:52 +0100)]
css: Allocate the css tree in a single chunk

This gives us several advantages:

* Smaller struct on 64bit (32bit indexes vs 64bit pointers)
* Less overhead for allocation
* Less fragmentation

11 years agocss: Fix leak of lists while building tree
Alexander Larsson [Thu, 29 Nov 2012 18:10:57 +0000 (19:10 +0100)]
css: Fix leak of lists while building tree

11 years agocss: Add accessor functions for traversing css tree
Alexander Larsson [Thu, 29 Nov 2012 16:56:00 +0000 (17:56 +0100)]
css: Add accessor functions for traversing css tree

This will let us later change how the tree is stored

11 years agocss: Add const to _gtk_css_selector_tree_match_all arg
Alexander Larsson [Thu, 29 Nov 2012 16:55:26 +0000 (17:55 +0100)]
css: Add const to _gtk_css_selector_tree_match_all arg

11 years agocss: Don't keep around linear selectors
Alexander Larsson [Thu, 29 Nov 2012 16:28:51 +0000 (17:28 +0100)]
css: Don't keep around linear selectors

Now we use the selector tree everywhere, so there is no need to
keep around the linear selectors unless we're using them to
verify the tree correctness, so free them.

11 years agocss: Remove gtk_css_ruleset_matches
Alexander Larsson [Thu, 29 Nov 2012 16:23:36 +0000 (17:23 +0100)]
css: Remove gtk_css_ruleset_matches

This is only not needed anymore, and only the VERIFY_TREE code
should access ->selector.

11 years agocss: Use tree for gtk_css_provider_get_style_property
Alexander Larsson [Thu, 29 Nov 2012 16:13:59 +0000 (17:13 +0100)]
css: Use tree for gtk_css_provider_get_style_property

11 years agocss: Implement ruleset_get_change() with the tree
Alexander Larsson [Thu, 29 Nov 2012 15:43:02 +0000 (16:43 +0100)]
css: Implement ruleset_get_change() with the tree

We traverse the tree on the matches instead of using
the linear selectors.

11 years agocss: Ensure the tree built is always the same
Alexander Larsson [Thu, 29 Nov 2012 15:20:14 +0000 (16:20 +0100)]
css: Ensure the tree built is always the same

We add some "artificial" ordering to the otherwise unordered
tree nodes. This means the tree will be the same every time for the
same input. This is good because e.g. tree order affects the
reordering of the simple selectors, which may affect how
css providers are printed, which need to be consistent for
the css tests to work.

11 years agocss: Use the tree to print css selectors
Alexander Larsson [Thu, 29 Nov 2012 15:00:01 +0000 (16:00 +0100)]
css: Use the tree to print css selectors

11 years agocss: Track the tree selector matches
Alexander Larsson [Thu, 29 Nov 2012 14:29:14 +0000 (15:29 +0100)]
css: Track the tree selector matches

11 years agocss: Fix type of GtkCssSelectorRuleSetInfo match
Alexander Larsson [Thu, 29 Nov 2012 14:01:47 +0000 (15:01 +0100)]
css: Fix type of GtkCssSelectorRuleSetInfo match

The old type was a leftover from a previous version.

11 years agocss: Track parent in the css tree nodes
Alexander Larsson [Thu, 29 Nov 2012 13:58:08 +0000 (14:58 +0100)]
css: Track parent in the css tree nodes

This way we can reconstruct matched css rules

11 years agocss: Better tree match verification
Alexander Larsson [Thu, 29 Nov 2012 13:40:10 +0000 (14:40 +0100)]
css: Better tree match verification

11 years agocss: Fix up position with region tree matching
Alexander Larsson [Thu, 29 Nov 2012 13:25:53 +0000 (14:25 +0100)]
css: Fix up position with region tree matching

This was using the wrong result in case of a match (results from
the position, not the region. Also, the descendant checks were
wrong.

11 years agocss: Don't reorder some selectors when building selector tree
Alexander Larsson [Thu, 29 Nov 2012 13:21:20 +0000 (14:21 +0100)]
css: Don't reorder some selectors when building selector tree

When building the tree we generally reorder the selectors inside
the same simple selector in order to pick a good first selector
to balance the tree better. However, some kinds of selectors
can't really be reordered, even thought they are simple.

This is since the matching code for some types handle
the existance of a directly preceeding selector differently:

 REGION and ANY selectors look for a DESCENDANT previous
 POSITION selector look for a REGION previous

11 years agocss: Fixed typo in PRINT_TREE debug code
Alexander Larsson [Wed, 28 Nov 2012 11:13:09 +0000 (12:13 +0100)]
css: Fixed typo in PRINT_TREE debug code

11 years agocss: Create and use a tree for css selector matching
Alexander Larsson [Wed, 28 Nov 2012 10:21:06 +0000 (11:21 +0100)]
css: Create and use a tree for css selector matching

11 years agocss: Add GtkCssSelectorTree creation and matching
Alexander Larsson [Wed, 28 Nov 2012 10:15:53 +0000 (11:15 +0100)]
css: Add GtkCssSelectorTree creation and matching

From a set of GtkCssSelectors and the rulesets they match to
we create a large decision tree that lets us efficitently match
against all the rules and return the set of matched rulesets.

The tree is created such that at each level we pick the initial rule[1]
in all the considered selectors for that level and use put the
one that is in most selectors in the node. All selectors matching that
are put in the previous part of the tree.

11 years agocss: Add _gtk_css_matcher_matches_any()
Alexander Larsson [Wed, 28 Nov 2012 10:07:52 +0000 (11:07 +0100)]
css: Add _gtk_css_matcher_matches_any()

This returns true if the matcher matches *anything*. We need
to check this later, because such matchers are dangerous in loops
that iterate over all parents/siblings since such loops would not
terminate.

11 years agocss: Track which selectors are "simple"
Alexander Larsson [Tue, 27 Nov 2012 09:50:59 +0000 (10:50 +0100)]
css: Track which selectors are "simple"

11 years agoReuse rendered symbolic icons
Alexander Larsson [Mon, 26 Nov 2012 12:52:05 +0000 (13:52 +0100)]
Reuse rendered symbolic icons

With the previous commit all loads of the same icon will share a single
GtkIconInfo, which typicallty means the pixbuf is shared via Info->pixbuf.

However, atm we don't share symbolic icons, which causes these to be re-read
and re-parsed every time. This is especially bad if the icon is used many times
in some form of list. So, we cache the pixbufs and reuse them.

https://bugzilla.gnome.org/show_bug.cgi?id=689081

11 years agoCache GtkIconInfo
Alexander Larsson [Mon, 26 Nov 2012 12:49:49 +0000 (13:49 +0100)]
Cache GtkIconInfo

In order to avoid loading and keeping around the same icon multiple times
we keep a cache of all outstanding GtkIconInfo objects for a given theme.

Additionally we return to the app not the normal pixbuf from the info,
but rather a proxy copy of it sharing the same data, but no extra
reference. This allows us to track when the app is no longer using
the pixbuf, and we can thus ensure that the GtkIconInfo in the cache
stays around for at least as long as the pixbuf is alive.

When the app unrefs the pixbuf we put the Info on a short LRU list
to keep it alive a bit longer, in case the app needs it in a short
while.

https://bugzilla.gnome.org/show_bug.cgi?id=689081

11 years agoAdd a missing va_end call
Matthias Clasen [Fri, 30 Nov 2012 04:18:49 +0000 (23:18 -0500)]
Add a missing va_end call

va_copy must be matched with va_end.

11 years agoAvoid unreachable code
Matthias Clasen [Fri, 30 Nov 2012 04:08:24 +0000 (23:08 -0500)]
Avoid unreachable code

Reestablish an else that went missing in commit 5ff328d2. Without
it, the return is reached unconditionally, and the code behind
it is dead.

11 years agoDon't return prematurely
Matthias Clasen [Fri, 30 Nov 2012 04:05:07 +0000 (23:05 -0500)]
Don't return prematurely

This code was clearly meant to return _after_ the loop.
Don't put the return inside the loop body, then.