Compare commits

...

183 Commits

Author SHA1 Message Date
Benjamin Otte 1af58dc4ee entry: Use cssnodeutils for the widget node 2015-03-22 02:44:41 +01:00
Benjamin Otte cb1cf06744 cssnodeutils: Implement margins 2015-03-20 18:55:27 +01:00
Benjamin Otte c5d00ae119 css: Add min-width/height CSS properties
Use them for the minimum size during size requests.
2015-03-20 14:59:36 +01:00
Benjamin Otte 15582ef9c1 entry: Make progressbar a CssNode 2015-03-20 14:59:28 +01:00
Benjamin Otte 0e57785af7 entry: Set insensitive state on icon css node
... instead of doing it on-demand.
2015-03-20 14:59:28 +01:00
Benjamin Otte 52f58f1637 entry: Use the :active state for pressed icons 2015-03-20 14:59:28 +01:00
Benjamin Otte cd87252130 entry: Set the prelight flag on the CSS node 2015-03-20 14:59:28 +01:00
Benjamin Otte 85d86d61de cssnode: Add gtk_css_node_add/remove_state() API
This mirrors gtk_css_node_add/remove_class() APIs and allows you to
specify a (set of) state(s) to set or unset.

These functions are purely convenience.
2015-03-20 14:59:28 +01:00
Benjamin Otte 0d01ceb415 entry: Prelight icons when pressed
There's no reason to not keep them in the prelight state, theme authors
can override a prelight effect in :active if they want.
2015-03-20 14:59:28 +01:00
Benjamin Otte aa005486de entry: Ignore the "icon-prelight" style property
Always prelight icons. CSS is powerful enough to let people keep the
appearance the same upon prelight.
2015-03-20 14:59:27 +01:00
Benjamin Otte cdd26d0d01 entry: Set style classes on entry icons upon state change 2015-03-20 14:59:27 +01:00
Benjamin Otte f408c59869 entry: Add a cssnode for icons 2015-03-20 14:59:27 +01:00
Benjamin Otte 4326e38b90 cssnode: Make classes APIs string-based
Using quarks is a bad idea now that we are calling the CssNode API
directly.
2015-03-20 14:59:27 +01:00
Benjamin Otte 0f488064a2 box: Port to cssnodeutils 2015-03-20 14:59:27 +01:00
Benjamin Otte e6c7e038c8 switch: Port to cssnodeutils 2015-03-20 14:59:27 +01:00
Benjamin Otte 18bd973014 cssnodeutils: Add a bunch of utility functions for using nodes
The idea is to wrap size request, size allocation and drawing each into
a function that takes care of the CSS box and then calls a callback to
request/allocate/draw the contents.

The idea is that complex widgets then nest these calls for all the css
nodes they need to handle.
2015-03-20 14:59:27 +01:00
Benjamin Otte dae2d9ec27 switch: Port to GtkCssNode
This is a simple port, no code modifications so far other than replacing
gtk_style_context_save() with gtk_style_context_save_to_node().
2015-03-20 14:59:27 +01:00
Benjamin Otte c0c79eee03 stylecontext: Add gtk_style_context_save_to_node()
To be used instead of gtk_style_context_save() with persistent nodes.
2015-03-20 14:59:27 +01:00
Jakub Steiner 3f13349f27 fix insensitive and backdrop states
- checkboxes, labels and buttons were a mixed bag for
  :insensitive and :backdrop

https://bugzilla.gnome.org/show_bug.cgi?id=746188
2015-03-20 13:25:52 +01:00
Matthias Clasen d6bfc2b9c9 HighContrast: fix insensitive labels
Make insensitive labels differerent from regular labels.

https://bugzilla.gnome.org/show_bug.cgi?id=746493
2015-03-20 06:20:30 -04:00
Matthias Clasen fa1bb8972a gtk-demo: Plug a memory leak 2015-03-19 22:57:10 -04:00
Matthias Clasen 8e82d0fba2 widget-factory: Fix toolbar on page 3
Set toolbar-style to 'icons' to avoid rectangular buttons.
2015-03-19 19:11:39 -04:00
Kjartan Maraas 7b1ff7c215 Updated Norwegian bokmål translation. 2015-03-19 21:13:10 +01:00
Vadim Rutkovsky 3211e82b59 inspector: show accessible name and description 2015-03-19 17:01:23 +01:00
Carlos Garnacho 6c8c37abbb wayland: Silence warnings on clipboard data sending cancellation
During copy/paste, it may be common that we receive several property changes
around the selection atom, this results in warnings when cancelling the previous
write attempt. We already honor the last request properly, so we should just
cancel silently.
2015-03-19 16:05:04 +01:00
Carlos Garnacho d5160bb950 wayland: Ensure we re-request the target if the fd changes
If we receive wl_data_source.target before .send, the target would already
be cached, but we'd take no action on the new fd.
2015-03-19 16:05:04 +01:00
Carlos Garnacho a59fd4a9ad wayland: Don't accept the "TARGETS" target on the wl_data_offer
This is handled separately through the data already cached from the
wl_data_offer.offer handler, we can avoid this request entirely then.
2015-03-19 16:05:04 +01:00
Милош Поповић 4d0e1e0b88 Updated Serbian translation 2015-03-19 13:20:12 +00:00
Benjamin Otte d48ba486ee Adwaita: Fix context menu shadows not showing up 2015-03-19 03:55:06 +01:00
Bastien Nocera 7dac38f841 inspector: Make it easier to cut'n'paste advice message
The message says "Enable statistics with GOBJECT_DEBUG=instance-count"
but the message itself isn't selectable, making it hard to cut'n'paste.

https://bugzilla.gnome.org/show_bug.cgi?id=746391
2015-03-18 22:05:46 -04:00
Benjamin Otte ec57c6c10b csspathnode: Handle context going away
Sometimes path nodes can survive longer than the style context that
created them. Don't crash in those cases.

Fixes startup of mutter.

Testcase included.

https://bugzilla.gnome.org/show_bug.cgi?id=746407
2015-03-18 18:24:45 +01:00
Benjamin Otte d55c261079 inspector: Add a new page that lists the CSS node tree 2015-03-18 15:23:33 +01:00
Benjamin Otte 8640bc47b1 cssnode: Add properties 2015-03-18 15:23:33 +01:00
Benjamin Otte d0d9f5a302 csswidgetnode: Use style_changed signal instead of update_style vfunc 2015-03-18 15:23:33 +01:00
Benjamin Otte 10d39171d9 cssnode: Add a style-changed signal
The signal gets emitted whenever the style needs to be changed.
2015-03-18 15:23:33 +01:00
Benjamin Otte 6988f9b818 cssnode: Add node-added and node-removed signal
This allows monitoring the CSS tree. For now, moving a child to a
different position relative to its siblings while keeping the same
parent will cause a child-added + child-removed emission.
2015-03-18 15:23:33 +01:00
Benjamin Otte c7fba52a36 cssnode: Track invalid children
We need to properly track if a node needs to propagate invalidation
state information to its children. We didn't do this properly before and
that could lead to us forgetting to invalidate nodes in corner cases.
2015-03-18 15:23:33 +01:00
Benjamin Otte 7395dddd47 csswidgetnode: Avoid creating a stylecontext
If the widget doesn't have a style context, don't create one. Instead,
call functions on the widget directly.
2015-03-18 15:23:33 +01:00
Benjamin Otte d785820c53 cssnode: Change the way we invalidate timestamps
Do not propagate the TIMESTAMP change through the node tree, as that
causes lots of uneeded markings of nodes as invalid.

Instead, walk the node tree and find the nodes that have a non-static
style and only invalidate timestamps on those.
2015-03-18 15:23:33 +01:00
Benjamin Otte 759d8dafd9 cssstyle: Add gtk_css_style_is_static()
Gets rid of the need to do

  if (ANIMATED_STYLE() &&
      animated_style_is_static(ANIMATED_STYLE(style))
2015-03-18 15:23:33 +01:00
Benjamin Otte d9727290cf cssnode: Special-case TIMESTAMP invalidations
Only invalidate timestamps if the node is marked as invalid. We overload
the meaning of "invalid" as "tracks timestamps".

While I don't like the way this is written, it is an important
optimization because 95+% of nodes don't animate so timestamps don't
matter to them. But timestamps are invalidated 60x per second.
2015-03-18 15:23:33 +01:00
Benjamin Otte 68b8f792d6 cssnode: Redo style changed tracking
We don't return a NULL style to mean "no changes" anymore, instead
we check new_style == old_style to mean that.

Make sure the code reflects this, otherwise we'll send
GTK_CSS_CHANGE_PARENT_STYLE invalidations everywhere and screw up
performance.
2015-03-18 15:23:32 +01:00
Benjamin Otte 776d99ac51 stylecontext: Call get_style(), not create_style()
We want to ensure that the style is created properly.

This also allows making the create_Style() function private.
2015-03-18 15:23:32 +01:00
Benjamin Otte 092ff983f7 cssnode: Merge the 2 places that compute styles
Now that the widget node recomputes styles on update_style() we can just
call it during validate(). That way, we don't need the widget node to
manually compute its style.
2015-03-18 15:23:32 +01:00
Benjamin Otte df51bc836b cssnode: Always return correct style values
If CSS values are queried from a widget, recompute them if necessary. Do
not emit style-updated until the validation phase however.

This way, we don't run into performance traps when style-update causes
invalidations that cause new style-updated to be emitted.
2015-03-18 15:23:32 +01:00
Benjamin Otte 3d1e2a0558 cssstyle: Add optimization
There is no difference between a style and itself.
2015-03-18 15:23:32 +01:00
Benjamin Otte 399df06d19 stylecontext: Refactor gtk_style_context_invalidate()
There's no need anymore to recreate styles, nodes do that automagically
now.

This allows making gtk_css_node_set_style() private.
2015-03-18 15:23:32 +01:00
Benjamin Otte 6dd19306eb cssnode: Create animated styles by default
... and hardcode transient and path nodes to never create animated
styles.
2015-03-18 15:23:32 +01:00
Benjamin Otte f43543165b cssnode: Add optimization
Don't even try to propagate changes when we know there are none.
2015-03-18 15:23:32 +01:00
Benjamin Otte 2954417335 cssnode: Change the way we start animations
We now have a flag for "invalidate animations", use that to restart
animations and decide if we want to start transitions.
2015-03-18 15:23:32 +01:00
Benjamin Otte 172f345d01 cssnode: Return NULL as frame clock when animations are disabled
This is a crude hack, but it works.

FIXME: Hook it up to the GtkSettings so that we properly update when the
setting changes.
2015-03-18 15:23:32 +01:00
Benjamin Otte fbe796f293 cssstyle: Handle 0 timestamp to mean "don't animate" 2015-03-18 15:23:32 +01:00
Benjamin Otte 2ec26cd9b5 cssnode: Move style context function to only user 2015-03-18 15:23:32 +01:00
Benjamin Otte 4b2cdb37fb cssnode: Remove timestamp from gtk_css_node_validate()
GtkCssNode knows its own timestamp.
2015-03-18 15:23:32 +01:00
Benjamin Otte dbe5058b86 cssnode: Add API to query the timestamp
... and pass it to the API that computes new styles.

A special timestamp of 0 means "please don't animate" and is used when
no frame clock is available for a node.
2015-03-18 15:23:32 +01:00
Benjamin Otte 5833858abf cssnode: Make parent style change part of GtkCssNode 2015-03-18 15:23:32 +01:00
Benjamin Otte ceaa594fa4 cssnode: Propagate pending changes after recomputing new style
This way we can propagate if the new style actually changed anything.
2015-03-18 15:23:32 +01:00
Benjamin Otte cadf6a9d3c cssnode: Add gtk_css_node_invalidate_style_provider()
This function not just invalidates the current node, but also all
children.
2015-03-18 15:23:32 +01:00
Benjamin Otte 16b8972bee cssnode: Change get_style_provider() vfunc
Instead of always returning a provider, allow the vfunc to return NULL
to mane "use same provider as parent". This allows a bunch of
optimizations.
2015-03-18 15:23:32 +01:00
Benjamin Otte c0f6e746a0 cssnode: Implement a way to properly track invalidations
See the comment in gtkcssnodeprivate.h for how this works.
2015-03-18 15:23:32 +01:00
Benjamin Otte 13fd368781 cssnode: Change vfunc
This is mainly an attempt to merge the update_style() and validte()
vfuncs. Code is not there yet, but that's the idea.

Also, gtk_css_node_set_style() should not be public. And this gets
closer to that goal, too.
2015-03-18 15:23:31 +01:00
Benjamin Otte 75b633ae08 cssnode: Only pass a boolean for parent changes
Nobody cares what changed in the parent, so don't track it.
2015-03-18 15:23:31 +01:00
Benjamin Otte da25771e58 cssvalue: Remove GtkCssDependencies
They are not used anymore.
2015-03-18 15:23:31 +01:00
Benjamin Otte e95985da26 cssstyle: Remove unused optimization
After measuring it, I realized the optimization never triggers for
Adwaita and rarely ever triggers for simple themes. So it is not
useful to keep it around.
2015-03-18 15:23:31 +01:00
Benjamin Otte 6f9969f4fe csswidgetnode: Always return a valid style 2015-03-18 15:23:31 +01:00
Benjamin Otte b827725ace csspathnode: Call gtk_style_context_validate()
Don't call gtk_style_context_invalidate(), that function does too much
work.
2015-03-18 15:23:31 +01:00
Benjamin Otte 6c00eba7fb testsuite: Add another random stylecontext test 2015-03-18 15:23:31 +01:00
Benjamin Otte d3471508a0 cssnode: Use the frame clock's time
... nstead of the monotonic time when validating a cssnode.
2015-03-18 15:23:31 +01:00
Benjamin Otte 9b73b39f9a cssnode: Treat transient nodes as invisible nodes
Making transient nodes invisible allows us to remove special cases
without any bad side effects and they continue working just like they
did before.
2015-03-18 15:23:31 +01:00
Benjamin Otte 2670ae4436 reftests: Add a reftest for box sibling ordering 2015-03-18 15:23:31 +01:00
Benjamin Otte 2694545468 cssnode: Add visibility concept
This allows hiding nodes of invisible widgets.
And that in turn makes sure :nth-child() works as expected.
2015-03-18 15:23:31 +01:00
Benjamin Otte ee91fb71ca box: Use CSS nodes instead of widget paths
This is a very simple patch that causes a bunch of overhead. But it
works.
2015-03-18 15:23:31 +01:00
Benjamin Otte b92fe2fa85 widget: Add gtk_widget_get_css_node()
and replace gtk_style_context_get_root() with it.
2015-03-18 15:23:31 +01:00
Benjamin Otte 507016cafc cssnode: Refactor node tree modification code
This allows adding more API for it.

It also includes code that tracks modifications and invalidates siblings
and their positions whenever nodes get added or removed.
2015-03-18 15:23:31 +01:00
Benjamin Otte 310f9f40da cssnode: Add hackery to allow bypassing widget paths
If we know the parent's get_path_for_child() implementation is safe to
be used with GtkCssNode because it doesn't do anything special, we do
that. Unfortunately that requires whitelisting vfuncs because the vfunc
is public API so anyone can override it.
2015-03-18 15:23:31 +01:00
Benjamin Otte ee6d081ed9 cssnode: Remove now unused arg from vfunc 2015-03-18 15:23:31 +01:00
Benjamin Otte 89115be3cb cssnode: Add a matcher for nodes
... and use that matcher by default - ie for transient nodes.
2015-03-18 15:23:31 +01:00
Benjamin Otte 2a5194b635 cssnode: Make widget node not copy the path
Instead, use gtk_widget_get_path() which makes GtkWidget cache the path.
This is a temporary solution until we can get rid of widget paths.

This increases memory usage quite noticably.
2015-03-18 15:23:30 +01:00
Benjamin Otte 2143abe5ee cssnode: Make widget node use new matcher 2015-03-18 15:23:30 +01:00
Benjamin Otte 76ca9a9181 cssnode: Make path node create matcher without copying
... the WidgetPath. This uses the functionality introduced in the
previous commits.
2015-03-18 15:23:30 +01:00
Benjamin Otte 2bf7bdd651 cssmatcher: Allow widget path matcher to take a node declaration
The node declaration has the same functionality as
gtk_css_node_declaration_add_to_widget_path(). So instead of using that
function on a path, you can use the original path and the declaration in
a matcher.
2015-03-18 15:23:30 +01:00
Benjamin Otte 630f0f199e cssnode: Split out a function
So far the vfunc is kinda quirky (the path argument is an out argument
for something you have to free when you're done with the matcher), but
  I'm about to change that.
2015-03-18 15:23:30 +01:00
Benjamin Otte 5df01f9244 widget: Create widget path classes from proper style
We don't want to add the current classes to the widget path - which
might potentially be different after a gtk_style_context_save() - but
the root node's ones. So what better thing to do than actually using the
root node?
2015-03-18 15:23:30 +01:00
Benjamin Otte 5edc6d94d1 widget: Use correct type for widgetpath creation
This is relevant when the widget path is created while the widget is
still constructing. G_OBJECT_TYPE(widget) might not point to the final
type yet.
2015-03-18 15:23:30 +01:00
Benjamin Otte ffb410f11e widget: Create the CssNode
... and pass it to the style context instead of having the style context
create it for us.
2015-03-18 15:23:30 +01:00
Benjamin Otte 28043f0a92 cssnode: Refactor invalidation propagation
We want to be sure to gtk_css_node_invalidate() all potential changes.
2015-03-18 15:23:30 +01:00
Benjamin Otte efda30c495 stylecontext: Don't queue animate tick callbacks anymore
Instead, just mark nodes permanently as invalid.
2015-03-18 15:23:30 +01:00
Benjamin Otte 020f3f11c8 cssnode: Handle invalidate queueing differently
Instead of directly requesting the layout phase, register a tick
callback. This is what the docs suggest for animations and it's what we
need for the next commit.
2015-03-18 15:23:30 +01:00
Benjamin Otte cdd964a3af cssnode: Change way invalidation is handled
Have a queue_validate() vfunc and a dequeue_validate() vfunc that are
called only on root nodes so they can queue a validation on their frame
clocks.
2015-03-18 15:23:30 +01:00
Benjamin Otte 5f19f09ac3 cssnode: Refactor gtk_css_widget_node_validate()
Makes it clearer what actually happens in that function.
2015-03-18 15:23:30 +01:00
Benjamin Otte caf2fc9a10 cssnode: Only recreate styles when needed 2015-03-18 15:23:30 +01:00
Benjamin Otte 219e52f7e1 cssnode: Automatically recreate style on get_style() call
When the style is invalid, redo it.

Make this a vfunc, so the widget nodes can opt out.
2015-03-18 15:23:30 +01:00
Benjamin Otte 71813671ef cssnode: Track pending changes here
... instead of GtkCssWidgetNode.
2015-03-18 15:23:30 +01:00
Benjamin Otte c550cf122a stylecontext: Move gtk_style_context_validate() to GtkCssWidgetNode 2015-03-18 15:23:30 +01:00
Benjamin Otte 649edbe2fc stylecontext: Move style creation functions to CssNode code 2015-03-18 15:23:30 +01:00
Benjamin Otte c4b88e05fd stylecontext: Redo handling of differing state
Instead of passing an "override_state" flag, create a new CssNode just
for this simple lookup.
2015-03-18 15:23:30 +01:00
Benjamin Otte 637a4bda5c stylecontext: Get rid of stylecontext argument
... to a bunch of functions.

This requires a tiny change to the heuristics for the style cache - we
now cache styles when they have the same style provider as their parent
instead of when they have the default provider - but that change doesn't
have any effect in practice.
2015-03-18 15:23:29 +01:00
Benjamin Otte 03ac5f310b cssnode: Add gtk_style_context_get_style_provider()
... and use it when looking up properties.
2015-03-18 15:23:29 +01:00
Benjamin Otte 6dc6af674c stylecontext: Remove children list
It's not needed.
2015-03-18 15:23:29 +01:00
Benjamin Otte 4cc2af2db1 stylecontext: Move validation into GtkCssNode 2015-03-18 15:23:29 +01:00
Benjamin Otte 8e1017db35 stylecontext: Export gtk_style_context_get_root()
.. in the private header. This avoids tiny wrapper functions.
2015-03-18 15:23:29 +01:00
Benjamin Otte 55e68bc2ea cssnode: Track invalid flag
Remove it from GtkStyleContext.
2015-03-18 15:23:29 +01:00
Benjamin Otte a589f98821 cssnode: Implement refcounting
The parent refs the child, so gtk_css_node_set_parent() adds/removes a
reference.

We should probably refactor this so that we name the function
parent.add(node) instead of node.set_parent(parent) - makes the
refcounting more clear.
2015-03-18 15:23:29 +01:00
Benjamin Otte 721dce73e0 stylecontext: Handle parent in CssNode code
Make CssNode a real tree with a DOM-like API.
2015-03-18 15:23:29 +01:00
Benjamin Otte 8c73799ca8 stylecontext: Move relevant_changes tracking to GtkCssWidgetNode 2015-03-18 15:23:29 +01:00
Benjamin Otte 7bafb63ec3 cssnode: Handle invalidation
Handle invalidation of node inside the CssNode code, don't do it in the
stylecontext.
2015-03-18 15:23:29 +01:00
Benjamin Otte d79a44c1af stylecontext: Get rid of create_query_path()
Move that functionality into GtkCssNode.
2015-03-18 15:23:29 +01:00
Benjamin Otte 6f99a3cdb0 stylecontext: Change arguments for build_properties
Instead of passing the style declaration, take the node's style
declaration. Add arguments to allow overriding the state for the one
case where this didn't work.
2015-03-18 15:23:29 +01:00
Benjamin Otte 0e3da2f7cf stylecontext: Compute rootness of CssNode
.. instead of passing it as an argument.
2015-03-18 15:23:29 +01:00
Benjamin Otte b9f1f8aa38 stylecontext: Pass cssnode to build_properties 2015-03-18 15:23:29 +01:00
Benjamin Otte 21c3b13596 stylecontext: Simplify a function 2015-03-18 15:23:29 +01:00
Benjamin Otte 40d94fcd38 stylecontext: Remove values cache
The code is confusing the stylecontext=>node transition, so I'll remove
it.

WIth the recent introduction of the parent style cachen, I'm not sure
it's worth it at all. Some crude benchmarking suggests a slight speedup
when removing the cache.

So no guarantees about adding it back later.
2015-03-18 15:23:29 +01:00
Benjamin Otte e2f6d4db43 cssnode: Split into 3 objects
- GtkCssWidgetNode
  for style contexts owned by a widget
- GtkCssPathNode
  for style contexts using a GtkWidgetPath
- GtkCssTransientNode
  for nodes created with gtk_style_context_save()/restore()
2015-03-18 15:23:29 +01:00
Benjamin Otte 726d8abb7d cssnode: Turn into a GObject
This will allow us to use subclasses.
2015-03-18 15:23:28 +01:00
Benjamin Otte cf6d9edc12 stylecontext: Turn CssNode accesses into getters/setters
That way we can hide the struct in the source file.
2015-03-18 15:23:28 +01:00
Benjamin Otte be596f3967 stylecontext: Split out GtkCssNode into own file
The functionality of it is supposed to grow, so better put it in a
custom file early.

This is just a naive split so far, the next patches will split things
further.
2015-03-18 15:23:28 +01:00
Benjamin Otte 99c4f2dd39 render: Make image effect not depend on state
Instead rely on -gtk-image-effect only. Adwaita should already work this
way.

Relying on state was a leftover feature from the GTK 2 days.
2015-03-18 15:22:09 +01:00
Benjamin Otte 0529e15d61 notebook: Protect against invalid allocations
A widget can be mapped but not have a size allocated yet. In that case
avoid computing a broken rectangle.

https://bugzilla.gnome.org/show_bug.cgi?id=746301
2015-03-18 15:14:47 +01:00
Carlos Garnacho dcfa55ac7e wayland: Fix thinko in wl_data_source.cancelled handler
The wl_data_source may be the clipboard's. Looking up the drag context in
order to get the display isn't going to fare well there. So, just use the
default display, and only look up the drag context when we know we need it.

https://bugzilla.gnome.org/show_bug.cgi?id=746386
2015-03-18 11:21:40 +01:00
Christian Hergert 28063ee2e4 textview: add support for underline and strikethrough colors
This commit adds the GtkTextTag:underline-rgba and :strikethrough-rgba
properties and the necessary plumbing to apply these colors in GtkTextLayout.
With this change, you can alter the color of underlines including those
of type PANGO_UNDERLINE_ERROR.

You might want to alter the underline color to differentiate between
spelling and grammer mistakes. In code editors, it is convenient to
differentiate between errors and warnings.

Note that the GtkTextAppearance struct is public ABI and has no spare
room for new fields, so we are resorting to some tricky packing to store
the colors in the unused pixel field of the fg_color and bg_color structs.
This packing is accomplished by the macros in gtktextattributesprivate.h.

Signed-off-by: Christian Hergert <christian@hergert.me>

https://bugzilla.gnome.org/show_bug.cgi?id=402168
2015-03-17 23:24:13 -04:00
Matthias Clasen 416c370da1 GtkRange: Fix scroll wheel direction for horizontal ranges
The expected behavior here is that scrolling up goes towards
larger values, ie to the right. This matches e.g. volume
sliders in gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=737175
2015-03-17 22:02:35 -04:00
Matthias Clasen d823c39caf scrolled window: Use shift to modify scroll direction
It has been a long-standing request to interpret scroll events
with Shift held down as horizontal instead of vertical, and
some applications are already doing this on their own.

https://bugzilla.gnome.org/show_bug.cgi?id=132197
2015-03-17 20:50:24 -04:00
Matthias Clasen 00544e9090 HighContrast: Fix calendar selection
The selected day was not differentiated from other
days at all. Render it white on black instead.

https://bugzilla.gnome.org/show_bug.cgi?id=746369
2015-03-17 19:38:18 -04:00
Matthias Clasen 3d3591e873 HighContrast: Fix color chooser marks
The checkmark for the selected color was always black,
making it more or less invisible on dark colors.

https://bugzilla.gnome.org/show_bug.cgi?id=746368
2015-03-17 19:34:15 -04:00
Jakub Steiner 49b6be4e06 HighContrast: catch backdrop:insensitive:active of GtkSwitch
https://bugzilla.gnome.org/show_bug.cgi?id=746358
2015-03-17 23:55:10 +01:00
Jakub Steiner 557f5d5c7c HighContrast: unbreak GtkExpander
- the open state is checked, not active now

https://bugzilla.gnome.org/show_bug.cgi?id=746370
2015-03-17 23:43:20 +01:00
Anders Jonsson bcddf68858 Updated Swedish translation 2015-03-17 21:24:09 +00:00
Zahari Yurukov 75105f94f0 Updated Bulgarian translation 2015-03-17 23:05:08 +02:00
Jakub Steiner f671cd6296 HightContrast: make tab buttons not shift size
- only 1px stroke for close buttons in notebook tabs

https://bugzilla.gnome.org/show_bug.cgi?id=746149
2015-03-17 18:18:18 +01:00
Jakub Steiner 9b5fa0860f HighContrast: OSD fixes
- buttons
- labels
- scale trough/slider

https://bugzilla.gnome.org/show_bug.cgi?id=746148
2015-03-17 18:09:28 +01:00
Matthias Clasen 390dd37656 Add to release notes
Mention that GtkSearchEntry now 'eats' some keys.
2015-03-17 06:53:37 -04:00
Matthias Clasen 88a5959b22 3.15.12 2015-03-16 22:35:45 -04:00
Milo Casagrande 27164484cd Updated Italian translation 2015-03-16 20:37:06 +00:00
Jakub Steiner 6f478db2fa Adwaita: desaturate selected color for backdrop
https://bugzilla.gnome.org/show_bug.cgi?id=746202
2015-03-16 19:41:19 +01:00
Matthias Clasen d5d28a5062 widget factory: Add an example for an insensitive model button
This will make it easier to make insensitive model buttons
appear properly in other themes.
2015-03-16 14:05:48 -04:00
Jonas Ådahl 4e930ada32 wayland: Move gtk-shell compatibility version define too
https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-03-16 13:58:14 -04:00
Matthias Clasen c7672699e9 Don't pass invalid rectangles to cairo
This causes pixman warnings, or worse.
Clearly, something is not quite right here, if we end up
redrawing tabs at a time when the allocation is set to (1, 1).
For now, avoid straining the error handling in the lower layers.

https://bugzilla.gnome.org/show_bug.cgi?id=746301
2015-03-16 12:51:56 -04:00
Matthias Clasen 855c4dc0ce unrealize: Don't ref twice
After the recent change to add an outermost ref/unref pair,
we can do away with the inner one.
2015-03-16 11:54:38 -04:00
Carlos Garnacho 70e7b4c848 inspector: Remove flash timeout from widgets being unmapped
Otherwise the timeout can keep running, even if the widget is being
destroyed.
2015-03-16 16:29:37 +01:00
Carlos Garnacho b4b23580a6 window: Protect against popover destruction on ::unmap
On popover_unmap(), perform the gtk_widget_unmap() call last, so the
GtkWindowPopover data is ensured to be alive throughout the function
if the popover widget is destroyed right on ::unmap.

https://bugzilla.gnome.org/show_bug.cgi?id=745829
2015-03-16 16:27:06 +01:00
Carlos Garnacho b4e61b759b widget: Take a ref during ::unrealize emission
In order to prevent invalid memory access/crashes if the widget is
destroyed in a callback of that signal.

https://bugzilla.gnome.org/show_bug.cgi?id=745829
2015-03-16 16:27:06 +01:00
Carlos Garnacho f5f6ad9981 widget: Take a ref during ::unmap emission
This ensures the widget data stays live long enough to perform invariants
check after emission if the widget happens to be destroyed on a callback.

https://bugzilla.gnome.org/show_bug.cgi?id=745829
2015-03-16 16:22:25 +01:00
Zahari Yurukov 2e272106ef Updated Bulgarian translation 2015-03-16 17:18:26 +02:00
Benjamin Otte 2d013a739a reftests: Fix test on HighContrast theme
We are testing -gtk-icon-style and assume the theme doesn't touch it.
But HighContrast forces symbolic icons. And that breaks the reference
images.

So explicitly set "requested" for everything.
2015-03-16 15:44:42 +01:00
Benjamin Otte a24aee6bb2 spinbutton: Fix get_text_area_size for vertical spinbuttons
Commit c5905b13b9 changed the semantics of
this vfunc and get_entry_size but I only fixed one of them in the
spinbutton subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=746282
2015-03-16 15:24:16 +01:00
Jonas Ådahl 225c10bc5a wayland: Don't set the wl_surface user_data twice
wl_surface_add_listener already sets the user data pointer, so no need
to do it separately before.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl 7372ddd2a1 wayland: Ignore setting the same cursor theme as was already set
If the name and size of the theme is identical to the current
configuration, do nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl 465647e964 wayland: Support scaling of theme based cursors
Support scaling of cursors created from themes. The default scale is
always 1, but if the pointer cursor surface enters an output with a
higher scale, load the larger version of the cursor theme and use the
image from that theme.

This assumes the theme size is set to one that fits with an output scale
= 1.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl 7b2cdabc2e wayland: Put interface version defines in a common place
So far only one, but put it somewhere all files can see it.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jonas Ådahl c7be8fd398 wayland: Don't set cursor surface scale when we don't have a surface
The setting of the the surface scale even when the surface is not
created from a surface was introduced due to a crash when getting the
buffers when dividing by the scale. The only reason I can see this is
that we get the buffer from a non-existing surface when the wl_cursor
has not yet been set.

Instead, use the name field to avoid trying to use the non-existing
surface, effectively avoiding the division-by-zero that way.

https://bugzilla.gnome.org/show_bug.cgi?id=746141
2015-03-16 19:53:37 +08:00
Jakub Steiner 6675b9639c HC: no border for insensitive backdrop buttons
https://bugzilla.gnome.org/show_bug.cgi?id=746192
2015-03-16 12:37:54 +01:00
Trần Ngọc Quân 49cd3c8232 Updated Vietnamese translation
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
2015-03-16 14:45:46 +07:00
Matthias Clasen 25b610ef5e widget-factory: Add an insensitive toolbutton
This will help getting their theming right in HighContrast.
2015-03-15 22:54:02 -04:00
Matthias Clasen de239ca31b widget-factory: Add tab close buttons
This will make it easier to fix issues with such buttons
in HighContrast.
2015-03-15 22:44:33 -04:00
Matthias Clasen 5dfbeb978f gtk3-demo: Stop using follow-state
It is no longer needed.
2015-03-15 22:44:33 -04:00
Matthias Clasen e98b096ca8 print dialog: Stop using follow-state
It is no longer needed.
2015-03-15 22:44:33 -04:00
Matthias Clasen 399d2c1389 app chooser widget: Stop using follow-state
It is no longer needed.
2015-03-15 22:44:33 -04:00
Matthias Clasen 59a901e285 places sidebar: Stop using follow-state
It is no longer needed.
2015-03-15 22:44:33 -04:00
Matthias Clasen 8d58b64c28 widget-factory: Stop using follow-state
The property is no longer needed, cell renderers now
always follow state.
2015-03-15 22:44:33 -04:00
Josef Andersson 0df9b59dfc Updated Swedish translation 2015-03-15 21:30:20 +00:00
Matej Urbančič 17a221dba9 Updated Slovenian translation 2015-03-15 21:39:22 +01:00
Ask Hjorth Larsen e6f9c49c22 Updated Danish translation 2015-03-15 14:46:54 +01:00
Nelson Benítez León 11096885ae gemfile: needs add source rubygems.org
`bundle install` command on fedora 21 was failing
with following message:

Your Gemfile has no gem server sources. If you need
gems that are not already on your machine, add a line
like this to your Gemfile:
source 'https://rubygems.org'

After adding that line it worked again.

https://bugzilla.gnome.org/show_bug.cgi?id=746205
2015-03-14 23:48:21 +01:00
Piotr Drąg 838c9a0d98 Updated POTFILES.in and POTFILES.skip 2015-03-14 17:59:27 +01:00
Benjamin Otte c5905b13b9 entry: Make code do what it's meant to do
With the 3.0 transition, this code went from just querying the entry's
height request to doing a full size request.
Then it got code to revert the features that a full size request does.
And then it grew code that manually computed the baseline.

Avoid this and just do what happened back in the days: Do a regular
height request.

This changes the semantics of the get_frame_size() vfunc wrt its
behavior towards subclasses overwriting the get_height() vfuncs, but I'm
happy to live with that.
2015-03-14 15:46:13 +01:00
Benjamin Otte d2881d901b cellrendererpixbuf: Always follow state
Applications forget to set the follow-state property and then some
themes used a style where normal symbolic icons have the same color as
prelit or selected backgrounds and that suddenly made icons invisible
and who wants that?

https://bugzilla.gnome.org/show_bug.cgi?id=746201
2015-03-14 15:46:13 +01:00
Carlos Soriano 7ef7873b23 gtkstacksidebar: fix missing macro
commit e41cadd835 forgot to change some macros.
2015-03-14 13:41:57 +01:00
Samir Ribic 10ea4d81e6 Updated Bosnian translation 2015-03-14 09:08:02 +00:00
Matthias Clasen 2026efb981 More documentation fixes
With this commit, gtk3-unused.txt is empty (for the first
time in a looong time).
2015-03-13 23:24:53 -04:00
Matthias Clasen e41cadd835 GtkStackSidebar: Fix incomplete renaming
Some of the boilerplate macros were missing. Oops
2015-03-13 23:24:53 -04:00
Matthias Clasen 0ddb5d729c More documentation fixes 2015-03-13 23:24:53 -04:00
Matthias Clasen bb3ae47477 Docs: Update ignored header list
This reduces the warning spam somewhat.
2015-03-13 23:24:53 -04:00
Matthias Clasen a744a67f42 Documentation fixes
Add a few missing symbols.
2015-03-13 23:24:53 -04:00
Matthias Clasen c93d66c8a7 Fix a typo in the docs
gtk-doc complains about parameter name mismatches.
2015-03-13 23:24:53 -04:00
A S Alam a7ef117b4a Translation pa updated for Gnome 2015-03-13 21:23:03 -05:00
Ask Hjorth Larsen f0609a5142 updated Danish translation 2015-03-13 23:52:58 +01:00
Ask Hjorth Larsen d89bd0040c updated Danish translation 2015-03-13 23:51:51 +01:00
Matthias Clasen fec8a1ee7f menu button: Improve accessibility
Rework the way we assign an accessible name to menu buttons,
to make sure we pick up a label, should the button contain
one, and only override the name with "Menu" as a fallback.
2015-03-13 18:38:18 -04:00
Matthias Clasen 98730f71f9 testsuite: Set some environment variables
These were set manually in some tests, but not consistently.
2015-03-13 17:51:42 -04:00
Matthias Clasen b756fd42a0 testsuite: Drop test bus
It seems to be buggy in ways that make the test fail
with a critical when the test bus is brought down.
At the same time, drop manual settings of environment
variables that we can set globally.
2015-03-13 17:51:32 -04:00
Samir Ribic 4d889ccc42 Updated Bosnian translation 2015-03-13 20:44:00 +00:00
Samir Ribic 5f8e054a9d Updated Bosnian translation 2015-03-13 20:43:23 +00:00
Jordi Mas fe13fb841b Update Catalan translation 2015-03-13 02:26:58 -04:00
166 changed files with 37641 additions and 29364 deletions
+40
View File
@@ -1,3 +1,43 @@
Overview of Changes in GTK+ 3.15.12
===================================
* GtkMenuButton:
- Improve accessible names
* GtkCellRendererPixbuf:
- Always follow state changes, the ::follow-state property
is now ignored. This is necessary to make HighContrast
and symbolic icons remain visible e.g. in selected rows.
* GtkEntry:
- Rework the size allocation code to be less arcane. This
changed the semantics of the get_frame_size() vfunc. GtkEntry
subclasses that override this vfunc may need adjustment.
* Wayland:
- Support hi-dpi cursors
* Bugs fixed:
745829 crash when double-clicking close button while popover...
746141 wayland: Support HiDPI pointer cursors
746192 Insensitive backdrop ToolButtons are not drawn correctly
746201 Sidebar icons are black on black in HighContrast theme
746202 use insensitive color for unfocused selected items
746205 gemfile: needs add source rubygems.org
746282 pixman warnings after recent changes
746301 Opening "Sound" panel generates pixman error
* Translation updates:
Bosnian
Bulgarian
Catalan
Danish
Punjabi
Slovenian
Swedish
Vietnamese
Overview of Changes in GTK+ 3.15.11
===================================
+5
View File
@@ -99,6 +99,11 @@ Release notes for 3.16
has non-scrolling parts similar to treeview headers, there is no need
to implement this vfunc.
* The GtkSearchEntry widget has gained a number of new signal that
are emitted when certain key sequences are seen. In particular, it
now handles the Escape key and emits ::stop-search. Applications that
expect to handle Escape themselves will need to be updated.
Release notes for 3.14
======================
+1 -1
View File
@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [15])
m4_define([gtk_micro_version], [11])
m4_define([gtk_micro_version], [12])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
-1
View File
@@ -218,7 +218,6 @@ add_columns (GtkTreeView *treeview)
/* column for symbolic icon */
renderer = gtk_cell_renderer_pixbuf_new ();
g_object_set (G_OBJECT (renderer), "follow-state", TRUE, NULL);
column = gtk_tree_view_column_new_with_attributes ("Symbolic icon",
renderer,
"icon-name",
+1 -1
View File
@@ -543,7 +543,7 @@ add_data_tab (const gchar *demoname)
* not an image. Let's try something else then.
*/
g_object_ref_sink (widget);
gtk_widget_destroy (widget);
g_object_unref (widget);
bytes = g_resources_lookup_data (resource_name, 0, NULL);
g_assert (bytes);
+1
View File
@@ -62,6 +62,7 @@ uninstall-update-icon-cache:
EXTRA_DIST += \
widget-factory.ui \
widget-factory.css \
menus.ui \
widget-factory.gresource.xml \
data/source.svg \
+4 -1
View File
@@ -1157,7 +1157,7 @@ activate (GApplication *app)
g_type_ensure (my_text_view_get_type ());
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, ".circular-button { border-radius: 20px; outline-radius: 20px; }", -1, NULL);
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory/widget-factory.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
@@ -1336,6 +1336,7 @@ int
main (int argc, char *argv[])
{
GtkApplication *app;
GAction *action;
static GActionEntry app_entries[] = {
{ "about", activate_about, NULL, NULL, NULL },
{ "quit", activate_quit, NULL, NULL, NULL },
@@ -1353,6 +1354,8 @@ main (int argc, char *argv[])
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
app);
action = g_action_map_lookup_action (G_ACTION_MAP (app), "wine");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+9
View File
@@ -0,0 +1,9 @@
.circular-button {
border-radius: 20px;
outline-radius: 20px;
}
.small-button {
padding: 0;
outline-width: 0;
}
@@ -3,6 +3,9 @@
<gresource prefix="/org/gtk/WidgetFactory">
<file preprocess="xml-stripblanks">widget-factory.ui</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory">
<file>widget-factory.css</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory/gtk">
<file preprocess="xml-stripblanks">menus.ui</file>
</gresource>
+76 -10
View File
@@ -1571,9 +1571,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="title" translatable="yes">Icon</property>
<property name="reorderable">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1">
<property name="follow_state">true</property>
</object>
<object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
<attributes>
<attribute name="icon_name">1</attribute>
</attributes>
@@ -2896,6 +2894,15 @@ microphone-sensitivity-medium-symbolic</property>
<property name="tooltip-text" translatable="yes">Search for it</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="label" translatable="yes">Insert</property>
<property name="icon-name">insert-image</property>
<property name="tooltip-text" translatable="yes">Insert something</property>
</object>
</child>
</object>
</child>
<child>
@@ -3074,9 +3081,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="selection_mode">multiple</property>
<property name="model">iconsmodel</property>
<child>
<object class="GtkCellRendererPixbuf" id="iconviewcell">
<property name="follow-state">True</property>
</object>
<object class="GtkCellRendererPixbuf" id="iconviewcell"/>
<attributes>
<attribute name="icon-name">0</attribute>
</attributes>
@@ -3622,6 +3627,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkToolbar">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="toolbar-style">icons</property>
<property name="icon-size">1</property>
<child>
<object class="GtkToolButton" id="toolbutton1">
@@ -3861,11 +3867,41 @@ microphone-sensitivity-medium-symbolic</property>
<property name="visible">True</property>
<property name="height-request">120</property>
</object>
<packing>
<property name="tab-expand">True</property>
<property name="tab-fill">True</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<object class="GtkBox">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 1</property>
<property name="orientation">horizontal</property>
<child type="center">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="relief">none</property>
<property name="focus-on-click">False</property>
<style>
<class name="small-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">window-close-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<child>
@@ -3873,11 +3909,41 @@ microphone-sensitivity-medium-symbolic</property>
<property name="visible">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="tab-expand">True</property>
<property name="tab-fill">True</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<object class="GtkBox">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 2</property>
<property name="orientation">horizontal</property>
<child type="center">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Page 2</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="relief">none</property>
<property name="focus-on-click">False</property>
<style>
<class name="small-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">window-close-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
</object>
+154 -24
View File
@@ -19,87 +19,217 @@ HFILE_GLOB=$(top_srcdir)/gtk/*.h
CFILE_GLOB=$(top_srcdir)/gtk/*.c
# Header files to ignore when scanning
IGNORE_HFILES= \
IGNORE_HFILES = \
inspector \
a11y \
gtkaccelgroupprivate.h \
gtkaccelmapprivate.h \
gtkadjustmentprivate.h \
gtkallocatedbitmaskprivate.h \
gtkappchooserprivate.h \
gtkapplicationprivate.h \
gtkbindingsprivate.h \
gtkbitmaskprivate.h \
gtkboxprivate.h \
gtkbuilderprivate.h \
gtkbuttonprivate.h \
gtkcairoblurprivate.h \
gtkcellareaboxcontextprivate.h \
gtkclipboardprivate.h \
gtkcolorchooserprivate.h \
gtkcoloreditorprivate.h \
gtkcolorplaneprivate.h \
gtkcolorscaleprivate.h \
gtkcolorswatchprivate.h \
gtkcomboboxprivate.h \
gtkcontainerprivate.h \
gtkcssanimatedstyleprivate.h \
gtkcssanimationprivate.h \
gtkcssarrayvalueprivate.h \
gtkcssbgsizevalueprivate.h \
gtkcssbordervalueprivate.h \
gtkcsscolorvalueprivate.h \
gtkcsscornervalueprivate.h \
gtkcsscustompropertyprivate.h \
gtkcsseasevalueprivate.h \
gtkcssenginevalueprivate.h \
gtkcssenumvalueprivate.h \
gtkcssiconthemevalueprivate.h \
gtkcssimagebuiltinprivate.h \
gtkcssimagecrossfadeprivate.h \
gtkcssimagegradientprivate.h \
gtkcssimageiconthemeprivate.h \
gtkcssimagelinearprivate.h \
gtkcssimageprivate.h \
gtkcssimagescaledprivate.h \
gtkcssimagesurfaceprivate.h \
gtkcssimageurlprivate.h \
gtkcssimagevalueprivate.h \
gtkcssimagewin32private.h \
gtkcssinheritvalueprivate.h \
gtkcssinitialvalueprivate.h \
gtkcsskeyframesprivate.h \
gtkcsslookupprivate.h \
gtkcssmatcherprivate.h \
gtkcssnodedeclarationprivate.h \
gtkcssnumbervalueprivate.h \
gtkcssparserprivate.h \
gtkcsspositionvalueprivate.h \
gtkcssproviderprivate.h \
gtkcssrepeatvalueprivate.h \
gtkcssrgbavalueprivate.h \
gtkcsssectionprivate.h \
gtkcssselectorprivate.h \
gtkcssshadowsvalueprivate.h \
gtkcssshadowvalueprivate.h \
gtkcssshorthandpropertyprivate.h\
gtkcssstaticstyleprivate.h \
gtkcssstringvalueprivate.h \
gtkcssstylefuncsprivate.h \
gtkcssstyleprivate.h \
gtkcssstylepropertyprivate.h \
gtkcsstransformvalueprivate.h \
gtkcsstransitionprivate.h \
gtkcsstypedvalueprivate.h \
gtkcsstypesprivate.h \
gtkcssunsetvalueprivate.h \
gtkcssvalueprivate.h \
gtkdialogprivate.h \
gtkentryprivate.h \
gtkeventcontrollerprivate.h \
gtkfilechooserprivate.h \
gtkfontchooserprivate.h \
gtkgesturedragprivate.h \
gtkgesturelongpressprivate.h \
gtkgesturemultipressprivate.h \
gtkgesturepanprivate.h \
gtkgestureprivate.h \
gtkgesturerotateprivate.h \
gtkgesturesingleprivate.h \
gtkgestureswipeprivate.h \
gtkgesturezoomprivate.h \
gtkheaderbarprivate.h \
gtkhslaprivate.h \
gtkiconhelperprivate.h \
gtkiconviewprivate.h \
gtkimageprivate.h \
gtkimmoduleprivate.h \
gtklabelprivate.h \
gtklockbuttonprivate.h \
gtkmagnifierprivate.h \
gtkmenubuttonprivate.h \
gtkmenuitemprivate.h \
gtkmenuprivate.h \
gtkmenushellprivate.h \
gtkmodulesprivate.h \
gtkmountoperationprivate.h \
gtkorientableprivate.h \
gtkpixelcacheprivate.h \
gtkpopoverprivate.h \
gtkprinter-private.h \
gtkprintoperation-private.h \
gtkprivate.h \
gtkrangeprivate.h \
gtkrecentchooserprivate.h \
gtkrenderbackgroundprivate.h \
gtkrenderborderprivate.h \
gtkrendericonprivate.h \
gtkrenderprivate.h \
gtkroundedboxprivate.h \
gtkscaleprivate.h \
gtksearchentryprivate.h \
gtkselectionprivate.h \
gtksettingsprivate.h \
gtksizegroup-private.h \
gtksizerequestcacheprivate.h \
gtksocketprivate.h \
gtkstyleanimationprivate.h \
gtkstylecascadeprivate.h \
gtkstylecontextprivate.h \
gtkstylepropertyprivate.h \
gtkstyleproviderprivate.h \
gtktextchildprivate.h \
gtktexthandleprivate.h \
gtktextiterprivate.h \
gtktextmarkprivate.h \
gtktexttagprivate.h \
gtktogglebuttonprivate.h \
gtktoolbarprivate.h \
gtktoolpaletteprivate.h \
gtktooltipprivate.h \
gtktreeprivate.h \
gtkwidgetprivate.h \
gtkwin32themeprivate.h \
gtkwindowprivate.h \
fnmatch.h \
gtkactionmuxer.h \
gtkactionobserver.h \
gtkactionobservable.h \
gtk9slice.h \
gtkanimationdescription.h \
gtkbitmaskprivateimpl.h \
gtkbookmarksmanager.h \
gtkdbusgenerated.c \
gtkdbusgenerated.h \
gtkdebug.h \
gtkactionhelper.h \
gtkapplicationprivate.h \
gtkbuilderprivate.h \
gtkcolorchooserprivate.h \
gtkcoloreditorprivate.h \
gtkcolorplaneprivate.h \
gtkcolorscaleprivate.h \
gtkcolorswatchprivate.h \
gtkdndcursors.h \
gtkentryprivate.h \
gtkfilechooserdefault.h \
gtkfilechooserembed.h \
gtkfilechooserentry.h \
gtkfilechooserprivate.h \
gtkfilechoosersettings.h \
gtkfilechooserutils.h \
gtkfilesystem.h \
gtkfilesystemmodel.h \
gtkfilesystemunix.h \
gtkfilesystemwin32.h \
gtkfontchooserutils.h \
gtkiconcache.h \
gtkiconcachevalidator.h \
gtkiconthemeparser.h \
gtkintl.h \
gtkkeyhash.h \
gtkkineticscrolling.h \
gtkmarshal.h \
gtkmenuprivate.h \
gtkmnemonichash.h \
gtkmenutracker.h \
gtkmenutrackeritem.h \
gtkmenusectionbox.h \
gtkmodelmenu.h \
gtkmodelmenuitem.h \
gtkmodifierstyle.h \
gtkpathbar.h \
gtkplugprivate.h \
gtkprintbackend.h \
gtkprinteroption.h \
gtkprinteroptionset.h \
gtkprinteroptionwidget.h \
gtkprinter-private.h \
gtkprint-win32.h \
gtkprintutils.h \
gtkprintoperation-private.h \
gtkprivate.h \
gtkprivatetypebuiltins.h \
gtkquery.h \
gtkrbtree.h \
gtkrecentchooserdefault.h \
gtkrecentchooserutils.h \
gtkrecentchooserprivate.h \
gtksearchengine.h \
gtksearchenginebeagle.h \
gtksearchenginetracker.h \
gtksearchenginesimple.h \
gtksearchenginequartz.h \
gtksequence.h \
gtksocketprivate.h \
gtktextbtree.h \
gtktextbufferserializ.h \
gtktextchildprivate.h \
gtktextbufferserialize.h \
gtktextdisplay.h \
gtktexthandleprivate.h \
gtktextiterprivate.h \
gtktextlayout.h \
gtktextmarkprivate.h \
gtktextsegment.h \
gtktexttagprivate.h \
gtktexttypes.h \
gtktextutil.h \
gtktimeline.h \
gtkthemes.h \
gtktrashmonitor.h \
gtktrayicon.h \
gtktreedatalist.h \
gtktreeprivate.h \
gtktoolpaletteprivate.h \
gtktreemenu.h \
gtktypebuiltins.h \
gtkxembed.h \
gtkwin32embed.h \
+128 -4
View File
@@ -329,6 +329,7 @@ GTK_ADJUSTMENT_CLASS
GTK_IS_ADJUSTMENT_CLASS
GTK_ADJUSTMENT_GET_CLASS
<SUBSECTION Private>
GtkAdjustmentPrivate
gtk_adjustment_get_type
</SECTION>
@@ -565,6 +566,12 @@ gtk_list_box_row_set_selectable
gtk_list_box_row_get_selectable
<SUBSECTION Standard>
GTK_LIST_BOX
GTK_LIST_BOX_CLASS
GTK_LIST_BOX_GET_CLASS
GTK_LIST_BOX_ROW
GTK_LIST_BOX_ROW_CLASS
GTK_LIST_BOX_ROW_GET_CLASS
GTK_IS_LIST_BOX
GTK_IS_LIST_BOX_CLASS
GTK_IS_LIST_BOX_ROW
@@ -1208,6 +1215,8 @@ GTK_ENTRY_CLASS
GTK_IS_ENTRY_CLASS
GTK_ENTRY_GET_CLASS
<SUBSECTION Private>
GTK_TYPE_TEXT_HANDLE_POSITION
GTK_TYPE_TEXT_HANDLE_MODE
GtkEntryPrivate
gtk_entry_get_type
</SECTION>
@@ -1304,6 +1313,7 @@ GTK_EVENT_BOX_CLASS
GTK_IS_EVENT_BOX_CLASS
GTK_EVENT_BOX_GET_CLASS
<SUBSECTION Private>
GtkEventBoxPrivate
gtk_event_box_get_type
</SECTION>
@@ -1635,6 +1645,7 @@ GTK_IS_FONT_CHOOSER_IFACE
GTK_FONT_CHOOSER_GET_IFACE
<SUBSECTION Private>
GTK_FONT_CHOOSER_DELEGATE_QUARK
gtk_font_chooser_get_type
</SECTION>
@@ -2237,6 +2248,7 @@ GTK_MENU_CLASS
GTK_IS_MENU_CLASS
GTK_MENU_GET_CLASS
<SUBSECTION Private>
GtkMenuPrivate
gtk_menu_get_type
</SECTION>
@@ -2289,7 +2301,7 @@ GTK_IS_MENU_BUTTON
GTK_IS_MENU_BUTTON_CLASS
GTK_MENU_BUTTON_GET_CLASS
<SUBSECTION Private>
GtkMenuButtonrPrivate
GtkMenuButtonPrivate
gtk_menu_button_get_type
</SECTION>
@@ -2326,6 +2338,7 @@ GTK_MENU_ITEM_CLASS
GTK_IS_MENU_ITEM_CLASS
GTK_MENU_ITEM_GET_CLASS
<SUBSECTION Private>
GtkMenuItemPrivate
gtk_menu_item_get_type
</SECTION>
@@ -2392,6 +2405,7 @@ GTK_MENU_SHELL_CLASS
GTK_IS_MENU_SHELL_CLASS
GTK_MENU_SHELL_GET_CLASS
<SUBSECTION Private>
GtkMenuShellPrivate
gtk_menu_shell_get_type
</SECTION>
@@ -2560,6 +2574,7 @@ GTK_IS_NUMERABLE_ICON_CLASS
GTK_NUMERABLE_ICON_GET_CLASS
<SUBSECTION Private>
GtkNumerableIconPrivate
gtk_numerable_icon_get_type
</SECTION>
@@ -3276,6 +3291,7 @@ GTK_SETTINGS_CLASS
GTK_SETTINGS_GET_CLASS
GTK_TYPE_SETTINGS
<SUBSECTION Private>
GtkSettingsPrivate
gtk_settings_get_type
GtkSettingsPropertyValue
</SECTION>
@@ -3321,6 +3337,7 @@ GTK_SOCKET_CLASS
GTK_IS_SOCKET_CLASS
GTK_SOCKET_GET_CLASS
<SUBSECTION Private>
GtkSocketPrivate
gtk_socket_get_type
</SECTION>
@@ -4375,6 +4392,7 @@ gtk_tree_model_row_inserted
gtk_tree_model_row_has_child_toggled
gtk_tree_model_row_deleted
gtk_tree_model_rows_reordered
gtk_tree_model_rows_reordered_with_length
<SUBSECTION Standard>
GTK_TREE_MODEL
GTK_IS_TREE_MODEL
@@ -4411,6 +4429,7 @@ GTK_TREE_MODEL_SORT_CLASS
GTK_IS_TREE_MODEL_SORT_CLASS
GTK_TREE_MODEL_SORT_GET_CLASS
<SUBSECTION Private>
GtkTreeModelSortPrivate
gtk_tree_model_sort_get_type
</SECTION>
@@ -4478,6 +4497,7 @@ GTK_TREE_SELECTION_CLASS
GTK_TREE_SELECTION_GET_CLASS
GTK_IS_TREE_SELECTION_CLASS
<SUBSECTION Private>
GtkTreeSelectionPrivate
gtk_tree_selection_get_type
</SECTION>
@@ -4568,6 +4588,7 @@ GTK_TREE_STORE_CLASS
GTK_IS_TREE_STORE_CLASS
GTK_TREE_STORE_GET_CLASS
<SUBSECTION Private>
GtkTreeStorePrivate
gtk_tree_store_get_type
</SECTION>
@@ -4638,6 +4659,7 @@ GTK_TREE_VIEW_COLUMN_CLASS
GTK_IS_TREE_VIEW_COLUMN_CLASS
GTK_TREE_VIEW_COLUMN_GET_CLASS
<SUBSECTION Private>
GtkTreeViewColumnPrivate
gtk_tree_view_column_get_type
</SECTION>
@@ -4853,6 +4875,7 @@ gtk_cell_area_get_current_path_string
gtk_cell_area_apply_attributes
gtk_cell_area_attribute_connect
gtk_cell_area_attribute_disconnect
gtk_cell_area_attribute_get_column
gtk_cell_area_class_install_cell_property
gtk_cell_area_class_find_cell_property
gtk_cell_area_class_list_cell_properties
@@ -4990,6 +5013,7 @@ GTK_IS_CELL_RENDERER_CLASS
GTK_CELL_RENDERER_GET_CLASS
<SUBSECTION Private>
GtkCellRendererPrivate
GtkCellRendererClassPrivate
gtk_cell_renderer_get_type
gtk_cell_renderer_mode_get_type
gtk_cell_renderer_state_get_type
@@ -5628,6 +5652,7 @@ GTK_IS_WIDGET_CLASS
GTK_WIDGET_GET_CLASS
GTK_TYPE_REQUISITION
<SUBSECTION Private>
GtkWidgetClassPrivate
GtkWidgetPrivate
gtk_widget_get_type
gtk_requisition_get_type
@@ -5795,6 +5820,7 @@ GTK_WINDOW_GROUP
GTK_WINDOW_GROUP_CLASS
GTK_WINDOW_GROUP_GET_CLASS
<SUBSECTION Private>
GtkWindowGroupPrivate
gtk_window_group_get_type
</SECTION>
@@ -5863,6 +5889,11 @@ gtk_get_micro_version
gtk_get_binary_age
gtk_get_interface_age
gtk_check_version
gtk_major_version
gtk_minor_version
gtk_micro_version
gtk_binary_age
gtk_interface_age
<SUBSECTION>
GTK_MAJOR_VERSION
@@ -5970,6 +6001,7 @@ GTK_STYLE_PROPERTIES
GTK_STYLE_PROPERTIES_CLASS
GTK_STYLE_PROPERTIES_GET_CLASS
<SUBSECTION Private>
GtkStylePropertiesPrivate
gtk_style_properties_get_type
</SECTION>
@@ -5997,6 +6029,7 @@ GTK_STYLE_CLASS_BUTTON
GTK_STYLE_CLASS_CALENDAR
GTK_STYLE_CLASS_CELL
GTK_STYLE_CLASS_COMBOBOX_ENTRY
GTK_STYLE_CLASS_CONTEXT_MENU
GTK_STYLE_CLASS_CHECK
GTK_STYLE_CLASS_CSD
GTK_STYLE_CLASS_CURSOR_HANDLE
@@ -6037,12 +6070,14 @@ GTK_STYLE_CLASS_OVERSHOOT
GTK_STYLE_CLASS_PANE_SEPARATOR
GTK_STYLE_CLASS_PAPER
GTK_STYLE_CLASS_POPUP
GTK_STYLE_CLASS_POPOVER
GTK_STYLE_CLASS_PRIMARY_TOOLBAR
GTK_STYLE_CLASS_PROGRESSBAR
GTK_STYLE_CLASS_PULSE
GTK_STYLE_CLASS_QUESTION
GTK_STYLE_CLASS_RADIO
GTK_STYLE_CLASS_RAISED
GTK_STYLE_CLASS_READ_ONLY
GTK_STYLE_CLASS_RIGHT
GTK_STYLE_CLASS_RUBBERBAND
GTK_STYLE_CLASS_SCALE
@@ -6062,6 +6097,7 @@ GTK_STYLE_CLASS_TITLE
GTK_STYLE_CLASS_TITLEBAR
GTK_STYLE_CLASS_TOOLBAR
GTK_STYLE_CLASS_TOOLTIP
GTK_STYLE_CLASS_TOUCH_SELECTION
GTK_STYLE_CLASS_TOP
GTK_STYLE_CLASS_TROUGH
GTK_STYLE_CLASS_UNDERSHOOT
@@ -6170,6 +6206,7 @@ GTK_IS_STYLE_CONTEXT_CLASS
GTK_TYPE_BORDER
<SUBSECTION Private>
GtkStyleContextPrivate
gtk_style_context_get_type
gtk_border_get_type
</SECTION>
@@ -6208,6 +6245,8 @@ GTK_CSS_PROVIDER_GET_CLASS
GTK_IS_CSS_PROVIDER
GTK_IS_CSS_PROVIDER_CLASS
<SUBSECTION Private>
GTK_TYPE_CSS_SECTION
GtkCssProviderPrivate
gtk_css_provider_get_type
gtk_css_provider_error_quark
gtk_css_section_get_type
@@ -6721,6 +6760,8 @@ GTK_STOCK_ZOOM_100
GTK_STOCK_ZOOM_FIT
GTK_STOCK_ZOOM_IN
GTK_STOCK_ZOOM_OUT
<SUBSECTION Private>
GtkStock
</SECTION>
<SECTION>
@@ -6782,6 +6823,7 @@ gtk_icon_info_get_attach_points
gtk_icon_info_get_display_name
gtk_icon_info_is_symbolic
<SUBSECTION Standard>
GtkIconInfoClass
GTK_ICON_THEME
GTK_IS_ICON_THEME
GTK_TYPE_ICON_THEME
@@ -6791,6 +6833,11 @@ GTK_IS_ICON_THEME_CLASS
GTK_ICON_THEME_GET_CLASS
gtk_icon_info_get_type
GTK_TYPE_ICON_INFO
GTK_ICON_INFO
GTK_ICON_INFO_CLASS
GTK_ICON_INFO_GET_CLASS
GTK_IS_ICON_INFO
GTK_IS_ICON_INFO_CLASS
<SUBSECTION Private>
GtkIconThemePrivate
gtk_icon_theme_error_quark
@@ -7155,6 +7202,7 @@ gtk_print_settings_get_type
<TITLE>GtkPaperSize</TITLE>
GtkPaperSize
GtkUnit
GTK_UNIT_PIXEL
GTK_PAPER_NAME_A3
GTK_PAPER_NAME_A4
GTK_PAPER_NAME_A5
@@ -7809,6 +7857,7 @@ GTK_IS_ACTION_BAR_CLASS
GTK_ACTION_BAR_GET_CLASS
<SUBSECTION Private>
GtkActionBarPrivate
gtk_action_bar_get_type
</SECTION>
@@ -7841,6 +7890,7 @@ GTK_IS_HEADER_BAR_CLASS
GTK_HEADER_BAR_GET_CLASS
<SUBSECTION Private>
GtkHeaderBarPrivate
gtk_header_bar_get_type
</SECTION>
@@ -7869,6 +7919,14 @@ GtkStackTransitionType
gtk_stack_set_transition_type
gtk_stack_get_transition_type
gtk_stack_get_transition_running
<SUBSECTION Standard>
GTK_TYPE_STACK
GTK_IS_STACK
GTK_IS_STACK_CLASS
GTK_STACK
GTK_STACK_CLASS
GTK_STACK_GET_CLASS
<SUBSECTION Private>
gtk_stack_get_type
</SECTION>
@@ -7880,6 +7938,14 @@ GtkStackSwitcher
gtk_stack_switcher_new
gtk_stack_switcher_set_stack
gtk_stack_switcher_get_stack
<SUBSECTION Standard>
GTK_TYPE_STACK_SWITCHER
GTK_IS_STACK_SWITCHER
GTK_IS_STACK_SWITCHER_CLASS
GTK_STACK_SWITCHER
GTK_STACK_SWITCHER_CLASS
GTK_STACK_SWITCHER_GET_CLASS
<SUBSECTION Private>
gtk_stack_switcher_get_type
</SECTION>
@@ -7898,6 +7964,15 @@ gtk_revealer_set_transition_duration
GtkRevealerTransitionType
gtk_revealer_get_transition_type
gtk_revealer_set_transition_type
<SUBSECTION Standard>
GTK_TYPE_REVEALER
GTK_IS_REVEALER
GTK_IS_REVEALER_CLASS
GTK_REVEALER
GTK_REVEALER_CLASS
GTK_REVEALER_GET_CLASS
<SUBSECTION Private>
gtk_revealer_get_type
</SECTION>
@@ -7949,6 +8024,24 @@ gtk_flow_box_child_new
gtk_flow_box_child_get_index
gtk_flow_box_child_is_selected
gtk_flow_box_child_changed
<SUBSECTION Standard>
GtkFlowBoxChildClass
GTK_TYPE_FLOW_BOX
GTK_TYPE_FLOW_BOX_CHILD
GTK_FLOW_BOX
GTK_FLOW_BOX_CLASS
GTK_FLOW_BOX_GET_CLASS
GTK_IS_FLOW_BOX
GTK_IS_FLOW_BOX_CLASS
GTK_FLOW_BOX_CHILD
GTK_FLOW_BOX_CHILD_CLASS
GTK_FLOW_BOX_CHILD_GET_CLASS
GTK_IS_FLOW_BOX_CHILD
GTK_IS_FLOW_BOX_CHILD_CLASS
<SUBSECTION Private>
gtk_flow_box_get_type
gtk_flow_box_child_get_type
</SECTION>
<SECTION>
@@ -7968,7 +8061,18 @@ gtk_popover_set_modal
gtk_popover_get_modal
gtk_popover_set_transitions_enabled
gtk_popover_get_transitions_enabled
<SUBSECTION Standard>
GTK_TYPE_POPOVER
GTK_IS_POPOVER
GTK_IS_POPOVER_CLASS
GTK_IS_POPOVER_MENU
GTK_IS_POPOVER_MENU_CLASS
GTK_POPOVER
GTK_POPOVER_CLASS
GTK_POPOVER_GET_CLASS
<SUBSECTION Private>
GtkPopoverPrivate
gtk_popover_get_type
</SECTION>
@@ -7978,6 +8082,15 @@ gtk_popover_get_type
GtkPopoverMenu
gtk_popover_menu_new
gtk_popover_menu_open_submenu
<SUBSECTION Standard>
GTK_TYPE_POPOVER_MENU
GTK_IS_POPOVER_MENU
GTK_IS_POPOVER_MENU_CLASS
GTK_POPOVER_MENU
GTK_POPOVER_MENU_CLASS
GTK_POPOVER_MENU_GET_CLASS
<SUBSECTION Private>
gtk_popover_menu_get_type
</SECTION>
@@ -7988,6 +8101,12 @@ gtk_popover_menu_get_type
GtkModelButton
GtkButtonRole
gtk_model_button_new
<SUBSECTION Standard>
GTK_TYPE_MODEL_BUTTON
GTK_MODEL_BUTTON
GTK_IS_MODEL_BUTTON
<SUBSECTION Private>
gtk_model_button_get_type
</SECTION>
<SECTION>
@@ -8007,6 +8126,7 @@ GTK_EVENT_CONTROLLER
GTK_EVENT_CONTROLLER_CLASS
GTK_IS_EVENT_CONTROLLER
GTK_EVENT_CONTROLLER_GET_CLASS
GTK_IS_EVENT_CONTROLLER_CLASS
<SUBSECTION Private>
GtkEventControllerPriv
@@ -8224,11 +8344,11 @@ gtk_stack_sidebar_set_stack
gtk_stack_sidebar_get_stack
<SUBSECTION Standard>
GTK_TYPE_SIDEBAR
GTK_TYPE_STACK_SIDEBAR
GTK_STACK_SIDEBAR
GTK_STACK_SIDEBAR_CLASS
GTK_IS_SIDEBAR
GTK_IS_SIDEBAR_CLASS
GTK_IS_STACK_SIDEBAR
GTK_IS_STACK_SIDEBAR_CLASS
GTK_STACK_SIDEBAR_GET_CLASS
<SUBSECTION Private>
@@ -8244,6 +8364,7 @@ gtk_gl_area_new
gtk_gl_area_get_context
gtk_gl_area_make_current
gtk_gl_area_queue_render
gtk_gl_area_attach_buffers
gtk_gl_area_set_error
gtk_gl_area_get_error
<SUBSECTION>
@@ -8255,10 +8376,13 @@ gtk_gl_area_set_has_stencil_buffer
gtk_gl_area_get_has_stencil_buffer
gtk_gl_area_set_auto_render
gtk_gl_area_get_auto_render
gtk_gl_area_get_required_version
gtk_gl_area_set_required_version
<SUBSECTION Standard>
GTK_TYPE_GL_AREA
GTK_GL_AREA
GTK_GL_AREA_CLASS
GTK_GL_AREA_GET_CLASS
GTK_IS_GL_AREA
GTK_IS_GL_AREA_CLASS
<SUBSECTION Private>
+70 -16
View File
@@ -59,6 +59,7 @@ struct _GdkWaylandCursor
} surface;
struct wl_cursor *wl_cursor;
int scale;
};
struct _GdkWaylandCursorClass
@@ -83,11 +84,18 @@ _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display)
}
static gboolean
set_cursor_from_theme (GdkWaylandCursor *cursor,
struct wl_cursor_theme *theme)
_gdk_wayland_cursor_update (GdkWaylandDisplay *wayland_display,
GdkWaylandCursor *cursor)
{
struct wl_cursor *c;
struct wl_cursor_theme *theme;
/* Do nothing if this is not a wl_cursor cursor. */
if (cursor->name == NULL)
return FALSE;
theme = _gdk_wayland_display_get_scaled_cursor_theme (wayland_display,
cursor->scale);
c = wl_cursor_theme_get_cursor (theme, cursor->name);
if (!c)
{
@@ -106,8 +114,7 @@ set_cursor_from_theme (GdkWaylandCursor *cursor,
}
void
_gdk_wayland_display_update_cursors (GdkWaylandDisplay *display,
struct wl_cursor_theme *theme)
_gdk_wayland_display_update_cursors (GdkWaylandDisplay *display)
{
GHashTableIter iter;
const char *name;
@@ -116,7 +123,7 @@ _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display,
g_hash_table_iter_init (&iter, display->cursor_cache);
while (g_hash_table_iter_next (&iter, (gpointer *) &name, (gpointer *) &cursor))
set_cursor_from_theme (cursor, theme);
_gdk_wayland_cursor_update (display, cursor);
}
static void
@@ -169,11 +176,11 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
*w = image->width;
*h = image->height;
*scale = 1;
*scale = wayland_cursor->scale;
return wl_cursor_image_get_buffer (image);
}
else /* From surface */
else if (wayland_cursor->name == NULL) /* From surface */
{
*hotspot_x = wayland_cursor->surface.hotspot_x;
*hotspot_y = wayland_cursor->surface.hotspot_y;
@@ -186,9 +193,9 @@ _gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
if (wayland_cursor->surface.cairo_surface)
return _gdk_wayland_shm_surface_get_wl_buffer (wayland_cursor->surface.cairo_surface);
else
return NULL;
}
return NULL;
}
guint
@@ -217,6 +224,28 @@ _gdk_wayland_cursor_get_next_image_index (GdkCursor *cursor,
return current_image_index;
}
void
_gdk_wayland_cursor_set_scale (GdkCursor *cursor,
guint scale)
{
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (gdk_cursor_get_display (cursor));
GdkWaylandCursor *wayland_cursor = GDK_WAYLAND_CURSOR (cursor);
if (scale > GDK_WAYLAND_MAX_THEME_SCALE)
{
g_warning (G_STRLOC ": cursor theme size %u too large", scale);
scale = GDK_WAYLAND_MAX_THEME_SCALE;
}
if (wayland_cursor->scale == scale)
return;
wayland_cursor->scale = scale;
_gdk_wayland_cursor_update (wayland_display, wayland_cursor);
}
static void
_gdk_wayland_cursor_class_init (GdkWaylandCursorClass *wayland_cursor_class)
{
@@ -233,9 +262,15 @@ _gdk_wayland_cursor_init (GdkWaylandCursor *cursor)
{
}
static GdkCursor *
_gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
const gchar *name,
guint scale);
GdkCursor *
_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type)
_gdk_wayland_display_get_cursor_for_type_with_scale (GdkDisplay *display,
GdkCursorType cursor_type,
guint scale)
{
GEnumClass *enum_class;
GEnumValue *enum_value;
@@ -248,7 +283,9 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
g_strdelimit (cursor_name, "-", '_');
g_type_class_unref (enum_class);
result = _gdk_wayland_display_get_cursor_for_name (display, cursor_name);
result = _gdk_wayland_display_get_cursor_for_name_with_scale (display,
cursor_name,
scale);
g_free (cursor_name);
@@ -256,8 +293,18 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
}
GdkCursor *
_gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type)
{
return _gdk_wayland_display_get_cursor_for_type_with_scale (display,
cursor_type,
1);
}
static GdkCursor *
_gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
const gchar *name,
guint scale)
{
GdkWaylandCursor *private;
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
@@ -273,13 +320,13 @@ _gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
"display", display,
NULL);
private->name = g_strdup (name);
private->surface.scale = 1;
private->scale = scale;
/* Blank cursor case */
if (!name || g_str_equal (name, "blank_cursor"))
return GDK_CURSOR (private);
if (!set_cursor_from_theme (private, wayland_display->cursor_theme))
if (!_gdk_wayland_cursor_update (wayland_display, private))
return GDK_CURSOR (private);
/* Insert into cache. */
@@ -287,6 +334,13 @@ _gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
return GDK_CURSOR (private);
}
GdkCursor *
_gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
{
return _gdk_wayland_display_get_cursor_for_name_with_scale (display, name, 1);
}
GdkCursor *
_gdk_wayland_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
+87 -1
View File
@@ -93,6 +93,8 @@ struct _GdkWaylandDeviceData
GdkDragContext *drop_context;
struct wl_surface *pointer_surface;
guint current_output_scale;
GSList *pointer_surface_outputs;
};
struct _GdkWaylandDevice
@@ -253,7 +255,15 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
* the default cursor
*/
if (!cursor)
cursor = _gdk_wayland_display_get_cursor_for_type (device->display, GDK_LEFT_PTR);
{
guint scale = wd->current_output_scale;
cursor =
_gdk_wayland_display_get_cursor_for_type_with_scale (wd->display,
GDK_LEFT_PTR,
scale);
}
else
_gdk_wayland_cursor_set_scale (cursor, wd->current_output_scale);
if (cursor == wd->cursor)
return;
@@ -1756,6 +1766,78 @@ init_devices (GdkWaylandDeviceData *device)
_gdk_device_set_associated_device (device->master_keyboard, device->master_pointer);
}
static void
pointer_surface_update_scale (GdkWaylandDeviceData *device)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (device->display);
guint32 scale;
GSList *l;
if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
{
/* We can't set the scale on this surface */
return;
}
scale = 1;
for (l = device->pointer_surface_outputs; l != NULL; l = l->next)
{
guint32 output_scale =
_gdk_wayland_screen_get_output_scale (wayland_display->screen,
l->data);
scale = MAX (scale, output_scale);
}
device->current_output_scale = scale;
if (device->grab_cursor)
_gdk_wayland_cursor_set_scale (device->grab_cursor, scale);
if (device->cursor)
_gdk_wayland_cursor_set_scale (device->cursor, scale);
gdk_wayland_device_update_window_cursor (device);
}
static void
pointer_surface_enter (void *data,
struct wl_surface *wl_surface,
struct wl_output *output)
{
GdkWaylandDeviceData *device = data;
GDK_NOTE (EVENTS,
g_message ("pointer surface of device %p entered output %p",
device, output));
device->pointer_surface_outputs =
g_slist_append (device->pointer_surface_outputs, output);
pointer_surface_update_scale (device);
}
static void
pointer_surface_leave (void *data,
struct wl_surface *wl_surface,
struct wl_output *output)
{
GdkWaylandDeviceData *device = data;
GDK_NOTE (EVENTS,
g_message ("pointer surface of device %p left output %p",
device, output));
device->pointer_surface_outputs =
g_slist_remove (device->pointer_surface_outputs, output);
pointer_surface_update_scale (device);
}
static const struct wl_surface_listener pointer_surface_listener = {
pointer_surface_enter,
pointer_surface_leave
};
void
_gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
guint32 id,
@@ -1786,8 +1868,12 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
wl_data_device_add_listener (device->data_device,
&data_device_listener, device);
device->current_output_scale = 1;
device->pointer_surface =
wl_compositor_create_surface (display_wayland->compositor);
wl_surface_add_listener (device->pointer_surface,
&pointer_surface_listener,
device);
init_devices (device);
}
+47 -6
View File
@@ -69,8 +69,6 @@
* ]|
*/
#define SUPPORTED_GTK_SHELL_VERSION 1
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display);
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
@@ -581,10 +579,15 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
struct wl_cursor_theme *theme;
int i;
g_assert (wayland_display);
g_assert (wayland_display->shm);
if (g_strcmp0 (name, wayland_display->cursor_theme_name) == 0 &&
wayland_display->cursor_theme_size == size)
return;
theme = wl_cursor_theme_load (name, size, wayland_display->shm);
if (theme == NULL)
{
@@ -592,11 +595,49 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
return;
}
_gdk_wayland_display_update_cursors (wayland_display, theme);
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
{
if (wayland_display->scaled_cursor_themes[i])
{
wl_cursor_theme_destroy (wayland_display->scaled_cursor_themes[i]);
wayland_display->scaled_cursor_themes[i] = NULL;
}
}
wayland_display->scaled_cursor_themes[0] = theme;
if (wayland_display->cursor_theme_name != NULL)
free (wayland_display->cursor_theme_name);
wayland_display->cursor_theme_name = g_strdup (name);
wayland_display->cursor_theme_size = size;
if (wayland_display->cursor_theme != NULL)
wl_cursor_theme_destroy (wayland_display->cursor_theme);
wayland_display->cursor_theme = theme;
_gdk_wayland_display_update_cursors (wayland_display);
}
struct wl_cursor_theme *
_gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *wayland_display,
guint scale)
{
struct wl_cursor_theme *theme;
g_assert (wayland_display->cursor_theme_name);
g_assert (scale <= GDK_WAYLAND_MAX_THEME_SCALE);
g_assert (scale >= 1);
theme = wayland_display->scaled_cursor_themes[scale - 1];
if (!theme)
{
theme = wl_cursor_theme_load (wayland_display->cursor_theme_name,
wayland_display->cursor_theme_size * scale,
wayland_display->shm);
if (theme == NULL)
{
g_warning ("Failed to load cursor theme %s with scale %u\n",
wayland_display->cursor_theme_name, scale);
return NULL;
}
wayland_display->scaled_cursor_themes[scale - 1] = theme;
}
return theme;
}
static void
+6 -1
View File
@@ -42,6 +42,9 @@
G_BEGIN_DECLS
#define GDK_WAYLAND_MAX_THEME_SCALE 2
#define GDK_WAYLAND_THEME_SCALES_COUNT GDK_WAYLAND_MAX_THEME_SCALE
typedef struct _GdkWaylandSelection GdkWaylandSelection;
struct _GdkWaylandDisplay
@@ -69,7 +72,9 @@ struct _GdkWaylandDisplay
struct wl_data_device_manager *data_device_manager;
struct wl_subcompositor *subcompositor;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
gchar *cursor_theme_name;
int cursor_theme_size;
GHashTable *cursor_cache;
GSource *event_source;
+14 -2
View File
@@ -40,6 +40,10 @@
#include "config.h"
#define WL_SURFACE_HAS_BUFFER_SCALE 3
#define SUPPORTED_GTK_SHELL_VERSION 1
#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))
GdkKeymap *_gdk_wayland_keymap_new (void);
@@ -54,11 +58,16 @@ gboolean _gdk_wayland_keymap_key_is_modifier (GdkKeymap *keymap,
void _gdk_wayland_display_init_cursors (GdkWaylandDisplay *display);
void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display,
struct wl_cursor_theme *theme);
void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display);
struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *wayland_display,
guint scale);
GdkCursor *_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type);
GdkCursor *_gdk_wayland_display_get_cursor_for_type_with_scale (GdkDisplay *display,
GdkCursorType cursor_type,
guint scale);
GdkCursor *_gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_wayland_display_get_cursor_for_surface (GdkDisplay *display,
@@ -85,6 +94,9 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkCursor *cursor,
guint current_image_index,
guint *next_image_delay);
void _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
guint scale);
GdkDragProtocol _gdk_wayland_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target);
+21 -15
View File
@@ -416,9 +416,11 @@ async_write_data_cb (GObject *object,
res, &error);
if (error)
{
g_warning ("Error writing selection data: %s", error->message);
g_error_free (error);
if (error->domain != G_IO_ERROR ||
error->code != G_IO_ERROR_CANCELLED)
g_warning ("Error writing selection data: %s", error->message);
g_error_free (error);
async_write_data_free (write_data);
return;
}
@@ -558,12 +560,12 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
else
return FALSE;
if (fd >= 0)
wayland_selection->stored_selection.fd = fd;
if (wayland_selection->source_requested_target == target)
if (wayland_selection->stored_selection.fd == fd &&
wayland_selection->source_requested_target == target)
return FALSE;
wayland_selection->stored_selection.fd = fd;
wayland_selection->source_requested_target = target;
if (window && target != GDK_NONE)
@@ -668,16 +670,19 @@ data_source_cancelled (void *data,
g_debug (G_STRLOC ": %s source = %p",
G_STRFUNC, source);
context = gdk_wayland_drag_context_lookup_by_data_source (source);
display = gdk_window_get_display (context->source_window);
display = gdk_display_get_default ();
if (source == wayland_selection->dnd_source)
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]);
{
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]);
context = gdk_wayland_drag_context_lookup_by_data_source (source);
if (context)
gdk_wayland_drag_context_undo_grab (context);
}
else if (source == wayland_selection->clipboard_source)
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_CLIPBOARD]);
if (context)
gdk_wayland_drag_context_undo_grab (context);
}
static const struct wl_data_source_listener data_source_listener = {
@@ -893,9 +898,10 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
return;
}
wl_data_offer_accept (wayland_selection->offer,
_gdk_wayland_display_get_serial (GDK_WAYLAND_DISPLAY (display)),
gdk_atom_name (target));
if (target != gdk_atom_intern_static_string ("TARGETS"))
wl_data_offer_accept (wayland_selection->offer,
_gdk_wayland_display_get_serial (GDK_WAYLAND_DISPLAY (display)),
gdk_atom_name (target));
buffer_data = g_hash_table_lookup (wayland_selection->selection_buffers,
target);
-3
View File
@@ -37,8 +37,6 @@
#include <string.h>
#include <errno.h>
#define WL_SURFACE_HAS_BUFFER_SCALE 3
#define WINDOW_IS_TOPLEVEL_OR_FOREIGN(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
@@ -872,7 +870,6 @@ gdk_wayland_window_create_surface (GdkWindow *window)
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
impl->surface = wl_compositor_create_surface (display_wayland->compositor);
wl_surface_set_user_data (impl->surface, window);
wl_surface_add_listener (impl->surface, &surface_listener, window);
gdk_wayland_window_sync_opaque_region (window);
+13 -2
View File
@@ -397,9 +397,12 @@ gtk_private_h_sources = \
gtkcsskeyframesprivate.h \
gtkcsslookupprivate.h \
gtkcssmatcherprivate.h \
gtkcssnodeprivate.h \
gtkcssnodedeclarationprivate.h \
gtkcssnodeutilsprivate.h \
gtkcssnumbervalueprivate.h \
gtkcssparserprivate.h \
gtkcsspathnodeprivate.h \
gtkcsspositionvalueprivate.h \
gtkcssproviderprivate.h \
gtkcssrepeatvalueprivate.h \
@@ -415,10 +418,12 @@ gtk_private_h_sources = \
gtkcssstyleprivate.h \
gtkcssstylepropertyprivate.h \
gtkcsstransformvalueprivate.h \
gtkcsstransientnodeprivate.h \
gtkcsstransitionprivate.h \
gtkcsstypedvalueprivate.h \
gtkcssunsetvalueprivate.h \
gtkcssvalueprivate.h \
gtkcsswidgetnodeprivate.h \
gtkcustompaperunixdialog.h \
gtkdialogprivate.h \
gtkentryprivate.h \
@@ -500,6 +505,7 @@ gtk_private_h_sources = \
gtkstylecontextprivate.h \
gtkstylepropertyprivate.h \
gtkstyleproviderprivate.h \
gtktextattributesprivate.h \
gtktextbtree.h \
gtktextbufferserialize.h \
gtktextchildprivate.h \
@@ -626,9 +632,12 @@ gtk_base_c_sources = \
gtkcsskeyframes.c \
gtkcsslookup.c \
gtkcssmatcher.c \
gtkcssnode.c \
gtkcssnodedeclaration.c \
gtkcssnodeutils.c \
gtkcssnumbervalue.c \
gtkcssparser.c \
gtkcsspathnode.c \
gtkcsspositionvalue.c \
gtkcssprovider.c \
gtkcssrepeatvalue.c \
@@ -646,11 +655,13 @@ gtk_base_c_sources = \
gtkcssstyleproperty.c \
gtkcssstylepropertyimpl.c \
gtkcsstransformvalue.c \
gtkcsstransientnode.c \
gtkcsstransition.c \
gtkcsstypedvalue.c \
gtkcssunsetvalue.c \
gtkcssvalue.c \
gtkcsstypes.c \
gtkcssvalue.c \
gtkcsswidgetnode.c \
gtkdialog.c \
gtkdrawingarea.c \
gtkeditable.c \
@@ -1121,7 +1132,7 @@ gtktypebuiltins.c: $(gtk_public_h_sources) $(a11y_h_sources) $(deprecated_h_sour
&& cp xgen-gtbc gtktypebuiltins.c \
&& rm -f xgen-gtbc
gtk.gresource.xml: Makefile.am
gtk.gresource.xml: Makefile.am inspector/Makefile.inc
$(AM_V_GEN) echo "<?xml version='1.0' encoding='UTF-8'?>" > $@; \
echo "<gresources>" >> $@; \
echo " <gresource prefix='/org/gtk/libgtk'>" >> $@; \
+19
View File
@@ -18,6 +18,7 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include "gtkmenubuttonaccessible.h"
@@ -84,11 +85,29 @@ gtk_menu_button_accessible_ref_child (AtkObject *obj,
return accessible;
}
static const gchar *
gtk_menu_button_accessible_get_name (AtkObject *obj)
{
const gchar *name = NULL;
GtkWidget *widget;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
if (widget == NULL)
return NULL;
name = ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->get_name (obj);
if (name != NULL)
return name;
return _("Menu");
}
static void
gtk_menu_button_accessible_class_init (GtkMenuButtonAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->get_name = gtk_menu_button_accessible_get_name;
class->initialize = gtk_menu_button_accessible_initialize;
class->get_n_children = gtk_menu_button_accessible_get_n_children;
class->ref_child = gtk_menu_button_accessible_ref_child;
+5 -11
View File
@@ -305,18 +305,16 @@ gtk_gradient_resolve (GtkGradient *gradient,
cairo_pattern_t *
_gtk_gradient_resolve_full (GtkGradient *gradient,
GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies)
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
cairo_pattern_t *pattern;
guint i;
g_return_val_if_fail (gradient != NULL, NULL);
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
g_return_val_if_fail (GTK_IS_CSS_STYLE (values), NULL);
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_STYLE (parent_values), NULL);
g_return_val_if_fail (*dependencies == 0, NULL);
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
if (gradient->radius0 == 0 && gradient->radius1 == 0)
pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
@@ -332,21 +330,17 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
ColorStop *stop;
GtkCssValue *val;
GdkRGBA rgba;
GtkCssDependencies stop_deps;
stop = &g_array_index (gradient->stops, ColorStop, i);
/* if color resolving fails, assume transparency */
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (stop->color),
provider,
gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
GTK_CSS_DEPENDS_ON_COLOR,
&stop_deps,
gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR),
NULL);
if (val)
{
rgba = *_gtk_css_rgba_value_get_rgba (val);
*dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps);
_gtk_css_value_unref (val);
}
else
+2 -3
View File
@@ -25,9 +25,8 @@ G_BEGIN_DECLS
cairo_pattern_t * _gtk_gradient_resolve_full (GtkGradient *gradient,
GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssDependencies *dependencies);
GtkCssStyle *style,
GtkCssStyle *parent_style);
GtkGradient * _gtk_gradient_transition (GtkGradient *start,
GtkGradient *end,
-2
View File
@@ -306,8 +306,6 @@ gtk_symbolic_color_resolve (GtkSymbolicColor *color,
v = _gtk_css_color_value_resolve (color->value,
GTK_STYLE_PROVIDER_PRIVATE (props),
current,
0,
NULL,
NULL);
_gtk_css_value_unref (current);
if (v == NULL)
+127 -77
View File
@@ -77,6 +77,8 @@
#include "gtkbox.h"
#include "gtkboxprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcssnodeutilsprivate.h"
#include "gtkintl.h"
#include "gtkorientable.h"
#include "gtkorientableprivate.h"
@@ -435,14 +437,12 @@ static gboolean
gtk_box_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkStyleContext *context;
GtkAllocation alloc;
context = gtk_widget_get_style_context (widget);
gtk_widget_get_allocation (widget, &alloc);
gtk_render_background (context, cr, 0, 0, alloc.width, alloc.height);
gtk_render_frame (context, cr, 0, 0, alloc.width, alloc.height);
gtk_css_node_draw (gtk_widget_get_css_node (widget),
cr,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget),
NULL,
widget);
return GTK_WIDGET_CLASS (gtk_box_parent_class)->draw (widget, cr);
}
@@ -472,9 +472,13 @@ count_expand_children (GtkBox *box,
}
static void
gtk_box_size_allocate_no_center (GtkWidget *widget,
GtkAllocation *allocation)
gtk_box_size_allocate_no_center (GtkCssNode *cssnode,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET (data);
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *private = box->priv;
GtkBoxChild *child;
@@ -484,12 +488,12 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
GtkTextDirection direction;
GtkAllocation child_allocation;
GtkAllocation child_clip;
GtkRequestedSize *sizes;
gint child_minimum_baseline, child_natural_baseline;
gint minimum_above, natural_above;
gint minimum_below, natural_below;
gboolean have_baseline;
gint baseline;
GtkPackType packing;
@@ -499,8 +503,7 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
gint x = 0, y = 0, i;
gint child_size;
gtk_widget_set_allocation (widget, allocation);
*out_clip = *allocation;
count_expand_children (box, &nvis_children, &nexpand_children);
@@ -679,7 +682,6 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
}
}
baseline = gtk_widget_get_allocated_baseline (widget);
if (baseline == -1 && have_baseline)
{
gint height = MAX (1, allocation->height);
@@ -798,18 +800,21 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
}
}
gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
gtk_widget_get_clip (child->widget, &child_clip);
gdk_rectangle_union (out_clip, out_clip, &child_clip);
i++;
}
}
_gtk_widget_set_simple_clip (widget, NULL);
}
static void
gtk_box_size_allocate_with_center (GtkWidget *widget,
GtkAllocation *allocation)
gtk_box_size_allocate_with_center (GtkCssNode *cssnode,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET (data);
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *priv = box->priv;
GtkBoxChild *child;
@@ -817,14 +822,13 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
gint nvis[2];
gint nexp[2];
GtkTextDirection direction;
GtkAllocation child_allocation;
GtkAllocation child_allocation, child_clip;
GtkRequestedSize *sizes[2];
GtkRequestedSize center_req;
gint child_minimum_baseline, child_natural_baseline;
gint minimum_above, natural_above;
gint minimum_below, natural_below;
gboolean have_baseline;
gint baseline;
gint idx[2];
gint center_pos;
gint center_size;
@@ -838,8 +842,6 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
gint x = 0, y = 0, i;
gint child_size;
gtk_widget_set_allocation (widget, allocation);
nvis[0] = nvis[1] = 0;
nexp[0] = nexp[1] = 0;
for (children = priv->children; children; children = children->next)
@@ -871,6 +873,8 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
min_size[0] = nat_size[0] = nvis[0] * priv->spacing;
min_size[1] = nat_size[1] = nvis[1] * priv->spacing;
*out_clip = *allocation;
/* Retrieve desired size for visible children. */
idx[0] = idx[1] = 0;
for (children = priv->children; children; children = children->next)
@@ -1025,7 +1029,6 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
}
}
baseline = gtk_widget_get_allocated_baseline (widget);
if (baseline == -1 && have_baseline)
{
gint height = MAX (1, allocation->height);
@@ -1139,6 +1142,8 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
}
}
gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
gtk_widget_get_clip (child->widget, &child_clip);
gdk_rectangle_union (out_clip, out_clip, &child_clip);
i++;
}
@@ -1170,9 +1175,10 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
child_allocation.y = center_pos;
child_allocation.height = center_size;
}
gtk_widget_size_allocate_with_baseline (priv->center->widget, &child_allocation, baseline);
_gtk_widget_set_simple_clip (widget, NULL);
gtk_widget_size_allocate_with_baseline (priv->center->widget, &child_allocation, baseline);
gtk_widget_get_clip (priv->center->widget, &child_clip);
gdk_rectangle_union (out_clip, out_clip, &child_clip);
}
static void
@@ -1180,12 +1186,20 @@ gtk_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkBox *box = GTK_BOX (widget);
GtkAllocation clip;
if (box->priv->center &&
gtk_widget_get_visible (box->priv->center->widget))
gtk_box_size_allocate_with_center (widget, allocation);
else
gtk_box_size_allocate_no_center (widget, allocation);
gtk_widget_set_allocation (widget, allocation);
gtk_css_node_allocate (gtk_widget_get_css_node (widget),
allocation,
gtk_widget_get_allocated_baseline (widget),
&clip,
box->priv->center && gtk_widget_get_visible (box->priv->center->widget)
? gtk_box_size_allocate_with_center
: gtk_box_size_allocate_no_center,
box);
gtk_widget_set_clip (widget, &clip);
}
static GType
@@ -1434,17 +1448,25 @@ gtk_box_buildable_init (GtkBuildableIface *iface)
}
static void
gtk_box_invalidate_order_foreach (GtkWidget *widget)
gtk_box_invalidate_order_foreach (GtkWidget *widget,
gpointer prev)
{
_gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
GtkCssNode **previous = prev;
GtkCssNode *cur = gtk_widget_get_css_node (widget);
if (*previous)
gtk_css_node_set_after (cur, *previous);
*previous = cur;
}
static void
gtk_box_invalidate_order (GtkBox *box)
{
GtkCssNode *previous = NULL;
gtk_container_foreach (GTK_CONTAINER (box),
(GtkCallback) gtk_box_invalidate_order_foreach,
NULL);
gtk_box_invalidate_order_foreach,
&previous);
}
static void
@@ -1490,8 +1512,8 @@ gtk_box_pack (GtkBox *box,
gtk_widget_freeze_child_notify (child);
gtk_box_invalidate_order (box);
gtk_widget_set_parent (child, GTK_WIDGET (box));
gtk_box_invalidate_order (box);
g_signal_connect (child, "notify::visible",
G_CALLBACK (box_child_visibility_notify_cb), box);
@@ -1657,22 +1679,6 @@ gtk_box_get_size (GtkWidget *widget,
*natural_baseline = nat_baseline;
}
static void
gtk_box_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
gtk_box_get_size (widget, GTK_ORIENTATION_HORIZONTAL, minimum_size, natural_size, NULL, NULL);
}
static void
gtk_box_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_size, natural_size, NULL, NULL);
}
static void
gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
gint avail_size,
@@ -1956,19 +1962,74 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
*natural_size = required_natural;
}
static void
gtk_box_get_preferred_size (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
gpointer data)
{
GtkWidget *widget = data;
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *priv = box->priv;
if (for_size < 0)
{
gtk_box_get_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
}
else
{
if (priv->orientation == orientation)
gtk_box_compute_size_for_orientation (box, for_size, minimum, natural);
else
gtk_box_compute_size_for_opposing_orientation (box, for_size, minimum, natural, minimum_baseline, natural_baseline);
}
}
static void
gtk_box_get_preferred_width (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
GTK_ORIENTATION_HORIZONTAL,
-1,
minimum_size, natural_size,
NULL, NULL,
gtk_box_get_preferred_size,
widget);
}
static void
gtk_box_get_preferred_height (GtkWidget *widget,
gint *minimum_size,
gint *natural_size)
{
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
GTK_ORIENTATION_VERTICAL,
-1,
minimum_size, natural_size,
NULL, NULL,
gtk_box_get_preferred_size,
widget);
}
static void
gtk_box_get_preferred_width_for_height (GtkWidget *widget,
gint height,
gint *minimum_width,
gint *natural_width)
{
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *private = box->priv;
if (private->orientation == GTK_ORIENTATION_VERTICAL)
gtk_box_compute_size_for_opposing_orientation (box, height, minimum_width, natural_width, NULL, NULL);
else
gtk_box_compute_size_for_orientation (box, height, minimum_width, natural_width);
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
GTK_ORIENTATION_HORIZONTAL,
height,
minimum_width, natural_width,
NULL, NULL,
gtk_box_get_preferred_size,
widget);
}
static void
@@ -1979,24 +2040,13 @@ gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
gint *minimum_baseline,
gint *natural_baseline)
{
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *private = box->priv;
if (width < 0)
gtk_box_get_size (widget, GTK_ORIENTATION_VERTICAL, minimum_height, natural_height, minimum_baseline, natural_baseline);
else
{
if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_box_compute_size_for_opposing_orientation (box, width, minimum_height, natural_height, minimum_baseline, natural_baseline);
else
{
if (minimum_baseline)
*minimum_baseline = -1;
if (natural_baseline)
*natural_baseline = -1;
gtk_box_compute_size_for_orientation (box, width, minimum_height, natural_height);
}
}
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
GTK_ORIENTATION_VERTICAL,
width,
minimum_height, natural_height,
minimum_baseline, natural_baseline,
gtk_box_get_preferred_size,
widget);
}
static void
+5 -9
View File
@@ -111,6 +111,7 @@ gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
priv->icon_helper = _gtk_icon_helper_new ();
_gtk_icon_helper_set_force_scale_pixbuf (priv->icon_helper, TRUE);
priv->icon_size = GTK_ICON_SIZE_MENU;
priv->follow_state = TRUE;
}
static void
@@ -237,6 +238,8 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
* according to the #GtkCellRendererState.
*
* Since: 2.8
*
* Deprecated: 3.16: Cell renderers always follow state.
*/
g_object_class_install_property (object_class,
PROP_FOLLOW_STATE,
@@ -244,8 +247,8 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
P_("Follow State"),
P_("Whether the rendered pixbuf should be "
"colorized according to the state"),
FALSE,
GTK_PARAM_READWRITE));
TRUE,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkCellRendererPixbuf:gicon:
@@ -516,7 +519,6 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
GdkRectangle draw_rect;
gboolean is_expander;
gint xpad, ypad;
GtkStateFlags state;
GtkIconHelper *icon_helper = NULL;
gtk_cell_renderer_pixbuf_get_size (cell, widget, (GdkRectangle *) cell_area,
@@ -537,12 +539,6 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
state = gtk_cell_renderer_get_state (cell, widget, flags);
if (!priv->follow_state)
state &= ~(GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED);
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
g_object_get (cell, "is-expander", &is_expander, NULL);
+1 -12
View File
@@ -1846,19 +1846,8 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
*/
if (container->priv->restyle_pending)
{
GtkBitmask *empty;
gint64 current_time;
empty = _gtk_bitmask_new ();
current_time = g_get_monotonic_time ();
container->priv->restyle_pending = FALSE;
_gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (container)),
current_time,
0,
empty);
_gtk_bitmask_free (empty);
gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)));
}
/* we may be invoked with a container_resize_queue of NULL, because
+22 -16
View File
@@ -63,6 +63,21 @@ gtk_css_animated_style_get_section (GtkCssStyle *style,
return gtk_css_style_get_section (animated->style, id);
}
static gboolean
gtk_css_animated_style_is_static (GtkCssStyle *style)
{
GtkCssAnimatedStyle *animated = GTK_CSS_ANIMATED_STYLE (style);
GSList *list;
for (list = animated->animations; list; list = list->next)
{
if (!_gtk_style_animation_is_static (list->data, animated->current_time))
return FALSE;
}
return TRUE;
}
static void
gtk_css_animated_style_dispose (GObject *object)
{
@@ -101,6 +116,7 @@ gtk_css_animated_style_class_init (GtkCssAnimatedStyleClass *klass)
style_class->get_value = gtk_css_animated_style_get_value;
style_class->get_section = gtk_css_animated_style_get_section;
style_class->is_static = gtk_css_animated_style_is_static;
}
static void
@@ -410,6 +426,9 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
gtk_internal_return_val_if_fail (previous_style == NULL || GTK_IS_CSS_STYLE (previous_style), NULL);
if (timestamp == 0)
return g_object_ref (base_style);
animations = NULL;
if (previous_style != NULL)
@@ -441,6 +460,9 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base), NULL);
if (timestamp == 0)
return g_object_ref (source->style);
animations = NULL;
for (l = source->animations; l; l = l->next)
{
@@ -466,19 +488,3 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
return GTK_CSS_STYLE (result);
}
gboolean
gtk_css_animated_style_is_static (GtkCssAnimatedStyle *style)
{
GSList *list;
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), TRUE);
for (list = style->animations; list; list = list->next)
{
if (!_gtk_style_animation_is_static (list->data, style->current_time))
return FALSE;
}
return TRUE;
}
-2
View File
@@ -68,8 +68,6 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
guint id);
gboolean gtk_css_animated_style_is_static (GtkCssAnimatedStyle *style);
G_END_DECLS
#endif /* __GTK_CSS_ANIMATED_STYLE_PRIVATE_H__ */
+2 -6
View File
@@ -47,20 +47,16 @@ gtk_css_value_array_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *result;
GtkCssValue *i_value;
guint i, j;
GtkCssDependencies child_deps;
result = NULL;
for (i = 0; i < value->n_values; i++)
{
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
if (result == NULL &&
i_value != value->values[i])
+3 -8
View File
@@ -45,25 +45,20 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
if (value->x == NULL && value->y == NULL)
return _gtk_css_value_ref (value);
x_deps = y_deps = 0;
x = y = NULL;
if (value->x)
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style, &x_deps);
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style);
if (value->y)
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style);
return _gtk_css_bg_size_value_new (value->x ? x : NULL,
value->y ? y : NULL);
+2 -5
View File
@@ -46,11 +46,9 @@ gtk_css_value_border_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *computed;
GtkCssDependencies child_deps;
gboolean changed = FALSE;
guint i;
@@ -61,8 +59,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
{
if (value->values[i])
{
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
changed |= (computed->values[i] != value->values[i]);
}
}
+9 -36
View File
@@ -124,8 +124,7 @@ gtk_css_value_color_get_fallback (guint property_id,
property_id,
provider,
style,
parent_style,
NULL);
parent_style);
default:
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
g_warning ("No fallback color defined for property '%s'",
@@ -138,20 +137,13 @@ GtkCssValue *
_gtk_css_color_value_resolve (GtkCssValue *color,
GtkStyleProviderPrivate *provider,
GtkCssValue *current,
GtkCssDependencies current_deps,
GtkCssDependencies *dependencies,
GSList *cycle_list)
{
GtkCssDependencies unused;
GtkCssValue *value;
g_return_val_if_fail (color != NULL, NULL);
g_return_val_if_fail (provider == NULL || GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
if (dependencies == NULL)
dependencies = &unused;
*dependencies = 0;
switch (color->type)
{
case COLOR_TYPE_LITERAL:
@@ -170,7 +162,7 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
if (named == NULL)
return NULL;
value = _gtk_css_color_value_resolve (named, provider, current, current_deps, dependencies, &cycle);
value = _gtk_css_color_value_resolve (named, provider, current, &cycle);
if (value == NULL)
return NULL;
}
@@ -182,12 +174,10 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
GtkHSLA hsla;
GdkRGBA shade;
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, current_deps, dependencies, cycle_list);
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, cycle_list);
if (val == NULL)
return NULL;
*dependencies = _gtk_css_dependencies_union (*dependencies, 0);
_gtk_hsla_init_from_rgba (&hsla, _gtk_css_rgba_value_get_rgba (val));
_gtk_hsla_shade (&hsla, &hsla, color->sym_col.shade.factor);
@@ -204,11 +194,10 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
GtkCssValue *val;
GdkRGBA alpha;
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, current_deps, dependencies, cycle_list);
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, cycle_list);
if (val == NULL)
return NULL;
*dependencies = _gtk_css_dependencies_union (*dependencies, 0);
alpha = *_gtk_css_rgba_value_get_rgba (val);
alpha.alpha = CLAMP (alpha.alpha * color->sym_col.alpha.factor, 0, 1);
@@ -222,21 +211,19 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
{
GtkCssValue *val;
GdkRGBA color1, color2, res;
GtkCssDependencies dep1, dep2;
val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, current_deps, &dep1, cycle_list);
val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, cycle_list);
if (val == NULL)
return NULL;
color1 = *_gtk_css_rgba_value_get_rgba (val);
_gtk_css_value_unref (val);
val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, current_deps, &dep2, cycle_list);
val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, cycle_list);
if (val == NULL)
return NULL;
color2 = *_gtk_css_rgba_value_get_rgba (val);
_gtk_css_value_unref (val);
*dependencies = _gtk_css_dependencies_union (dep1, dep2);
res.red = CLAMP (color1.red + ((color2.red - color1.red) * color->sym_col.mix.factor), 0, 1);
res.green = CLAMP (color1.green + ((color2.green - color1.green) * color->sym_col.mix.factor), 0, 1);
res.blue = CLAMP (color1.blue + ((color2.blue - color1.blue) * color->sym_col.mix.factor), 0, 1);
@@ -262,7 +249,6 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
case COLOR_TYPE_CURRENT_COLOR:
if (current)
{
*dependencies = current_deps;
return _gtk_css_value_ref (current);
}
else
@@ -270,8 +256,6 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
return _gtk_css_color_value_resolve (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR)),
provider,
NULL,
0,
dependencies,
cycle_list);
}
break;
@@ -301,11 +285,9 @@ gtk_css_value_color_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *resolved, *current;
GtkCssDependencies current_deps;
/* The computed value of the currentColor keyword is the computed
* value of the color property. If the currentColor keyword is
@@ -314,27 +296,18 @@ gtk_css_value_color_compute (GtkCssValue *value,
if (property_id == GTK_CSS_PROPERTY_COLOR)
{
if (parent_style)
{
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_EQUALS_PARENT;
}
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
else
{
current = NULL;
current_deps = 0;
}
current = NULL;
}
else
{
current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
current_deps = GTK_CSS_DEPENDS_ON_COLOR;
}
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
current_deps,
dependencies,
NULL);
if (resolved == NULL)
-2
View File
@@ -46,8 +46,6 @@ GtkCssValue * _gtk_css_color_value_parse (GtkCssParser *parser)
GtkCssValue * _gtk_css_color_value_resolve (GtkCssValue *color,
GtkStyleProviderPrivate *provider,
GtkCssValue *current,
GtkCssDependencies current_deps,
GtkCssDependencies *dependencies,
GSList *cycle_list);
+3 -6
View File
@@ -41,15 +41,12 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style, &x_deps);
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style);
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style);
if (x == corner->x && y == corner->y)
{
_gtk_css_value_unref (x);
+1 -2
View File
@@ -54,8 +54,7 @@ gtk_css_value_ease_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
+1 -2
View File
@@ -40,8 +40,7 @@ gtk_css_value_engine_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
+3 -10
View File
@@ -42,8 +42,7 @@ gtk_css_value_enum_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
@@ -165,8 +164,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
double font_size;
@@ -197,7 +195,6 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
font_size = _gtk_css_font_size_get_default (provider) * 2;
break;
case GTK_CSS_FONT_SIZE_SMALLER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_style)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
@@ -206,7 +203,6 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
font_size /= 1.2;
break;
case GTK_CSS_FONT_SIZE_LARGER:
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_style)
font_size = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
@@ -376,8 +372,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
PangoWeight new_weight;
int parent_value;
@@ -385,8 +380,6 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
if (value->value >= 0)
return _gtk_css_value_ref (value);
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_style)
parent_value = gtk_css_style_get_value (parent_style, property_id)->value;
else
+1 -2
View File
@@ -74,8 +74,7 @@ gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *result;
GtkIconTheme *icontheme;
+3 -10
View File
@@ -65,8 +65,7 @@ gtk_css_image_real_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return g_object_ref (image);
}
@@ -149,23 +148,17 @@ _gtk_css_image_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssDependencies unused;
GtkCssImageClass *klass;
g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
if (dependencies == NULL)
dependencies = &unused;
*dependencies = 0;
klass = GTK_CSS_IMAGE_GET_CLASS (image);
return klass->compute (image, property_id, provider, style, parent_style, dependencies);
return klass->compute (image, property_id, provider, style, parent_style);
}
GtkCssImage *
+1 -5
View File
@@ -806,8 +806,7 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImageBuiltin *result;
GtkBorderStyle border_style;
@@ -832,9 +831,6 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
result->bg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
result->border_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
/* XXX: We also depend on other values, but I guess we cannot express that */
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
return GTK_CSS_IMAGE (result);
}
+2 -3
View File
@@ -35,8 +35,7 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImageGradient *gradient = GTK_CSS_IMAGE_GRADIENT (image);
GtkCssImageGradient *copy;
@@ -46,7 +45,7 @@ gtk_css_image_gradient_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_GRADIENT, NULL);
copy->gradient = gtk_gradient_ref (gradient->gradient);
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, style, parent_style, dependencies);
copy->pattern = _gtk_gradient_resolve_full (copy->gradient, provider, style, parent_style);
return GTK_CSS_IMAGE (copy);
}
+1 -4
View File
@@ -129,8 +129,7 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
GtkCssImageIconTheme *copy;
@@ -149,8 +148,6 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
copy->scale = _gtk_style_provider_private_get_scale (provider);
copy->color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
return GTK_CSS_IMAGE (copy);
}
+4 -8
View File
@@ -432,8 +432,7 @@ gtk_css_image_linear_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
GtkCssImageLinear *copy;
@@ -442,24 +441,21 @@ gtk_css_image_linear_compute (GtkCssImage *image,
copy = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
copy->repeating = linear->repeating;
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style, dependencies);
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style);
g_array_set_size (copy->stops, linear->stops->len);
for (i = 0; i < linear->stops->len; i++)
{
GtkCssImageLinearColorStop *stop, *scopy;
GtkCssDependencies child_deps;
stop = &g_array_index (linear->stops, GtkCssImageLinearColorStop, i);
scopy = &g_array_index (copy->stops, GtkCssImageLinearColorStop, i);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
if (stop->offset)
{
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
}
else
{
+2 -4
View File
@@ -59,8 +59,7 @@ struct _GtkCssImageClass
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies);
GtkCssStyle *parent_style);
/* compare two images for equality */
gboolean (* equal) (GtkCssImage *image1,
GtkCssImage *image2);
@@ -96,8 +95,7 @@ GtkCssImage * _gtk_css_image_compute (GtkCssImage *
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies);
GtkCssStyle *parent_style);
gboolean _gtk_css_image_equal (GtkCssImage *image1,
GtkCssImage *image2);
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,
+2 -4
View File
@@ -97,8 +97,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
GtkCssImageScaled *copy;
@@ -122,8 +121,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
property_id,
provider,
style,
parent_style,
dependencies);
parent_style);
else
copy->images[i] = g_object_ref (scaled->images[i]);
}
+1 -2
View File
@@ -124,8 +124,7 @@ gtk_css_image_url_compute (GtkCssImage *image,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
+2 -3
View File
@@ -38,8 +38,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssImage *image, *computed;
@@ -48,7 +47,7 @@ gtk_css_value_image_compute (GtkCssValue *value,
if (image == NULL)
return _gtk_css_value_ref (value);
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style, dependencies);
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style);
if (computed == image)
{
+2 -5
View File
@@ -38,12 +38,10 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
if (parent_style)
{
*dependencies = GTK_CSS_EQUALS_PARENT;
return _gtk_css_value_ref (gtk_css_style_get_value (parent_style, property_id));
}
else
@@ -52,8 +50,7 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style,
dependencies);
parent_style);
}
}
+2 -4
View File
@@ -42,8 +42,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkSettings *settings;
@@ -94,8 +93,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style,
dependencies);
parent_style);
}
static gboolean
+1 -2
View File
@@ -466,8 +466,7 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
resolved->property_ids[p],
provider,
style,
parent_style,
NULL);
parent_style);
}
}
+233 -3
View File
@@ -19,6 +19,8 @@
#include "gtkcssmatcherprivate.h"
#include "gtkcssnodedeclarationprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetpath.h"
/* GTK_CSS_MATCHER_WIDGET_PATH */
@@ -31,6 +33,7 @@ gtk_css_matcher_widget_path_get_parent (GtkCssMatcher *matcher,
return FALSE;
matcher->path.klass = child->path.klass;
matcher->path.decl = NULL;
matcher->path.path = child->path.path;
matcher->path.index = child->path.index - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index);
@@ -46,6 +49,7 @@ gtk_css_matcher_widget_path_get_previous (GtkCssMatcher *matcher,
return FALSE;
matcher->path.klass = next->path.klass;
matcher->path.decl = NULL;
matcher->path.path = next->path.path;
matcher->path.index = next->path.index;
matcher->path.sibling_index = next->path.sibling_index - 1;
@@ -58,6 +62,9 @@ gtk_css_matcher_widget_path_get_state (const GtkCssMatcher *matcher)
{
const GtkWidgetPath *siblings;
if (matcher->path.decl)
return gtk_css_node_declaration_get_state (matcher->path.decl);
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
return gtk_widget_path_iter_get_state (siblings, matcher->path.sibling_index);
@@ -84,6 +91,10 @@ gtk_css_matcher_widget_path_has_class (const GtkCssMatcher *matcher,
{
const GtkWidgetPath *siblings;
if (matcher->path.decl &&
gtk_css_node_declaration_has_class (matcher->path.decl, class_name))
return TRUE;
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
return gtk_widget_path_iter_has_qclass (siblings, matcher->path.sibling_index, class_name);
@@ -111,6 +122,16 @@ gtk_css_matcher_widget_path_has_regions (const GtkCssMatcher *matcher)
GSList *regions;
gboolean result;
if (matcher->path.decl)
{
GList *list = gtk_css_node_declaration_list_regions (matcher->path.decl);
if (list)
{
g_list_free (list);
return TRUE;
}
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
@@ -132,6 +153,14 @@ gtk_css_matcher_widget_path_has_region (const GtkCssMatcher *matcher,
const GtkWidgetPath *siblings;
GtkRegionFlags region_flags;
if (matcher->path.decl)
{
GQuark q = g_quark_try_string (region);
if (q && gtk_css_node_declaration_has_region (matcher->path.decl, q, &region_flags))
goto found;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
@@ -144,12 +173,13 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!gtk_widget_path_iter_has_region (matcher->path.path, matcher->path.index, region, &region_flags))
return FALSE;
}
G_GNUC_END_IGNORE_DEPRECATIONS
found:
if ((flags & region_flags) != flags)
return FALSE;
return TRUE;
G_GNUC_END_IGNORE_DEPRECATIONS
}
static gboolean
@@ -195,13 +225,15 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
};
gboolean
_gtk_css_matcher_init (GtkCssMatcher *matcher,
const GtkWidgetPath *path)
_gtk_css_matcher_init (GtkCssMatcher *matcher,
const GtkWidgetPath *path,
const GtkCssNodeDeclaration *decl)
{
if (gtk_widget_path_length (path) == 0)
return FALSE;
matcher->path.klass = &GTK_CSS_MATCHER_WIDGET_PATH;
matcher->path.decl = decl;
matcher->path.path = path;
matcher->path.index = gtk_widget_path_length (path) - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index);
@@ -209,6 +241,204 @@ _gtk_css_matcher_init (GtkCssMatcher *matcher,
return TRUE;
}
/* GTK_CSS_MATCHER_NODE */
static gboolean
gtk_css_matcher_node_get_parent (GtkCssMatcher *matcher,
const GtkCssMatcher *child)
{
GtkCssNode *node;
node = gtk_css_node_get_parent (child->node.node);
if (node == NULL)
return FALSE;
return gtk_css_node_init_matcher (node, matcher);
}
static GtkCssNode *
get_previous_visible_sibling (GtkCssNode *node)
{
do {
node = gtk_css_node_get_previous_sibling (node);
} while (node && !gtk_css_node_get_visible (node));
return node;
}
static GtkCssNode *
get_next_visible_sibling (GtkCssNode *node)
{
do {
node = gtk_css_node_get_next_sibling (node);
} while (node && !gtk_css_node_get_visible (node));
return node;
}
static gboolean
gtk_css_matcher_node_get_previous (GtkCssMatcher *matcher,
const GtkCssMatcher *next)
{
GtkCssNode *node;
node = get_previous_visible_sibling (next->node.node);
if (node == NULL)
return FALSE;
return gtk_css_node_init_matcher (node, matcher);
}
static GtkStateFlags
gtk_css_matcher_node_get_state (const GtkCssMatcher *matcher)
{
return gtk_css_node_get_state (matcher->node.node);
}
static gboolean
gtk_css_matcher_node_has_type (const GtkCssMatcher *matcher,
GType type)
{
return g_type_is_a (gtk_css_node_get_widget_type (matcher->node.node), type);
}
static gboolean
gtk_css_matcher_node_has_class (const GtkCssMatcher *matcher,
GQuark class_name)
{
return gtk_css_node_has_qclass (matcher->node.node, class_name);
}
static gboolean
gtk_css_matcher_node_has_id (const GtkCssMatcher *matcher,
const char *id)
{
return gtk_css_node_get_id (matcher->node.node) == g_intern_string (id);
}
static gboolean
gtk_css_matcher_node_has_regions (const GtkCssMatcher *matcher)
{
GList *regions;
gboolean result;
regions = gtk_css_node_list_regions (matcher->node.node);
result = regions != NULL;
g_list_free (regions);
return result;
}
static gboolean
gtk_css_matcher_node_has_region (const GtkCssMatcher *matcher,
const char *region,
GtkRegionFlags flags)
{
GtkRegionFlags region_flags;
GQuark region_quark;
region_quark = g_quark_try_string (region);
if (!region_quark)
return FALSE;
if (!gtk_css_node_has_region (matcher->node.node, region_quark, &region_flags))
return FALSE;
if ((flags & region_flags) != flags)
return FALSE;
return TRUE;
}
static gboolean
gtk_css_matcher_node_nth_child (GtkCssNode *node,
int a,
int b)
{
while (b-- > 0)
{
if (node == NULL)
return FALSE;
node = get_previous_visible_sibling (node);
}
if (a == 0)
return node == NULL;
else if (a == 1)
return TRUE;
b = 0;
while (node)
{
b++;
node = get_previous_visible_sibling (node);
}
return b % a == 0;
}
static gboolean
gtk_css_matcher_node_nth_last_child (GtkCssNode *node,
int a,
int b)
{
while (b-- > 0)
{
if (node == NULL)
return FALSE;
node = get_next_visible_sibling (node);
}
if (a == 0)
return node == NULL;
else if (a == 1)
return TRUE;
b = 0;
while (node)
{
b++;
node = get_next_visible_sibling (node);
}
return b % a == 0;
}
static gboolean
gtk_css_matcher_node_has_position (const GtkCssMatcher *matcher,
gboolean forward,
int a,
int b)
{
if (forward)
return gtk_css_matcher_node_nth_child (matcher->node.node, a, b);
else
return gtk_css_matcher_node_nth_last_child (matcher->node.node, a, b);
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_NODE = {
gtk_css_matcher_node_get_parent,
gtk_css_matcher_node_get_previous,
gtk_css_matcher_node_get_state,
gtk_css_matcher_node_has_type,
gtk_css_matcher_node_has_class,
gtk_css_matcher_node_has_id,
gtk_css_matcher_node_has_regions,
gtk_css_matcher_node_has_region,
gtk_css_matcher_node_has_position,
FALSE
};
void
_gtk_css_matcher_node_init (GtkCssMatcher *matcher,
GtkCssNode *node)
{
matcher->node.klass = &GTK_CSS_MATCHER_NODE;
matcher->node.node = node;
}
/* GTK_CSS_MATCHER_WIDGET_ANY */
static gboolean
+12 -2
View File
@@ -24,7 +24,7 @@
G_BEGIN_DECLS
typedef union _GtkCssMatcher GtkCssMatcher;
typedef struct _GtkCssMatcherNode GtkCssMatcherNode;
typedef struct _GtkCssMatcherSuperset GtkCssMatcherSuperset;
typedef struct _GtkCssMatcherWidgetPath GtkCssMatcherWidgetPath;
typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
@@ -55,11 +55,17 @@ struct _GtkCssMatcherClass {
struct _GtkCssMatcherWidgetPath {
const GtkCssMatcherClass *klass;
const GtkCssNodeDeclaration *decl;
const GtkWidgetPath *path;
guint index;
guint sibling_index;
};
struct _GtkCssMatcherNode {
const GtkCssMatcherClass *klass;
GtkCssNode *node;
};
struct _GtkCssMatcherSuperset {
const GtkCssMatcherClass *klass;
const GtkCssMatcher *subset;
@@ -69,11 +75,15 @@ struct _GtkCssMatcherSuperset {
union _GtkCssMatcher {
const GtkCssMatcherClass *klass;
GtkCssMatcherWidgetPath path;
GtkCssMatcherNode node;
GtkCssMatcherSuperset superset;
};
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
const GtkWidgetPath *path) G_GNUC_WARN_UNUSED_RESULT;
const GtkWidgetPath *path,
const GtkCssNodeDeclaration *decl) G_GNUC_WARN_UNUSED_RESULT;
void _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
GtkCssNode *node);
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset,
+1300
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -18,14 +18,12 @@
#ifndef __GTK_CSS_NODE_DECLARATION_PRIVATE_H__
#define __GTK_CSS_NODE_DECLARATION_PRIVATE_H__
#include "gtkcsstypesprivate.h"
#include "gtkenums.h"
#include "gtkwidgetpath.h"
G_BEGIN_DECLS
typedef struct _GtkCssNodeDeclaration GtkCssNodeDeclaration;
GtkCssNodeDeclaration * gtk_css_node_declaration_new (void);
GtkCssNodeDeclaration * gtk_css_node_declaration_ref (GtkCssNodeDeclaration *decl);
void gtk_css_node_declaration_unref (GtkCssNodeDeclaration *decl);
+176
View File
@@ -0,0 +1,176 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_NODE_PRIVATE_H__
#define __GTK_CSS_NODE_PRIVATE_H__
#include "gtkcssnodedeclarationprivate.h"
#include "gtkbitmaskprivate.h"
#include "gtkcsstypesprivate.h"
G_BEGIN_DECLS
#define GTK_TYPE_CSS_NODE (gtk_css_node_get_type ())
#define GTK_CSS_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_NODE, GtkCssNode))
#define GTK_CSS_NODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_NODE, GtkCssNodeClass))
#define GTK_IS_CSS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_NODE))
#define GTK_IS_CSS_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_NODE))
#define GTK_CSS_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_NODE, GtkCssNodeClass))
typedef struct _GtkCssNode GtkCssNode;
typedef struct _GtkCssNodeClass GtkCssNodeClass;
struct _GtkCssNode
{
GObject object;
GtkCssNode *parent;
GtkCssNode *previous_sibling;
GtkCssNode *next_sibling;
GtkCssNode *first_child;
GtkCssNode *last_child;
GtkCssNodeDeclaration *decl;
GtkCssStyle *style;
GtkCssChange pending_changes; /* changes that accumulated since the style was last computed */
guint visible :1; /* node will be skipped when validating or computing styles */
guint invalid :1; /* node or a child needs to be validated (even if just for animation) */
guint children_changed :1; /* the children changed since last validation */
guint needs_propagation :1; /* children have state changes that need to be propagated to their siblings */
/* Two invariants hold for this variable:
* style_is_invalid == TRUE => next_sibling->style_is_invalid == TRUE
* style_is_invalid == FALSE => first_child->style_is_invalid == TRUE
* So if a valid style is computed, one has to previously ensure that the parent's and the previous sibling's style
* are valid. This allows both validation and invalidation to run in O(nodes-in-tree) */
guint style_is_invalid :1; /* the style needs to be recomputed */
};
struct _GtkCssNodeClass
{
GObjectClass object_class;
void (* node_added) (GtkCssNode *cssnode,
GtkCssNode *child,
GtkCssNode *previous);
void (* node_removed) (GtkCssNode *cssnode,
GtkCssNode *child,
GtkCssNode *previous);
void (* style_changed) (GtkCssNode *cssnode,
GtkCssStyle *old_style,
GtkCssStyle *new_style);
gboolean (* init_matcher) (GtkCssNode *cssnode,
GtkCssMatcher *matcher);
GtkWidgetPath * (* create_widget_path) (GtkCssNode *cssnode);
const GtkWidgetPath * (* get_widget_path) (GtkCssNode *cssnode);
/* get style provider to use or NULL to use parent's */
GtkStyleProviderPrivate *(* get_style_provider) (GtkCssNode *cssnode);
/* get frame clock or NULL (only relevant for root node) */
GdkFrameClock * (* get_frame_clock) (GtkCssNode *cssnode);
GtkCssStyle * (* update_style) (GtkCssNode *cssnode,
GtkCssChange pending_changes,
gint64 timestamp,
GtkCssStyle *old_style);
void (* invalidate) (GtkCssNode *node);
void (* queue_validate) (GtkCssNode *node);
void (* dequeue_validate) (GtkCssNode *node);
void (* validate) (GtkCssNode *node);
};
GType gtk_css_node_get_type (void) G_GNUC_CONST;
GtkCssNode * gtk_css_node_new (void);
void gtk_css_node_set_parent (GtkCssNode *cssnode,
GtkCssNode *parent);
void gtk_css_node_set_after (GtkCssNode *cssnode,
GtkCssNode *previous_sibling);
void gtk_css_node_set_before (GtkCssNode *cssnode,
GtkCssNode *next_sibling);
GtkCssNode * gtk_css_node_get_parent (GtkCssNode *cssnode);
GtkCssNode * gtk_css_node_get_first_child (GtkCssNode *cssnode);
GtkCssNode * gtk_css_node_get_last_child (GtkCssNode *cssnode);
GtkCssNode * gtk_css_node_get_previous_sibling(GtkCssNode *cssnode);
GtkCssNode * gtk_css_node_get_next_sibling (GtkCssNode *cssnode);
void gtk_css_node_set_visible (GtkCssNode *cssnode,
gboolean visible);
gboolean gtk_css_node_get_visible (GtkCssNode *cssnode);
void gtk_css_node_set_widget_type (GtkCssNode *cssnode,
GType widget_type);
GType gtk_css_node_get_widget_type (GtkCssNode *cssnode);
void gtk_css_node_set_id (GtkCssNode *cssnode,
const char *id);
const char * gtk_css_node_get_id (GtkCssNode *cssnode);
void gtk_css_node_set_state (GtkCssNode *cssnode,
GtkStateFlags state_flags);
GtkStateFlags gtk_css_node_get_state (GtkCssNode *cssnode);
void gtk_css_node_add_state (GtkCssNode *cssnode,
GtkStateFlags state_flags);
void gtk_css_node_remove_state (GtkCssNode *cssnode,
GtkStateFlags state_flags);
void gtk_css_node_set_junction_sides (GtkCssNode *cssnode,
GtkJunctionSides junction_sides);
GtkJunctionSides gtk_css_node_get_junction_sides (GtkCssNode *cssnode);
void gtk_css_node_set_classes (GtkCssNode *cssnode,
const char **classes);
char ** gtk_css_node_get_classes (GtkCssNode *cssnode);
void gtk_css_node_add_class (GtkCssNode *cssnode,
const char *style_class);
void gtk_css_node_remove_class (GtkCssNode *cssnode,
const char *style_class);
gboolean gtk_css_node_has_class (GtkCssNode *cssnode,
const char *style_class);
gboolean gtk_css_node_has_qclass (GtkCssNode *cssnode,
GQuark style_class);
GList * gtk_css_node_list_classes (GtkCssNode *cssnode);
void gtk_css_node_add_region (GtkCssNode *cssnode,
GQuark region,
GtkRegionFlags flags);
void gtk_css_node_remove_region (GtkCssNode *cssnode,
GQuark region);
gboolean gtk_css_node_has_region (GtkCssNode *cssnode,
GQuark region,
GtkRegionFlags *out_flags);
GList * gtk_css_node_list_regions (GtkCssNode *cssnode);
const GtkCssNodeDeclaration *
gtk_css_node_get_declaration (GtkCssNode *cssnode);
GtkCssStyle * gtk_css_node_get_style (GtkCssNode *cssnode);
void gtk_css_node_invalidate_style_provider
(GtkCssNode *cssnode);
void gtk_css_node_invalidate_frame_clock
(GtkCssNode *cssnode,
gboolean just_timestamp);
void gtk_css_node_invalidate (GtkCssNode *cssnode,
GtkCssChange change);
void gtk_css_node_validate (GtkCssNode *cssnode);
gboolean gtk_css_node_init_matcher (GtkCssNode *cssnode,
GtkCssMatcher *matcher);
GtkWidgetPath * gtk_css_node_create_widget_path (GtkCssNode *cssnode);
const GtkWidgetPath * gtk_css_node_get_widget_path (GtkCssNode *cssnode);
GtkStyleProviderPrivate *gtk_css_node_get_style_provider(GtkCssNode *cssnode);
G_END_DECLS
#endif /* __GTK_CSS_NODE_PRIVATE_H__ */
+300
View File
@@ -0,0 +1,300 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcssnodeutilsprivate.h"
#include <math.h>
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssstyleprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
void
gtk_css_node_style_changed_for_widget (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
{
static GtkBitmask *affects_size = NULL;
GtkBitmask *changes;
changes = gtk_css_style_get_difference (old_style, new_style);
if (G_UNLIKELY (affects_size == NULL))
affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
if (_gtk_bitmask_intersects (changes, affects_size))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static gint
get_number (GtkCssStyle *style,
guint property)
{
double d = _gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100);
if (d < 1)
return ceil (d);
else
return floor (d);
}
static void
get_box_margin (GtkCssStyle *style,
GtkBorder *margin)
{
margin->top = get_number (style, GTK_CSS_PROPERTY_MARGIN_TOP);
margin->left = get_number (style, GTK_CSS_PROPERTY_MARGIN_LEFT);
margin->bottom = get_number (style, GTK_CSS_PROPERTY_MARGIN_BOTTOM);
margin->right = get_number (style, GTK_CSS_PROPERTY_MARGIN_RIGHT);
}
static void
get_box_border (GtkCssStyle *style,
GtkBorder *border)
{
border->top = get_number (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH);
border->left = get_number (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
border->bottom = get_number (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH);
border->right = get_number (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH);
}
static void
get_box_padding (GtkCssStyle *style,
GtkBorder *border)
{
border->top = get_number (style, GTK_CSS_PROPERTY_PADDING_TOP);
border->left = get_number (style, GTK_CSS_PROPERTY_PADDING_LEFT);
border->bottom = get_number (style, GTK_CSS_PROPERTY_PADDING_BOTTOM);
border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
}
static void
get_content_size_func_default (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
gpointer unused)
{
*minimum = 0;
*natural = 0;
if (minimum_baseline)
*minimum_baseline = 0;
if (natural_baseline)
*natural_baseline = 0;
}
void
gtk_css_node_get_preferred_size (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
GtkCssNodeSizeFunc get_content_size_func,
gpointer get_content_size_data)
{
GtkCssStyle *style;
GtkBorder margin, border, padding;
int min_size, extra_size, extra_opposite, extra_baseline;
if (!get_content_size_func)
get_content_size_func = get_content_size_func_default;
style = gtk_css_node_get_style (cssnode);
get_box_margin (style, &margin);
get_box_border (style, &border);
get_box_padding (style, &padding);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
extra_size = margin.left + margin.right + border.left + border.right + padding.left + padding.right;
extra_opposite = margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
extra_baseline = margin.left + border.left + padding.left;
min_size = get_number (style, GTK_CSS_PROPERTY_MIN_WIDTH);
}
else
{
extra_size = margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
extra_opposite = margin.left + margin.right + border.left + border.right + padding.left + padding.right;
extra_baseline = margin.top + border.top + padding.top;
min_size = get_number (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
}
if (for_size > -1)
for_size -= extra_opposite;
if (minimum_baseline)
*minimum_baseline = -1;
if (natural_baseline)
*natural_baseline = -1;
get_content_size_func (cssnode,
orientation,
for_size,
minimum, natural,
minimum_baseline, natural_baseline,
get_content_size_data);
g_warn_if_fail (*minimum <= *natural);
*minimum = MAX (min_size, *minimum);
*natural = MAX (min_size, *natural);
*minimum += extra_size;
*natural += extra_size;
if (minimum_baseline && *minimum_baseline > -1)
*minimum_baseline += extra_baseline;
if (natural_baseline && *natural_baseline > -1)
*natural_baseline += extra_baseline;
}
static void
allocate_func_default (GtkCssNode *cssnode,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer unused)
{
*out_clip = *allocation;
}
void
gtk_css_node_allocate (GtkCssNode *cssnode,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
GtkCssNodeAllocateFunc allocate_func,
gpointer allocate_data)
{
GtkAllocation content_allocation, clip;
GtkBorder margin, border, padding, shadow, extents;
GtkCssStyle *style;
if (out_clip == NULL)
out_clip = &clip;
if (!allocate_func)
allocate_func = allocate_func_default;
style = gtk_css_node_get_style (cssnode);
get_box_margin (style, &margin);
get_box_border (style, &border);
get_box_padding (style, &padding);
extents.top = margin.top + border.top + padding.top;
extents.right = margin.right + border.right + padding.right;
extents.bottom = margin.bottom + border.bottom + padding.bottom;
extents.left = margin.left + border.left + padding.left;
content_allocation.x = allocation->x + extents.left;
content_allocation.y = allocation->y + extents.top;
content_allocation.width = allocation->width - extents.left - extents.right;
content_allocation.height = allocation->height - extents.top - extents.bottom;
if (baseline >= 0)
baseline += extents.top;
g_assert (content_allocation.width >= 0);
g_assert (content_allocation.height >= 0);
allocate_func (cssnode, &content_allocation, baseline, out_clip, allocate_data);
_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
out_clip->x -= extents.left + shadow.left - margin.left;
out_clip->y -= extents.top + shadow.top - margin.top;
out_clip->width += extents.left + extents.right + shadow.left + shadow.right - margin.left - margin.right;
out_clip->height += extents.top + extents.bottom + shadow.top + shadow.bottom - margin.top - margin.bottom;
}
static gboolean
draw_contents_func_default (GtkCssNode *cssnode,
cairo_t *cr,
int width,
int height,
gpointer unused)
{
return FALSE;
}
void
gtk_css_node_draw (GtkCssNode *cssnode,
cairo_t *cr,
int width,
int height,
GtkCssNodeDrawFunc draw_contents_func,
gpointer draw_contents_data)
{
GtkBorder margin, border, padding;
gboolean draw_focus;
GtkCssStyle *style;
int contents_width, contents_height;
if (draw_contents_func == NULL)
draw_contents_func = draw_contents_func_default;
style = gtk_css_node_get_style (cssnode);
get_box_margin (style, &margin);
get_box_border (style, &border);
get_box_padding (style, &padding);
gtk_css_style_render_background (style,
cr,
margin.left,
margin.top,
width - margin.left - margin.right,
height - margin.top - margin.bottom,
gtk_css_node_get_junction_sides (cssnode));
gtk_css_style_render_border (style,
cr,
margin.left,
margin.top,
width - margin.left - margin.right,
height - margin.top - margin.bottom,
0,
gtk_css_node_get_junction_sides (cssnode));
cairo_translate (cr,
margin.left + border.left + padding.left,
margin.top + border.top + padding.top);
contents_width = width - margin.left - margin.right - border.left - border.right - padding.left - padding.right;
contents_height = height - margin.top - margin.bottom - border.top - border.bottom - padding.top - padding.bottom;
draw_focus = draw_contents_func (cssnode, cr, contents_width, contents_height, draw_contents_data);
cairo_translate (cr,
- (margin.left + border.left + padding.left),
- (margin.top + border.top + padding.top));
if (draw_focus)
gtk_css_style_render_outline (style,
cr,
margin.left,
margin.top,
width - margin.left - margin.right,
height - margin.top - margin.bottom);
}
+75
View File
@@ -0,0 +1,75 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_NODE_UTILS_PRIVATE_H__
#define __GTK_CSS_NODE_UTILS_PRIVATE_H__
#include <gtk/gtkwidget.h>
#include "gtk/gtkcssnodeprivate.h"
G_BEGIN_DECLS
void gtk_css_node_style_changed_for_widget (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget);
typedef void (* GtkCssNodeSizeFunc) (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
gpointer get_content_size_data);
void gtk_css_node_get_preferred_size (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
GtkCssNodeSizeFunc get_content_size_func,
gpointer get_content_size_data);
typedef void (* GtkCssNodeAllocateFunc) (GtkCssNode *cssnode,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer allocate_data);
void gtk_css_node_allocate (GtkCssNode *cssnode,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
GtkCssNodeAllocateFunc allocate_func,
gpointer allocate_data);
typedef gboolean (* GtkCssNodeDrawFunc) (GtkCssNode *cssnode,
cairo_t *cr,
int width,
int height,
gpointer data);
void gtk_css_node_draw (GtkCssNode *cssnode,
cairo_t *cr,
int width,
int height,
GtkCssNodeDrawFunc draw_contents_func,
gpointer draw_contents_data);
G_END_DECLS
#endif /* __GTK_CSS_NODE_UTILS_PRIVATE_H__ */
+5 -9
View File
@@ -39,19 +39,16 @@ static double
get_base_font_size (guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
{
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
if (parent_style)
return _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
else
return _gtk_css_font_size_get_default (provider);
}
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
}
@@ -60,8 +57,7 @@ gtk_css_value_number_compute (GtkCssValue *number,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkBorderStyle border_style;
@@ -106,7 +102,7 @@ gtk_css_value_number_compute (GtkCssValue *number,
/* percentages for font sizes are computed, other percentages aren't */
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
return _gtk_css_number_value_new (number->value / 100.0 *
get_base_font_size (property_id, provider, style, parent_style, dependencies),
get_base_font_size (property_id, provider, style, parent_style),
GTK_CSS_PX);
case GTK_CSS_NUMBER:
case GTK_CSS_PX:
@@ -134,13 +130,13 @@ gtk_css_value_number_compute (GtkCssValue *number,
break;
case GTK_CSS_EM:
return _gtk_css_number_value_new (number->value *
get_base_font_size (property_id, provider, style, parent_style, dependencies),
get_base_font_size (property_id, provider, style, parent_style),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
return _gtk_css_number_value_new (number->value * 0.5 *
get_base_font_size (property_id, provider, style, parent_style, dependencies),
get_base_font_size (property_id, provider, style, parent_style),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
+197
View File
@@ -0,0 +1,197 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcsspathnodeprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkprivate.h"
#include "gtkstylecontextprivate.h"
G_DEFINE_TYPE (GtkCssPathNode, gtk_css_path_node, GTK_TYPE_CSS_NODE)
static void
gtk_css_path_node_finalize (GObject *object)
{
GtkCssPathNode *node = GTK_CSS_PATH_NODE (object);
if (node->path)
gtk_widget_path_unref (node->path);
G_OBJECT_CLASS (gtk_css_path_node_parent_class)->finalize (object);
}
static void
gtk_css_path_node_invalidate (GtkCssNode *node)
{
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
if (path_node->context)
{
GtkBitmask *changes;
changes = _gtk_bitmask_new ();
changes = _gtk_bitmask_invert_range (changes,
0,
_gtk_css_style_property_get_n_properties ());
gtk_style_context_validate (path_node->context, changes);
_gtk_bitmask_free (changes);
}
}
gboolean
gtk_css_path_node_real_init_matcher (GtkCssNode *node,
GtkCssMatcher *matcher)
{
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
if (path_node->path == NULL ||
gtk_widget_path_length (path_node->path) == 0)
return FALSE;
return _gtk_css_matcher_init (matcher,
path_node->path,
gtk_css_node_get_declaration (node));
}
static GtkWidgetPath *
gtk_css_path_node_real_create_widget_path (GtkCssNode *node)
{
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
GtkWidgetPath *path;
guint length;
if (path_node->path == NULL)
path = gtk_widget_path_new ();
else
path = gtk_widget_path_copy (path_node->path);
length = gtk_widget_path_length (path);
if (length > 0)
{
gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (node),
path,
length - 1);
}
return path;
}
static const GtkWidgetPath *
gtk_css_path_node_real_get_widget_path (GtkCssNode *node)
{
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
return path_node->path;
}
static GtkCssStyle *
gtk_css_path_node_update_style (GtkCssNode *cssnode,
GtkCssChange change,
gint64 timestamp,
GtkCssStyle *style)
{
/* This should get rid of animations */
return GTK_CSS_NODE_CLASS (gtk_css_path_node_parent_class)->update_style (cssnode, change, 0, style);
}
static GtkStyleProviderPrivate *
gtk_css_path_node_get_style_provider (GtkCssNode *node)
{
GtkCssPathNode *path_node = GTK_CSS_PATH_NODE (node);
if (path_node->context == NULL)
return NULL;
return gtk_style_context_get_style_provider (path_node->context);
}
static void
gtk_css_path_node_class_init (GtkCssPathNodeClass *klass)
{
GtkCssNodeClass *node_class = GTK_CSS_NODE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_css_path_node_finalize;
node_class->invalidate = gtk_css_path_node_invalidate;
node_class->update_style = gtk_css_path_node_update_style;
node_class->init_matcher = gtk_css_path_node_real_init_matcher;
node_class->create_widget_path = gtk_css_path_node_real_create_widget_path;
node_class->get_widget_path = gtk_css_path_node_real_get_widget_path;
node_class->get_style_provider = gtk_css_path_node_get_style_provider;
}
static void
gtk_css_path_node_init (GtkCssPathNode *cssnode)
{
}
GtkCssNode *
gtk_css_path_node_new (GtkStyleContext *context)
{
GtkCssPathNode *node;
g_return_val_if_fail (context == NULL || GTK_IS_STYLE_CONTEXT (context), NULL);
node = g_object_new (GTK_TYPE_CSS_PATH_NODE, NULL);
node->context = context;
return GTK_CSS_NODE (node);
}
void
gtk_css_path_node_unset_context (GtkCssPathNode *node)
{
gtk_internal_return_if_fail (GTK_IS_CSS_PATH_NODE (node));
gtk_internal_return_if_fail (node->context != NULL);
node->context = NULL;
gtk_css_node_invalidate_style_provider (GTK_CSS_NODE (node));
}
void
gtk_css_path_node_set_widget_path (GtkCssPathNode *node,
GtkWidgetPath *path)
{
gtk_internal_return_if_fail (GTK_IS_CSS_PATH_NODE (node));
if (node->path == path)
return;
if (node->path)
gtk_widget_path_unref (node->path);
if (path)
gtk_widget_path_ref (path);
node->path = path;
gtk_css_node_invalidate (GTK_CSS_NODE (node), GTK_CSS_CHANGE_ANY);
}
GtkWidgetPath *
gtk_css_path_node_get_widget_path (GtkCssPathNode *node)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_PATH_NODE (node), NULL);
return node->path;
}
+61
View File
@@ -0,0 +1,61 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_PATH_NODE_PRIVATE_H__
#define __GTK_CSS_PATH_NODE_PRIVATE_H__
#include "gtkcssnodeprivate.h"
#include "gtkwidgetpath.h"
G_BEGIN_DECLS
#define GTK_TYPE_CSS_PATH_NODE (gtk_css_path_node_get_type ())
#define GTK_CSS_PATH_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_PATH_NODE, GtkCssPathNode))
#define GTK_CSS_PATH_NODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_PATH_NODE, GtkCssPathNodeClass))
#define GTK_IS_CSS_PATH_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_PATH_NODE))
#define GTK_IS_CSS_PATH_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_PATH_NODE))
#define GTK_CSS_PATH_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_PATH_NODE, GtkCssPathNodeClass))
typedef struct _GtkCssPathNode GtkCssPathNode;
typedef struct _GtkCssPathNodeClass GtkCssPathNodeClass;
struct _GtkCssPathNode
{
GtkCssNode node;
GtkStyleContext *context;
GtkWidgetPath *path;
};
struct _GtkCssPathNodeClass
{
GtkCssNodeClass node_class;
};
GType gtk_css_path_node_get_type (void) G_GNUC_CONST;
GtkCssNode * gtk_css_path_node_new (GtkStyleContext *context);
void gtk_css_path_node_unset_context (GtkCssPathNode *node);
void gtk_css_path_node_set_widget_path (GtkCssPathNode *node,
GtkWidgetPath *path);
GtkWidgetPath * gtk_css_path_node_get_widget_path (GtkCssPathNode *node);
G_END_DECLS
#endif /* __GTK_CSS_PATH_NODE_PRIVATE_H__ */
+3 -6
View File
@@ -41,15 +41,12 @@ gtk_css_value_position_compute (GtkCssValue *position,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *x, *y;
GtkCssDependencies x_deps, y_deps;
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style, &x_deps);
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style);
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style);
if (x == position->x && y == position->y)
{
_gtk_css_value_unref (x);
+1 -1
View File
@@ -1695,7 +1695,7 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
gtk_widget_path_iter_set_state (path, -1, state);
}
if (!_gtk_css_matcher_init (&matcher, path))
if (!_gtk_css_matcher_init (&matcher, path, NULL))
{
gtk_widget_path_unref (path);
return FALSE;
+1 -2
View File
@@ -38,8 +38,7 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
+1 -2
View File
@@ -38,8 +38,7 @@ gtk_css_value_rgba_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
+2 -5
View File
@@ -55,11 +55,9 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *result;
GtkCssDependencies child_deps;
guint i;
if (value->len == 0)
@@ -68,8 +66,7 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
result = gtk_css_shadows_value_new (value->values, value->len);
for (i = 0; i < value->len; i++)
{
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
}
return result;
+6 -22
View File
@@ -67,31 +67,15 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssValue *hoffset, *voffset, *radius, *spread, *color;
GtkCssDependencies child_deps;
child_deps = 0;
hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style, &child_deps),
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
child_deps = 0;
color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style, &child_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style);
voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style);
radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style);
spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style),
color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style);
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
}
+1 -116
View File
@@ -66,28 +66,6 @@ gtk_css_static_style_get_section (GtkCssStyle *style,
return g_ptr_array_index (sstyle->sections, id);
}
/* Compute the bitmask of potentially changed properties if the parent has changed
* the passed in ones.
* This is for example needed when changes in the "color" property will affect
* all properties using "currentColor" as a color.
*/
static GtkBitmask *
gtk_css_static_style_compute_dependencies (GtkCssStaticStyle *style,
const GtkBitmask *parent_changes)
{
GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style);
GtkBitmask *changes;
changes = _gtk_bitmask_copy (parent_changes);
changes = _gtk_bitmask_intersect (changes, sstyle->depends_on_parent);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_COLOR))
changes = _gtk_bitmask_union (changes, sstyle->depends_on_color);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE))
changes = _gtk_bitmask_union (changes, sstyle->depends_on_font_size);
return changes;
}
static void
gtk_css_static_style_dispose (GObject *object)
{
@@ -107,19 +85,6 @@ gtk_css_static_style_dispose (GObject *object)
G_OBJECT_CLASS (gtk_css_static_style_parent_class)->dispose (object);
}
static void
gtk_css_static_style_finalize (GObject *object)
{
GtkCssStaticStyle *style = GTK_CSS_STATIC_STYLE (object);
_gtk_bitmask_free (style->depends_on_parent);
_gtk_bitmask_free (style->equals_parent);
_gtk_bitmask_free (style->depends_on_color);
_gtk_bitmask_free (style->depends_on_font_size);
G_OBJECT_CLASS (gtk_css_static_style_parent_class)->finalize (object);
}
static void
gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
{
@@ -127,7 +92,6 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
GtkCssStyleClass *style_class = GTK_CSS_STYLE_CLASS (klass);
object_class->dispose = gtk_css_static_style_dispose;
object_class->finalize = gtk_css_static_style_finalize;
style_class->get_value = gtk_css_static_style_get_value;
style_class->get_section = gtk_css_static_style_get_section;
@@ -136,10 +100,6 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
static void
gtk_css_static_style_init (GtkCssStaticStyle *style)
{
style->depends_on_parent = _gtk_bitmask_new ();
style->equals_parent = _gtk_bitmask_new ();
style->depends_on_color = _gtk_bitmask_new ();
style->depends_on_font_size = _gtk_bitmask_new ();
}
static void
@@ -235,71 +195,6 @@ gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
return GTK_CSS_STYLE (result);
}
GtkCssStyle *
gtk_css_static_style_new_update (GtkCssStaticStyle *style,
const GtkBitmask *parent_changes,
GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
GtkCssStyle *parent)
{
GtkCssStaticStyle *result;
GtkCssLookup *lookup;
GtkBitmask *changes;
guint i;
gtk_internal_return_val_if_fail (GTK_IS_CSS_STATIC_STYLE (style), NULL);
gtk_internal_return_val_if_fail (parent_changes != NULL, NULL);
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
gtk_internal_return_val_if_fail (matcher != NULL, NULL);
changes = gtk_css_static_style_compute_dependencies (style, parent_changes);
if (_gtk_bitmask_is_empty (changes))
{
_gtk_bitmask_free (changes);
return g_object_ref (style);
}
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
result->change = style->change;
result->depends_on_parent = _gtk_bitmask_subtract (_gtk_bitmask_union (result->depends_on_parent, style->depends_on_parent),
changes);
result->equals_parent = _gtk_bitmask_subtract (_gtk_bitmask_union (result->equals_parent, style->equals_parent),
changes);
result->depends_on_color = _gtk_bitmask_subtract (_gtk_bitmask_union (result->depends_on_color, style->depends_on_color),
changes);
result->depends_on_font_size = _gtk_bitmask_subtract (_gtk_bitmask_union (result->depends_on_font_size, style->depends_on_font_size),
changes);
for (i = 0; i < style->values->len; i++)
{
if (_gtk_bitmask_get (changes, i))
continue;
gtk_css_static_style_set_value (result,
i,
gtk_css_static_style_get_value (GTK_CSS_STYLE (style), i),
gtk_css_static_style_get_section (GTK_CSS_STYLE (style), i));
}
lookup = _gtk_css_lookup_new (changes);
_gtk_style_provider_private_lookup (provider,
matcher,
lookup,
NULL);
_gtk_css_lookup_resolve (lookup,
provider,
result,
parent);
_gtk_css_lookup_free (lookup);
_gtk_bitmask_free (changes);
return GTK_CSS_STYLE (result);
}
void
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProviderPrivate *provider,
@@ -308,7 +203,6 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkCssValue *specified,
GtkCssSection *section)
{
GtkCssDependencies dependencies;
GtkCssValue *value;
gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
@@ -332,19 +226,10 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
else
_gtk_css_value_ref (specified);
value = _gtk_css_value_compute (specified, id, provider, GTK_CSS_STYLE (style), parent_style, &dependencies);
value = _gtk_css_value_compute (specified, id, provider, GTK_CSS_STYLE (style), parent_style);
gtk_css_static_style_set_value (style, id, value, section);
if (dependencies & (GTK_CSS_DEPENDS_ON_PARENT | GTK_CSS_EQUALS_PARENT))
style->depends_on_parent = _gtk_bitmask_set (style->depends_on_parent, id, TRUE);
if (dependencies & (GTK_CSS_EQUALS_PARENT))
style->equals_parent = _gtk_bitmask_set (style->equals_parent, id, TRUE);
if (dependencies & (GTK_CSS_DEPENDS_ON_COLOR))
style->depends_on_color = _gtk_bitmask_set (style->depends_on_color, id, TRUE);
if (dependencies & (GTK_CSS_DEPENDS_ON_FONT_SIZE))
style->depends_on_font_size = _gtk_bitmask_set (style->depends_on_font_size, id, TRUE);
_gtk_css_value_unref (value);
_gtk_css_value_unref (specified);
}
-10
View File
@@ -42,11 +42,6 @@ struct _GtkCssStaticStyle
GPtrArray *values; /* the values */
GPtrArray *sections; /* sections the values are defined in */
GtkBitmask *depends_on_parent; /* values that depend on parent values */
GtkBitmask *equals_parent; /* values that equal their parent values */
GtkBitmask *depends_on_color; /* values that depend on the color property */
GtkBitmask *depends_on_font_size; /* values that depend on the font-size property */
GtkCssChange change; /* change as returned by value lookup */
};
@@ -61,11 +56,6 @@ GtkCssStyle * gtk_css_static_style_get_default (void);
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
GtkCssStyle *parent);
GtkCssStyle * gtk_css_static_style_new_update (GtkCssStaticStyle *style,
const GtkBitmask *parent_changes,
GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
GtkCssStyle *parent);
void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
GtkStyleProviderPrivate*provider,
+1 -2
View File
@@ -38,8 +38,7 @@ gtk_css_value_string_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
return _gtk_css_value_ref (value);
}
+19
View File
@@ -46,10 +46,17 @@ gtk_css_style_real_get_section (GtkCssStyle *style,
return NULL;
}
static gboolean
gtk_css_style_real_is_static (GtkCssStyle *style)
{
return TRUE;
}
static void
gtk_css_style_class_init (GtkCssStyleClass *klass)
{
klass->get_section = gtk_css_style_real_get_section;
klass->is_static = gtk_css_style_real_is_static;
}
static void
@@ -82,6 +89,9 @@ gtk_css_style_get_difference (GtkCssStyle *style,
GtkBitmask *result;
guint i, len;
if (style == other)
return _gtk_bitmask_new ();
result = _gtk_bitmask_new ();
len = _gtk_css_style_property_get_n_properties ();
for (i = 0; i < len; i++)
@@ -94,6 +104,15 @@ gtk_css_style_get_difference (GtkCssStyle *style,
return result;
}
gboolean
gtk_css_style_is_static (GtkCssStyle *style)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), TRUE);
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
}
void
gtk_css_style_print (GtkCssStyle *style,
GString *string)
+7 -19
View File
@@ -58,8 +58,7 @@ typedef void (* GtkStylePrintFunc) (const GValue
typedef GtkCssValue * (* GtkStyleComputeFunc) (GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies);
GtkCssValue *specified);
static void
register_conversion_function (GType type,
@@ -185,8 +184,7 @@ static GtkCssValue *
rgba_value_compute (GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
GtkCssValue *specified)
{
GdkRGBA white = { 1, 1, 1, 1 };
const GValue *value;
@@ -205,8 +203,6 @@ rgba_value_compute (GtkStyleProviderPrivate *provider,
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (symbolic),
provider,
gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
GTK_CSS_DEPENDS_ON_COLOR,
dependencies,
NULL);
if (val != NULL)
{
@@ -284,8 +280,7 @@ static GtkCssValue *
color_value_compute (GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
GtkCssValue *specified)
{
GdkColor color = { 0, 65535, 65535, 65535 };
const GValue *value;
@@ -302,8 +297,6 @@ color_value_compute (GtkStyleProviderPrivate *provider,
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (g_value_get_boxed (value)),
provider,
gtk_css_style_get_value (values, GTK_CSS_PROPERTY_COLOR),
GTK_CSS_DEPENDS_ON_COLOR,
dependencies,
NULL);
if (val != NULL)
{
@@ -849,8 +842,7 @@ static GtkCssValue *
pattern_value_compute (GtkStyleProviderPrivate *provider,
GtkCssStyle *values,
GtkCssStyle *parent_values,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
GtkCssValue *specified)
{
const GValue *value = _gtk_css_typed_value_get (specified);
@@ -861,7 +853,7 @@ pattern_value_compute (GtkStyleProviderPrivate *provider,
GValue new_value = G_VALUE_INIT;
cairo_pattern_t *gradient;
gradient = _gtk_gradient_resolve_full (g_value_get_boxed (value), provider, values, parent_values, dependencies);
gradient = _gtk_gradient_resolve_full (g_value_get_boxed (value), provider, values, parent_values);
g_value_init (&new_value, CAIRO_GOBJECT_TYPE_PATTERN);
g_value_take_boxed (&new_value, gradient);
@@ -1142,8 +1134,6 @@ _gtk_css_style_funcs_print_value (const GValue *value,
* @parent_values: Values to look up inherited values from
* @target_type: Type the resulting value should have
* @specified: the value to use for the computation
* @dependencies: (out): Value initialized with 0 to take the dependencies
* of the returned value
*
* Converts the @specified value into the @computed value using the
* information in @context. The values must have matching types, ie
@@ -1157,15 +1147,13 @@ _gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GType target_type,
GtkCssValue *specified,
GtkCssDependencies *dependencies)
GtkCssValue *specified)
{
GtkStyleComputeFunc func;
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
g_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
g_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
g_return_val_if_fail (*dependencies == 0, NULL);
gtk_css_style_funcs_init ();
@@ -1176,7 +1164,7 @@ _gtk_css_style_funcs_compute_value (GtkStyleProviderPrivate *provider,
GSIZE_TO_POINTER (g_type_fundamental (target_type)));
if (func)
return func (provider, style, parent_style, specified, dependencies);
return func (provider, style, parent_style, specified);
else
return _gtk_css_value_ref (specified);
}
+1 -2
View File
@@ -32,8 +32,7 @@ GtkCssValue * _gtk_css_style_funcs_compute_value (GtkStyleProviderPriv
GtkCssStyle *style,
GtkCssStyle *parent_style,
GType target_type,
GtkCssValue *specified,
GtkCssDependencies *dependencies);
GtkCssValue *specified);
G_END_DECLS
+3
View File
@@ -54,6 +54,8 @@ struct _GtkCssStyleClass
* Optional: default impl will just return NULL */
GtkCssSection * (* get_section) (GtkCssStyle *style,
guint id);
/* TRUE if this style will require changes based on timestamp */
gboolean (* is_static) (GtkCssStyle *style);
};
GType gtk_css_style_get_type (void) G_GNUC_CONST;
@@ -64,6 +66,7 @@ GtkCssSection * gtk_css_style_get_section (GtkCssStyle
guint id);
GtkBitmask * gtk_css_style_get_difference (GtkCssStyle *style,
GtkCssStyle *other);
gboolean gtk_css_style_is_static (GtkCssStyle *style);
char * gtk_css_style_to_string (GtkCssStyle *style);
void gtk_css_style_print (GtkCssStyle *style,
+28
View File
@@ -804,6 +804,15 @@ border_image_width_parse (GtkCssStyleProperty *property,
FALSE);
}
static GtkCssValue *
minmax_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_POSITIVE_ONLY);
}
static GtkCssValue *
transition_property_parse_one (GtkCssParser *parser)
{
@@ -1529,6 +1538,25 @@ _gtk_css_style_property_init_properties (void)
NULL,
_gtk_css_transform_value_new_none ());
gtk_css_style_property_register ("min-width",
GTK_CSS_PROPERTY_MIN_WIDTH,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
minmax_parse,
NULL,
NULL,
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("min-height",
GTK_CSS_PROPERTY_MIN_HEIGHT,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
minmax_parse,
NULL,
NULL,
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("transition-property",
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
G_TYPE_NONE,
+13 -26
View File
@@ -231,12 +231,9 @@ gtk_css_transform_compute (GtkCssTransform *dest,
GtkCssTransform *src,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
GtkCssDependencies x_deps, y_deps;
dest->type = src->type;
switch (src->type)
@@ -244,34 +241,28 @@ gtk_css_transform_compute (GtkCssTransform *dest,
case GTK_CSS_TRANSFORM_MATRIX:
return TRUE;
case GTK_CSS_TRANSFORM_TRANSLATE:
x_deps = y_deps = 0;
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style, &x_deps);
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style);
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style);
return dest->translate.x == src->translate.x
&& dest->translate.y == src->translate.y;
case GTK_CSS_TRANSFORM_ROTATE:
dest->rotate.rotate = _gtk_css_value_compute (src->rotate.rotate, property_id, provider, style, parent_style, dependencies);
dest->rotate.rotate = _gtk_css_value_compute (src->rotate.rotate, property_id, provider, style, parent_style);
return dest->rotate.rotate == src->rotate.rotate;
case GTK_CSS_TRANSFORM_SCALE:
x_deps = y_deps = 0;
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style, &x_deps);
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style);
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style);
return dest->scale.x == src->scale.x
&& dest->scale.y == src->scale.y;
case GTK_CSS_TRANSFORM_SKEW:
x_deps = y_deps = 0;
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style, &x_deps);
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, &y_deps);
*dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style);
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style);
return dest->skew.x == src->skew.x
&& dest->skew.y == src->skew.y;
case GTK_CSS_TRANSFORM_SKEW_X:
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style, dependencies);
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style);
return dest->skew_x.skew == src->skew_x.skew;
case GTK_CSS_TRANSFORM_SKEW_Y:
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style, dependencies);
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style);
return dest->skew_y.skew == src->skew_y.skew;
case GTK_CSS_TRANSFORM_NONE:
default:
@@ -285,10 +276,8 @@ gtk_css_value_transform_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssDependencies transform_deps;
GtkCssValue *result;
gboolean changes;
guint i;
@@ -307,9 +296,7 @@ gtk_css_value_transform_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style,
&transform_deps);
*dependencies = _gtk_css_dependencies_union (*dependencies, transform_deps);
parent_style);
}
if (!changes)
+94
View File
@@ -0,0 +1,94 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcsstransientnodeprivate.h"
#include "gtkprivate.h"
G_DEFINE_TYPE (GtkCssTransientNode, gtk_css_transient_node, GTK_TYPE_CSS_NODE)
static GtkWidgetPath *
gtk_css_transient_node_create_widget_path (GtkCssNode *node)
{
GtkWidgetPath *result;
GtkCssNode *parent;
parent = gtk_css_node_get_parent (node);
if (parent == NULL)
result = gtk_widget_path_new ();
else
result = gtk_css_node_create_widget_path (parent);
gtk_widget_path_append_type (result, gtk_css_node_get_widget_type (node));
gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (node), result, -1);
return result;
}
static const GtkWidgetPath *
gtk_css_transient_node_get_widget_path (GtkCssNode *node)
{
GtkCssNode *parent;
parent = gtk_css_node_get_parent (node);
if (parent == NULL)
return NULL;
return gtk_css_node_get_widget_path (parent);
}
static GtkCssStyle *
gtk_css_transient_node_update_style (GtkCssNode *cssnode,
GtkCssChange change,
gint64 timestamp,
GtkCssStyle *style)
{
/* This should get rid of animations */
return GTK_CSS_NODE_CLASS (gtk_css_transient_node_parent_class)->update_style (cssnode, change, 0, style);
}
static void
gtk_css_transient_node_class_init (GtkCssTransientNodeClass *klass)
{
GtkCssNodeClass *node_class = GTK_CSS_NODE_CLASS (klass);
node_class->create_widget_path = gtk_css_transient_node_create_widget_path;
node_class->get_widget_path = gtk_css_transient_node_get_widget_path;
node_class->update_style = gtk_css_transient_node_update_style;
}
static void
gtk_css_transient_node_init (GtkCssTransientNode *cssnode)
{
gtk_css_node_set_visible (GTK_CSS_NODE (cssnode), FALSE);
}
GtkCssNode *
gtk_css_transient_node_new (GtkCssNode *parent)
{
GtkCssNode *result;
gtk_internal_return_val_if_fail (GTK_IS_CSS_NODE (parent), NULL);
result = g_object_new (GTK_TYPE_CSS_TRANSIENT_NODE, NULL);
gtk_css_node_declaration_unref (result->decl);
result->decl = gtk_css_node_declaration_ref (parent->decl);
return result;
}
+51
View File
@@ -0,0 +1,51 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_TRANSIENT_NODE_PRIVATE_H__
#define __GTK_CSS_TRANSIENT_NODE_PRIVATE_H__
#include "gtkcssnodeprivate.h"
G_BEGIN_DECLS
#define GTK_TYPE_CSS_TRANSIENT_NODE (gtk_css_transient_node_get_type ())
#define GTK_CSS_TRANSIENT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_TRANSIENT_NODE, GtkCssTransientNode))
#define GTK_CSS_TRANSIENT_NODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_TRANSIENT_NODE, GtkCssTransientNodeClass))
#define GTK_IS_CSS_TRANSIENT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_TRANSIENT_NODE))
#define GTK_IS_CSS_TRANSIENT_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_TRANSIENT_NODE))
#define GTK_CSS_TRANSIENT_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_TRANSIENT_NODE, GtkCssTransientNodeClass))
typedef struct _GtkCssTransientNode GtkCssTransientNode;
typedef struct _GtkCssTransientNodeClass GtkCssTransientNodeClass;
struct _GtkCssTransientNode
{
GtkCssNode node;
};
struct _GtkCssTransientNodeClass
{
GtkCssNodeClass node_class;
};
GType gtk_css_transient_node_get_type (void) G_GNUC_CONST;
GtkCssNode * gtk_css_transient_node_new (GtkCssNode *parent);
G_END_DECLS
#endif /* __GTK_CSS_TRANSIENT_NODE_PRIVATE_H__ */
+2 -3
View File
@@ -39,12 +39,11 @@ gtk_css_value_typed_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (_gtk_css_style_property_lookup_by_id (property_id));
return _gtk_css_style_funcs_compute_value (provider, style, parent_style, custom->pspec->value_type, value, dependencies);
return _gtk_css_style_funcs_compute_value (provider, style, parent_style, custom->pspec->value_type, value);
}
static gboolean
+2 -10
View File
@@ -57,7 +57,7 @@ _gtk_css_change_for_sibling (GtkCssChange match)
{ GTK_CSS_CHANGE_POSITION, GTK_CSS_CHANGE_SIBLING_POSITION },
{ GTK_CSS_CHANGE_STATE, GTK_CSS_CHANGE_SIBLING_STATE },
{ GTK_CSS_CHANGE_SOURCE, 0 },
{ GTK_CSS_CHANGE_ANIMATE, 0 }
{ GTK_CSS_CHANGE_PARENT_STYLE, 0 }
};
return gtk_css_change_translate (match, table, G_N_ELEMENTS (table));
@@ -76,17 +76,9 @@ _gtk_css_change_for_child (GtkCssChange match)
{ GTK_CSS_CHANGE_SIBLING_POSITION, GTK_CSS_CHANGE_PARENT_SIBLING_POSITION },
{ GTK_CSS_CHANGE_SIBLING_STATE, GTK_CSS_CHANGE_PARENT_SIBLING_STATE },
{ GTK_CSS_CHANGE_SOURCE, 0 },
{ GTK_CSS_CHANGE_ANIMATE, 0 }
{ GTK_CSS_CHANGE_PARENT_STYLE, 0 }
};
return gtk_css_change_translate (match, table, G_N_ELEMENTS (table));
}
GtkCssDependencies
_gtk_css_dependencies_union (GtkCssDependencies first,
GtkCssDependencies second)
{
return (first & ~GTK_CSS_EQUALS_PARENT) | ((first & GTK_CSS_EQUALS_PARENT) ? GTK_CSS_DEPENDS_ON_PARENT : 0)
| (second & ~GTK_CSS_EQUALS_PARENT) | ((second & GTK_CSS_EQUALS_PARENT) ? GTK_CSS_DEPENDS_ON_PARENT : 0);
}
+8 -11
View File
@@ -23,7 +23,9 @@
G_BEGIN_DECLS
/* forward declaration for GtkCssValue */
typedef union _GtkCssMatcher GtkCssMatcher;
typedef struct _GtkCssNode GtkCssNode;
typedef struct _GtkCssNodeDeclaration GtkCssNodeDeclaration;
typedef struct _GtkCssStyle GtkCssStyle;
typedef struct _GtkStyleProviderPrivate GtkStyleProviderPrivate; /* dummy typedef */
@@ -49,7 +51,9 @@ typedef enum { /*< skip >*/
GTK_CSS_CHANGE_PARENT_SIBLING_STATE = (1 << 15),
/* add more */
GTK_CSS_CHANGE_SOURCE = (1 << 16),
GTK_CSS_CHANGE_ANIMATE = (1 << 17),
GTK_CSS_CHANGE_PARENT_STYLE = (1 << 17),
GTK_CSS_CHANGE_TIMESTAMP = (1 << 18),
GTK_CSS_CHANGE_ANIMATIONS = (1 << 19),
GTK_CSS_CHANGE_RESERVED_BIT = (1 << 31) /* Used internally in gtkcssselector.c */
} GtkCssChange;
@@ -63,13 +67,6 @@ typedef enum { /*< skip >*/
GTK_CSS_CHANGE_PARENT_POSITION | GTK_CSS_CHANGE_PARENT_SIBLING_POSITION | \
GTK_CSS_CHANGE_PARENT_STATE | GTK_CSS_CHANGE_PARENT_SIBLING_STATE)
typedef enum /*< skip >*/ {
GTK_CSS_DEPENDS_ON_PARENT = (1 << 0),
GTK_CSS_EQUALS_PARENT = (1 << 1),
GTK_CSS_DEPENDS_ON_COLOR = (1 << 2),
GTK_CSS_DEPENDS_ON_FONT_SIZE = (1 << 3)
} GtkCssDependencies;
/*
* GtkCssAffects:
* @GTK_CSS_AFFECTS_FOREGROUND: The foreground rendering is affected.
@@ -167,6 +164,8 @@ enum { /*< skip >*/
GTK_CSS_PROPERTY_ICON_SHADOW,
GTK_CSS_PROPERTY_ICON_STYLE,
GTK_CSS_PROPERTY_ICON_TRANSFORM,
GTK_CSS_PROPERTY_MIN_WIDTH,
GTK_CSS_PROPERTY_MIN_HEIGHT,
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
GTK_CSS_PROPERTY_TRANSITION_DURATION,
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
@@ -279,8 +278,6 @@ typedef enum /*< skip >*/ {
GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match);
GtkCssChange _gtk_css_change_for_child (GtkCssChange match);
GtkCssDependencies _gtk_css_dependencies_union (GtkCssDependencies first,
GtkCssDependencies second);
/* for lack of better place to put it */
/* mirror what cairo does */
+2 -4
View File
@@ -39,8 +39,7 @@ gtk_css_value_unset_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssStyleProperty *property;
GtkCssValue *unset_value;
@@ -56,8 +55,7 @@ gtk_css_value_unset_compute (GtkCssValue *value,
property_id,
provider,
style,
parent_style,
dependencies);
parent_style);
}
static gboolean
+2 -11
View File
@@ -72,9 +72,6 @@ _gtk_css_value_unref (GtkCssValue *value)
* @provider: Style provider for looking up extra information
* @values: values to compute for
* @parent_values: parent values to use for inherited values
* @dependencies: (out) (allow-none): Set to the dependencies of the
* computed values that indicate when this value needs to be
* recomputed and how.
*
* Converts the specified @value into the computed value for the CSS
* property given by @property_id using the information in @context.
@@ -88,21 +85,15 @@ _gtk_css_value_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies)
GtkCssStyle *parent_style)
{
GtkCssDependencies fallback;
gtk_internal_return_val_if_fail (value != NULL, NULL);
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
if (dependencies == NULL)
dependencies = &fallback;
*dependencies = 0;
return value->class->compute (value, property_id, provider, style, parent_style, dependencies);
return value->class->compute (value, property_id, provider, style, parent_style);
}
gboolean
+2 -4
View File
@@ -44,8 +44,7 @@ struct _GtkCssValueClass {
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies);
GtkCssStyle *parent_style);
gboolean (* equal) (const GtkCssValue *value1,
const GtkCssValue *value2);
GtkCssValue * (* transition) (GtkCssValue *start,
@@ -69,8 +68,7 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style,
GtkCssDependencies *dependencies);
GtkCssStyle *parent_style);
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
const GtkCssValue *value2);
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
+300
View File
@@ -0,0 +1,300 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcsswidgetnodeprivate.h"
#include "gtkcontainerprivate.h"
#include "gtkcssanimatedstyleprivate.h"
#include "gtkprivate.h"
#include "gtksettingsprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkwidgetprivate.h"
/* widgets for special casing go here */
#include "gtkbox.h"
/* When these change we do a full restyling. Otherwise we try to figure out
* if we need to change things. */
#define GTK_CSS_RADICAL_CHANGE (GTK_CSS_CHANGE_NAME | GTK_CSS_CHANGE_CLASS | GTK_CSS_CHANGE_SOURCE | GTK_CSS_CHANGE_PARENT_STYLE)
G_DEFINE_TYPE (GtkCssWidgetNode, gtk_css_widget_node, GTK_TYPE_CSS_NODE)
static void
gtk_css_widget_node_finalize (GObject *object)
{
GtkCssWidgetNode *node = GTK_CSS_WIDGET_NODE (object);
_gtk_bitmask_free (node->accumulated_changes);
G_OBJECT_CLASS (gtk_css_widget_node_parent_class)->finalize (object);
}
static void
gtk_css_widget_node_style_changed (GtkCssNode *cssnode,
GtkCssStyle *old_style,
GtkCssStyle *new_style)
{
GtkCssWidgetNode *node;
GtkBitmask *diff;
node = GTK_CSS_WIDGET_NODE (cssnode);
GTK_CSS_NODE_CLASS (gtk_css_widget_node_parent_class)->style_changed (cssnode, old_style, new_style);
diff = gtk_css_style_get_difference (new_style, old_style);
node->accumulated_changes = _gtk_bitmask_union (node->accumulated_changes, diff);
_gtk_bitmask_free (diff);
}
static gboolean
gtk_css_widget_node_queue_callback (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GtkCssNode *node = user_data;
gtk_css_node_invalidate_frame_clock (node, TRUE);
_gtk_container_queue_restyle (GTK_CONTAINER (widget));
return G_SOURCE_CONTINUE;
}
static void
gtk_css_widget_node_queue_validate (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_RESIZE_CONTAINER (widget_node->widget))
widget_node->validate_cb_id = gtk_widget_add_tick_callback (widget_node->widget,
gtk_css_widget_node_queue_callback,
node,
NULL);
G_GNUC_END_IGNORE_DEPRECATIONS
}
static void
gtk_css_widget_node_dequeue_validate (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (GTK_IS_RESIZE_CONTAINER (widget_node->widget))
gtk_widget_remove_tick_callback (widget_node->widget,
widget_node->validate_cb_id);
G_GNUC_END_IGNORE_DEPRECATIONS
}
static void
gtk_css_widget_node_validate (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
GtkStyleContext *context;
if (widget_node->widget == NULL)
return;
context = _gtk_widget_peek_style_context (widget_node->widget);
if (context)
gtk_style_context_validate (context, widget_node->accumulated_changes);
else
_gtk_widget_style_context_invalidated (widget_node->widget);
_gtk_bitmask_free (widget_node->accumulated_changes);
widget_node->accumulated_changes = _gtk_bitmask_new ();
}
typedef GtkWidgetPath * (* GetPathForChildFunc) (GtkContainer *, GtkWidget *);
static gboolean
widget_needs_widget_path (GtkWidget *widget)
{
static GetPathForChildFunc funcs[2];
GtkWidget *parent;
GetPathForChildFunc parent_func;
guint i;
if (G_UNLIKELY (funcs[0] == NULL))
{
i = 0;
funcs[i++] = GTK_CONTAINER_CLASS (g_type_class_ref (GTK_TYPE_CONTAINER))->get_path_for_child;
funcs[i++] = GTK_CONTAINER_CLASS (g_type_class_ref (GTK_TYPE_BOX))->get_path_for_child;
g_assert (i == G_N_ELEMENTS (funcs));
}
parent = gtk_widget_get_parent (widget);
if (parent == NULL)
return FALSE;
parent_func = GTK_CONTAINER_GET_CLASS (GTK_CONTAINER (parent))->get_path_for_child;
for (i = 0; i < G_N_ELEMENTS (funcs); i++)
{
if (funcs[i] == parent_func)
return FALSE;
}
return TRUE;
}
gboolean
gtk_css_widget_node_init_matcher (GtkCssNode *node,
GtkCssMatcher *matcher)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
if (widget_node->widget == NULL)
return FALSE;
if (!widget_needs_widget_path (widget_node->widget))
return GTK_CSS_NODE_CLASS (gtk_css_widget_node_parent_class)->init_matcher (node, matcher);
return _gtk_css_matcher_init (matcher,
gtk_widget_get_path (widget_node->widget),
gtk_css_node_get_declaration (node));
}
static GtkWidgetPath *
gtk_css_widget_node_create_widget_path (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
GtkWidgetPath *path;
guint length;
if (widget_node->widget == NULL)
path = gtk_widget_path_new ();
else
path = _gtk_widget_create_path (widget_node->widget);
length = gtk_widget_path_length (path);
if (length > 0)
{
gtk_css_node_declaration_add_to_widget_path (gtk_css_node_get_declaration (node),
path,
length - 1);
}
return path;
}
static const GtkWidgetPath *
gtk_css_widget_node_get_widget_path (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
if (widget_node->widget == NULL)
return NULL;
return gtk_widget_get_path (widget_node->widget);
}
static GtkStyleProviderPrivate *
gtk_css_widget_node_get_style_provider (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
GtkStyleContext *context;
GtkStyleCascade *cascade;
if (widget_node->widget == NULL)
return NULL;
context = _gtk_widget_peek_style_context (widget_node->widget);
if (context)
return gtk_style_context_get_style_provider (context);
cascade = _gtk_settings_get_style_cascade (gtk_widget_get_settings (widget_node->widget),
gtk_widget_get_scale_factor (widget_node->widget));
return GTK_STYLE_PROVIDER_PRIVATE (cascade);
}
static GdkFrameClock *
gtk_css_widget_node_get_frame_clock (GtkCssNode *node)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
gboolean animate;
if (widget_node->widget == NULL)
return NULL;
g_object_get (gtk_widget_get_settings (widget_node->widget),
"gtk-enable-animations", &animate,
NULL);
if (animate == FALSE)
return NULL;
return gtk_widget_get_frame_clock (widget_node->widget);
}
static void
gtk_css_widget_node_class_init (GtkCssWidgetNodeClass *klass)
{
GtkCssNodeClass *node_class = GTK_CSS_NODE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_css_widget_node_finalize;
node_class->validate = gtk_css_widget_node_validate;
node_class->queue_validate = gtk_css_widget_node_queue_validate;
node_class->dequeue_validate = gtk_css_widget_node_dequeue_validate;
node_class->init_matcher = gtk_css_widget_node_init_matcher;
node_class->create_widget_path = gtk_css_widget_node_create_widget_path;
node_class->get_widget_path = gtk_css_widget_node_get_widget_path;
node_class->get_style_provider = gtk_css_widget_node_get_style_provider;
node_class->get_frame_clock = gtk_css_widget_node_get_frame_clock;
node_class->style_changed = gtk_css_widget_node_style_changed;
}
static void
gtk_css_widget_node_init (GtkCssWidgetNode *node)
{
node->accumulated_changes = _gtk_bitmask_new ();
}
GtkCssNode *
gtk_css_widget_node_new (GtkWidget *widget)
{
GtkCssWidgetNode *result;
gtk_internal_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
result = g_object_new (GTK_TYPE_CSS_WIDGET_NODE, NULL);
result->widget = widget;
gtk_css_node_set_visible (GTK_CSS_NODE (result),
gtk_widget_get_visible (widget));
return GTK_CSS_NODE (result);
}
void
gtk_css_widget_node_widget_destroyed (GtkCssWidgetNode *node)
{
gtk_internal_return_if_fail (GTK_IS_CSS_WIDGET_NODE (node));
gtk_internal_return_if_fail (node->widget != NULL);
node->widget = NULL;
/* Contents of this node are now undefined.
* So we don't clear the style or anything.
*/
}
GtkWidget *
gtk_css_widget_node_get_widget (GtkCssWidgetNode *node)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_WIDGET_NODE (node), NULL);
return node->widget;
}
+60
View File
@@ -0,0 +1,60 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_WIDGET_NODE_PRIVATE_H__
#define __GTK_CSS_WIDGET_NODE_PRIVATE_H__
#include "gtkcssnodeprivate.h"
#include "gtkwidget.h"
G_BEGIN_DECLS
#define GTK_TYPE_CSS_WIDGET_NODE (gtk_css_widget_node_get_type ())
#define GTK_CSS_WIDGET_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_WIDGET_NODE, GtkCssWidgetNode))
#define GTK_CSS_WIDGET_NODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_WIDGET_NODE, GtkCssWidgetNodeClass))
#define GTK_IS_CSS_WIDGET_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_WIDGET_NODE))
#define GTK_IS_CSS_WIDGET_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_WIDGET_NODE))
#define GTK_CSS_WIDGET_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_WIDGET_NODE, GtkCssWidgetNodeClass))
typedef struct _GtkCssWidgetNode GtkCssWidgetNode;
typedef struct _GtkCssWidgetNodeClass GtkCssWidgetNodeClass;
struct _GtkCssWidgetNode
{
GtkCssNode node;
GtkWidget *widget;
guint validate_cb_id;
GtkBitmask *accumulated_changes;
};
struct _GtkCssWidgetNodeClass
{
GtkCssNodeClass node_class;
};
GType gtk_css_widget_node_get_type (void) G_GNUC_CONST;
GtkCssNode * gtk_css_widget_node_new (GtkWidget *widget);
void gtk_css_widget_node_widget_destroyed (GtkCssWidgetNode *node);
GtkWidget * gtk_css_widget_node_get_widget (GtkCssWidgetNode *node);
G_END_DECLS
#endif /* __GTK_CSS_WIDGET_NODE_PRIVATE_H__ */
+200 -143
View File
@@ -34,6 +34,7 @@
#include "gtkbindings.h"
#include "gtkcelleditable.h"
#include "gtkclipboard.h"
#include "gtkcssnodeutilsprivate.h"
#include "gtkdebug.h"
#include "gtkdnd.h"
#include "gtkentry.h"
@@ -174,6 +175,8 @@ struct _GtkEntryPrivate
GtkGesture *drag_gesture;
GtkGesture *multipress_gesture;
GtkCssNode *progress_node;
gfloat xalign;
gint ascent; /* font ascent in pango units */
@@ -235,12 +238,12 @@ struct _GtkEntryPrivate
struct _EntryIconInfo
{
GdkWindow *window;
GtkCssNode *css_node;
gchar *tooltip;
guint insensitive : 1;
guint nonactivatable : 1;
guint prelight : 1;
guint in_drag : 1;
guint pressed : 1;
GdkDragAction actions;
GtkTargetList *target_list;
@@ -1509,13 +1512,17 @@ gtk_entry_class_init (GtkEntryClass *class)
* icons prelight on mouseover.
*
* Since: 2.16
*
* Deprecated: 3.18: Activatable icons are always prelit on hover.
* Just don't style the :hover style if you don't want them to
* look different.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("icon-prelight",
P_("Icon Prelight"),
P_("Whether activatable icons should prelight when hovered"),
TRUE,
GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY));
GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED));
/**
* GtkEntry:progress-border:
@@ -2691,7 +2698,7 @@ find_invisible_char (GtkWidget *widget)
static void
gtk_entry_init (GtkEntry *entry)
{
GtkStyleContext *context;
GtkCssNode *widget_node;
GtkEntryPrivate *priv;
entry->priv = gtk_entry_get_instance_private (entry);
@@ -2735,8 +2742,8 @@ gtk_entry_init (GtkEntry *entry)
g_signal_connect (priv->im_context, "delete-surrounding",
G_CALLBACK (gtk_entry_delete_surrounding_cb), entry);
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_ENTRY);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (entry));
gtk_css_node_add_class (widget_node, GTK_STYLE_CLASS_ENTRY);
gtk_entry_update_cached_style_values (entry);
@@ -2753,6 +2760,16 @@ gtk_entry_init (GtkEntry *entry)
G_CALLBACK (gtk_entry_multipress_gesture_pressed), entry);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->multipress_gesture), TRUE);
priv->progress_node = gtk_css_node_new ();
gtk_css_node_set_widget_type (priv->progress_node, GTK_TYPE_ENTRY);
gtk_css_node_add_class (priv->progress_node, GTK_STYLE_CLASS_ENTRY);
gtk_css_node_add_class (priv->progress_node, GTK_STYLE_CLASS_PROGRESSBAR);
gtk_css_node_set_parent (priv->progress_node, widget_node);
gtk_css_node_set_state (priv->progress_node, gtk_css_node_get_state (widget_node));
g_signal_connect_object (priv->progress_node, "style-changed", G_CALLBACK (gtk_css_node_style_changed_for_widget), entry, 0);
g_object_unref (priv->progress_node);
}
static void
@@ -2791,47 +2808,6 @@ gtk_entry_ensure_text_handles (GtkEntry *entry)
G_CALLBACK (gtk_entry_handle_drag_finished), entry);
}
static void
gtk_entry_prepare_context_for_icon (GtkEntry *entry,
GtkStyleContext *context,
GtkEntryIconPosition icon_pos)
{
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = priv->icons[icon_pos];
GtkWidget *widget;
GtkStateFlags state;
widget = GTK_WIDGET (entry);
state = gtk_widget_get_state_flags (widget);
state &= ~(GTK_STATE_FLAG_PRELIGHT);
if ((state & GTK_STATE_FLAG_INSENSITIVE) || icon_info->insensitive)
state |= GTK_STATE_FLAG_INSENSITIVE;
else if (icon_info->prelight)
state |= GTK_STATE_FLAG_PRELIGHT;
gtk_style_context_save (context);
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE);
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
{
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
else
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
}
else
{
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
else
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
}
}
static gint
get_icon_width (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
@@ -2847,7 +2823,7 @@ get_icon_width (GtkEntry *entry,
return 0;
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
gtk_entry_prepare_context_for_icon (entry, context, icon_pos);
gtk_style_context_save_to_node (context, priv->icons[icon_pos]->css_node);
state = gtk_style_context_get_state (context);
gtk_style_context_get_padding (context, state, &padding);
@@ -3002,6 +2978,8 @@ gtk_entry_finalize (GObject *object)
{
if ((icon_info = priv->icons[i]) != NULL)
{
g_object_unref (icon_info->css_node);
if (icon_info->target_list != NULL)
{
gtk_target_list_unref (icon_info->target_list);
@@ -3213,12 +3191,85 @@ realize_icon_info (GtkWidget *widget,
}
static void
update_state_for_icon_infos (GtkWidget *widget)
{
GtkCssNode *cssnode, *first_node, *last_node;
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
GtkStateFlags state;
#define NOT_INHERITED (GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE)
cssnode = gtk_widget_get_css_node (widget);
state = gtk_widget_get_state_flags (widget);
if (priv->icons[GTK_ENTRY_ICON_PRIMARY])
gtk_css_node_set_state (priv->icons[GTK_ENTRY_ICON_PRIMARY]->css_node,
(state & ~NOT_INHERITED)
| (gtk_css_node_get_state (priv->icons[GTK_ENTRY_ICON_PRIMARY]->css_node) & NOT_INHERITED)
| (priv->icons[GTK_ENTRY_ICON_PRIMARY]->insensitive ? GTK_STATE_FLAG_INSENSITIVE : 0));
if (priv->icons[GTK_ENTRY_ICON_SECONDARY])
gtk_css_node_set_state (priv->icons[GTK_ENTRY_ICON_SECONDARY]->css_node,
(state & ~NOT_INHERITED)
| (gtk_css_node_get_state (priv->icons[GTK_ENTRY_ICON_SECONDARY]->css_node) & NOT_INHERITED)
| (priv->icons[GTK_ENTRY_ICON_SECONDARY]->insensitive ? GTK_STATE_FLAG_INSENSITIVE : 0));
if (state & GTK_STATE_FLAG_DIR_RTL)
{
first_node = priv->icons[GTK_ENTRY_ICON_SECONDARY] ? priv->icons[GTK_ENTRY_ICON_SECONDARY]->css_node : NULL;
last_node = priv->icons[GTK_ENTRY_ICON_PRIMARY] ? priv->icons[GTK_ENTRY_ICON_PRIMARY]->css_node : NULL;
}
else
{
first_node = priv->icons[GTK_ENTRY_ICON_PRIMARY] ? priv->icons[GTK_ENTRY_ICON_PRIMARY]->css_node : NULL;
last_node = priv->icons[GTK_ENTRY_ICON_SECONDARY] ? priv->icons[GTK_ENTRY_ICON_SECONDARY]->css_node : NULL;
}
if (first_node)
{
if (first_node != gtk_css_node_get_first_child (cssnode))
gtk_css_node_set_before (first_node, gtk_css_node_get_first_child (cssnode));
gtk_css_node_remove_class (first_node, GTK_STYLE_CLASS_RIGHT);
gtk_css_node_add_class (first_node, GTK_STYLE_CLASS_LEFT);
}
if (last_node)
{
if (last_node != gtk_css_node_get_last_child (cssnode))
gtk_css_node_set_after (last_node, gtk_css_node_get_last_child (cssnode));
gtk_css_node_remove_class (last_node, GTK_STYLE_CLASS_LEFT);
gtk_css_node_add_class (last_node, GTK_STYLE_CLASS_RIGHT);
}
#undef NOT_INHERITED
}
static void
icon_node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
GtkIconHelper *icon_helper;
gtk_css_node_style_changed_for_widget (node, old_style, new_style, widget);
if (priv->icons[GTK_ENTRY_ICON_PRIMARY] && priv->icons[GTK_ENTRY_ICON_PRIMARY]->css_node == node)
icon_helper = priv->icons[GTK_ENTRY_ICON_PRIMARY]->icon_helper;
else
icon_helper = priv->icons[GTK_ENTRY_ICON_SECONDARY]->icon_helper;
_gtk_icon_helper_invalidate (icon_helper);
}
static EntryIconInfo*
construct_icon_info (GtkWidget *widget,
GtkEntryIconPosition icon_pos)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
GtkCssNode *widget_node;
EntryIconInfo *icon_info;
g_return_val_if_fail (priv->icons[icon_pos] == NULL, NULL);
@@ -3229,6 +3280,14 @@ construct_icon_info (GtkWidget *widget,
icon_info->icon_helper = _gtk_icon_helper_new ();
_gtk_icon_helper_set_force_scale_pixbuf (icon_info->icon_helper, TRUE);
icon_info->css_node = gtk_css_node_new ();
widget_node = gtk_widget_get_css_node (widget);
gtk_css_node_add_class (icon_info->css_node, GTK_STYLE_CLASS_ENTRY);
gtk_css_node_add_class (icon_info->css_node, GTK_STYLE_CLASS_IMAGE);
gtk_css_node_set_parent (icon_info->css_node, widget_node);
g_signal_connect_object (icon_info->css_node, "style-changed", G_CALLBACK (icon_node_style_changed_cb), widget, 0);
update_state_for_icon_infos (widget);
if (gtk_widget_get_realized (widget))
realize_icon_info (widget, icon_pos);
@@ -3429,14 +3488,19 @@ _gtk_entry_get_borders (GtkEntry *entry,
}
static void
gtk_entry_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
gtk_entry_get_content_width (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
gpointer data)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkWidget *widget = GTK_WIDGET(data);
GtkEntry *entry = GTK_ENTRY (data);
GtkEntryPrivate *priv = entry->priv;
PangoFontMetrics *metrics;
GtkBorder borders;
PangoContext *context;
gint icon_width, i;
gint min, nat;
@@ -3444,8 +3508,6 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
gint digit_width;
gint char_pixels;
_gtk_entry_get_borders (entry, &borders);
context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
@@ -3458,14 +3520,14 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
pango_font_metrics_unref (metrics);
if (priv->width_chars < 0)
min = MIN_ENTRY_WIDTH + borders.left + borders.right;
min = MIN_ENTRY_WIDTH;
else
min = char_pixels * priv->width_chars + borders.left + borders.right;
min = char_pixels * priv->width_chars;
if (priv->max_width_chars < 0)
nat = MIN_ENTRY_WIDTH + borders.left + borders.right;
nat = MIN_ENTRY_WIDTH;
else
nat = char_pixels * priv->max_width_chars + borders.left + borders.right;
nat = char_pixels * priv->max_width_chars;
icon_width = 0;
for (i = 0; i < MAX_ICONS; i++)
@@ -3479,17 +3541,33 @@ gtk_entry_get_preferred_width (GtkWidget *widget,
}
static void
gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
gint width,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline)
gtk_entry_get_preferred_width (GtkWidget *widget,
gint *minimum,
gint *natural)
{
GtkEntry *entry = GTK_ENTRY (widget);
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
GTK_ORIENTATION_HORIZONTAL,
-1,
minimum, natural,
NULL, NULL,
gtk_entry_get_content_width,
widget);
}
static void
gtk_entry_get_content_height (GtkCssNode *cssnode,
GtkOrientation orientation,
gint for_size,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET(data);
GtkEntry *entry = GTK_ENTRY (data);
GtkEntryPrivate *priv = entry->priv;
PangoFontMetrics *metrics;
GtkBorder borders;
PangoContext *context;
gint height, baseline;
PangoLayout *layout;
@@ -3505,14 +3583,11 @@ gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
priv->descent = pango_font_metrics_get_descent (metrics);
pango_font_metrics_unref (metrics);
_gtk_entry_get_borders (entry, &borders);
pango_layout_get_pixel_size (layout, NULL, &height);
height = MAX (height, PANGO_PIXELS (priv->ascent + priv->descent));
height += borders.top + borders.bottom;
baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
baseline += borders.top;
*minimum = height;
*natural = height;
@@ -3522,6 +3597,23 @@ gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
*natural_baseline = baseline;
}
static void
gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
gint width,
gint *minimum,
gint *natural,
gint *minimum_baseline,
gint *natural_baseline)
{
gtk_css_node_get_preferred_size (gtk_widget_get_css_node (widget),
GTK_ORIENTATION_VERTICAL,
width,
minimum, natural,
minimum_baseline, natural_baseline,
gtk_entry_get_content_height,
widget);
}
static void
gtk_entry_get_preferred_height (GtkWidget *widget,
gint *minimum,
@@ -3584,13 +3676,11 @@ gtk_entry_get_text_area_size (GtkEntry *entry,
{
GtkWidget *widget = GTK_WIDGET (entry);
GtkAllocation allocation;
GtkRequisition requisition;
gint req_height;
gint req_height, unused;
gint frame_height;
GtkBorder borders;
gtk_widget_get_preferred_size (widget, &requisition, NULL);
req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
gtk_entry_get_preferred_height_and_baseline_for_width (widget, -1, &req_height, &unused, NULL, NULL);
gtk_widget_get_allocation (widget, &allocation);
_gtk_entry_get_borders (entry, &borders);
@@ -3640,16 +3730,11 @@ gtk_entry_get_frame_size (GtkEntry *entry,
{
GtkEntryPrivate *priv = entry->priv;
GtkAllocation allocation;
GtkRequisition requisition;
GtkWidget *widget = GTK_WIDGET (entry);
gint area_height, y_pos;
gint baseline;
gint req_height;
GtkBorder borders;
gint req_height, req_baseline, unused;
gtk_widget_get_preferred_size (widget, &requisition, NULL);
req_height = requisition.height - gtk_widget_get_margin_top (widget) - gtk_widget_get_margin_bottom (widget);
gtk_entry_get_preferred_height_and_baseline_for_width (widget, -1, &req_height, &unused, &req_baseline, &unused);
gtk_widget_get_allocation (widget, &allocation);
baseline = gtk_widget_get_allocated_baseline (widget);
@@ -3666,12 +3751,7 @@ gtk_entry_get_frame_size (GtkEntry *entry,
if (baseline == -1)
*y = (allocation.height - req_height) / 2;
else
{
_gtk_entry_get_borders (entry, &borders);
area_height = req_height - borders.top - borders.bottom;
y_pos = ((area_height * PANGO_SCALE - priv->ascent - priv->descent) / 2 + priv->ascent) / PANGO_SCALE;
*y = baseline - y_pos - borders.top;
}
*y = baseline - req_baseline;
}
*y += allocation.y;
@@ -3748,7 +3828,6 @@ should_prelight (GtkEntry *entry,
{
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = priv->icons[icon_pos];
gboolean prelight;
if (!icon_info)
return FALSE;
@@ -3756,14 +3835,7 @@ should_prelight (GtkEntry *entry,
if (icon_info->nonactivatable && icon_info->target_list == NULL)
return FALSE;
if (icon_info->pressed)
return FALSE;
gtk_widget_style_get (GTK_WIDGET (entry),
"icon-prelight", &prelight,
NULL);
return prelight;
return TRUE;
}
static void
@@ -3794,7 +3866,7 @@ draw_icon (GtkWidget *widget,
gtk_cairo_transform_to_window (cr, widget, icon_info->window);
context = gtk_widget_get_style_context (widget);
gtk_entry_prepare_context_for_icon (entry, context, icon_pos);
gtk_style_context_save_to_node (context, priv->icons[icon_pos]->css_node);
_gtk_icon_helper_get_size (icon_info->icon_helper, context,
&pix_width, &pix_height);
state = gtk_style_context_get_state (context);
@@ -3851,18 +3923,6 @@ gtk_entry_draw_frame (GtkWidget *widget,
cairo_restore (cr);
}
static void
gtk_entry_prepare_context_for_progress (GtkEntry *entry,
GtkStyleContext *context)
{
GtkEntryPrivate *private = entry->priv;
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
if (private->progress_pulse_mode)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PULSE);
}
static void
get_progress_area (GtkWidget *widget,
gint *x,
@@ -3911,7 +3971,7 @@ get_progress_area (GtkWidget *widget,
}
}
gtk_entry_prepare_context_for_progress (entry, context);
gtk_style_context_save_to_node (context, private->progress_node);
gtk_style_context_get_margin (context, state, &margin);
gtk_style_context_restore (context);
@@ -3965,7 +4025,7 @@ gtk_entry_draw_progress (GtkWidget *widget,
if ((width <= 0) || (height <= 0))
return;
gtk_entry_prepare_context_for_progress (entry, context);
gtk_style_context_save_to_node (context, entry->priv->progress_node);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
@@ -4035,10 +4095,7 @@ gtk_entry_enter_notify (GtkWidget *widget,
if (icon_info != NULL && event->window == icon_info->window)
{
if (should_prelight (entry, i))
{
icon_info->prelight = TRUE;
gtk_widget_queue_draw (widget);
}
gtk_css_node_add_state (icon_info->css_node, GTK_STATE_FLAG_PRELIGHT);
break;
}
@@ -4063,13 +4120,10 @@ gtk_entry_leave_notify (GtkWidget *widget,
{
/* a grab means that we may never see the button release */
if (event->mode == GDK_CROSSING_GRAB || event->mode == GDK_CROSSING_GTK_GRAB)
icon_info->pressed = FALSE;
gtk_css_node_remove_state (icon_info->css_node, GTK_STATE_FLAG_ACTIVE);
if (should_prelight (entry, i))
{
icon_info->prelight = FALSE;
gtk_widget_queue_draw (widget);
}
gtk_css_node_remove_state (icon_info->css_node, GTK_STATE_FLAG_PRELIGHT);
break;
}
@@ -4309,15 +4363,10 @@ gtk_entry_event (GtkWidget *widget,
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
if (should_prelight (GTK_ENTRY (widget), i))
{
icon_info->prelight = FALSE;
gtk_widget_queue_draw (widget);
}
priv->start_x = x;
priv->start_y = y;
icon_info->pressed = TRUE;
gtk_css_node_add_state (icon_info->css_node, GTK_STATE_FLAG_ACTIVE);
icon_info->device = device;
if (!icon_info->nonactivatable)
@@ -4330,7 +4379,7 @@ gtk_entry_event (GtkWidget *widget,
break;
/* Fall through */
case GDK_MOTION_NOTIFY:
if (icon_info->pressed &&
if ((gtk_css_node_get_state (icon_info->css_node) & GTK_STATE_FLAG_ACTIVE) &&
icon_info->target_list != NULL &&
gtk_drag_check_threshold (widget,
priv->start_x,
@@ -4356,18 +4405,9 @@ gtk_entry_event (GtkWidget *widget,
icon_info->current_sequence = NULL;
/* Fall through */
case GDK_BUTTON_RELEASE:
icon_info->pressed = FALSE;
gtk_css_node_remove_state (icon_info->css_node, GTK_STATE_FLAG_ACTIVE);
icon_info->device = NULL;
if (should_prelight (GTK_ENTRY (widget), i) &&
x >= 0 && y >= 0 &&
x < gdk_window_get_width (icon_info->window) &&
y < gdk_window_get_height (icon_info->window))
{
icon_info->prelight = TRUE;
gtk_widget_queue_draw (widget);
}
if (!icon_info->nonactivatable)
g_signal_emit (widget, signals[ICON_RELEASE], 0, i, event);
@@ -5087,6 +5127,8 @@ gtk_entry_state_flags_changed (GtkWidget *widget,
gtk_editable_select_region (GTK_EDITABLE (entry), priv->current_pos, priv->current_pos);
}
update_state_for_icon_infos (widget);
gtk_entry_update_cached_style_values (entry);
}
@@ -6511,7 +6553,7 @@ gtk_entry_draw_text (GtkEntry *entry,
gtk_style_context_get_color (context, state, &text_color);
/* Get foreground color for progressbars */
gtk_entry_prepare_context_for_progress (entry, context);
gtk_style_context_save_to_node (context, priv->progress_node);
gtk_style_context_get_color (context, state, &bar_text_color);
gtk_style_context_restore (context);
@@ -7451,6 +7493,8 @@ gtk_entry_clear (GtkEntry *entry,
if (GDK_IS_WINDOW (icon_info->window))
gdk_window_hide (icon_info->window);
gtk_css_node_set_visible (icon_info->css_node, FALSE);
storage_type = _gtk_icon_helper_get_storage_type (icon_info->icon_helper);
switch (storage_type)
@@ -7498,7 +7542,7 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
GdkPixbuf *pix;
context = gtk_widget_get_style_context (GTK_WIDGET (entry));
gtk_entry_prepare_context_for_icon (entry, context, icon_pos);
gtk_style_context_save_to_node (context, priv->icons[icon_pos]->css_node);
pix = _gtk_icon_helper_ensure_pixbuf (icon_info->icon_helper,
context);
@@ -8508,6 +8552,8 @@ gtk_entry_set_icon_from_pixbuf (GtkEntry *entry,
_gtk_icon_helper_set_icon_size (icon_info->icon_helper,
GTK_ICON_SIZE_MENU);
gtk_css_node_set_visible (icon_info->css_node, TRUE);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify (G_OBJECT (entry), "primary-icon-pixbuf");
@@ -8574,6 +8620,8 @@ gtk_entry_set_icon_from_stock (GtkEntry *entry,
{
_gtk_icon_helper_set_stock_id (icon_info->icon_helper, new_id, GTK_ICON_SIZE_MENU);
gtk_css_node_set_visible (icon_info->css_node, TRUE);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify (G_OBJECT (entry), "primary-icon-stock");
@@ -8641,6 +8689,8 @@ gtk_entry_set_icon_from_icon_name (GtkEntry *entry,
{
_gtk_icon_helper_set_icon_name (icon_info->icon_helper, new_name, GTK_ICON_SIZE_MENU);
gtk_css_node_set_visible (icon_info->css_node, TRUE);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify (G_OBJECT (entry), "primary-icon-name");
@@ -8707,6 +8757,8 @@ gtk_entry_set_icon_from_gicon (GtkEntry *entry,
{
_gtk_icon_helper_set_gicon (icon_info->icon_helper, icon, GTK_ICON_SIZE_MENU);
gtk_css_node_set_visible (icon_info->css_node, TRUE);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify (G_OBJECT (entry), "primary-icon-gicon");
@@ -8973,14 +9025,15 @@ gtk_entry_set_icon_sensitive (GtkEntry *entry,
{
icon_info->insensitive = !sensitive;
icon_info->pressed = FALSE;
icon_info->prelight = FALSE;
gtk_css_node_remove_state (icon_info->css_node, GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE);
if (!gtk_widget_is_sensitive (GTK_WIDGET (entry)) || icon_info->insensitive)
gtk_css_node_add_state (icon_info->css_node, GTK_STATE_FLAG_INSENSITIVE);
else
gtk_css_node_remove_state (icon_info->css_node, GTK_STATE_FLAG_INSENSITIVE);
if (gtk_widget_get_realized (GTK_WIDGET (entry)))
update_cursors (GTK_WIDGET (entry));
gtk_widget_queue_draw (GTK_WIDGET (entry));
g_object_notify (G_OBJECT (entry),
icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-sensitive" : "secondary-icon-sensitive");
}
@@ -9492,7 +9545,7 @@ check_undo_icon_grab (GtkEntry *entry,
!gtk_widget_device_is_shadowed (GTK_WIDGET (entry), info->device))
return;
info->pressed = FALSE;
gtk_css_node_remove_state (info->css_node, GTK_STATE_FLAG_ACTIVE);
info->current_sequence = NULL;
info->device = NULL;
}
@@ -10566,6 +10619,8 @@ gtk_entry_start_pulse_mode (GtkEntry *entry)
priv->progress_pulse_mode = TRUE;
priv->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (entry), tick_cb, NULL, NULL);
gtk_css_node_add_class (priv->progress_node, GTK_STYLE_CLASS_PULSE);
priv->progress_fraction = 0.0;
priv->progress_pulse_way_back = FALSE;
priv->progress_pulse_current = 0.0;
@@ -10586,6 +10641,8 @@ gtk_entry_stop_pulse_mode (GtkEntry *entry)
priv->progress_pulse_mode = FALSE;
gtk_widget_remove_tick_callback (GTK_WIDGET (entry), priv->tick_id);
priv->tick_id = 0;
gtk_css_node_remove_class (priv->progress_node, GTK_STYLE_CLASS_PULSE);
}
}
+6 -4
View File
@@ -966,6 +966,8 @@ gtk_gl_area_get_error (GtkGLArea *area)
/**
* gtk_gl_area_set_required_version:
* @area: a #GtkGLArea
* @major: the major version
* @minor: the minor version
*
* Sets the required version of OpenGL to be used when creating the context
* for the widget.
@@ -976,8 +978,8 @@ gtk_gl_area_get_error (GtkGLArea *area)
*/
void
gtk_gl_area_set_required_version (GtkGLArea *area,
int major,
int minor)
gint major,
gint minor)
{
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
@@ -1000,8 +1002,8 @@ gtk_gl_area_set_required_version (GtkGLArea *area,
*/
void
gtk_gl_area_get_required_version (GtkGLArea *area,
int *major,
int *minor)
gint *major,
gint *minor)
{
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
+4 -4
View File
@@ -85,12 +85,12 @@ GtkWidget * gtk_gl_area_new (void);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_set_required_version (GtkGLArea *area,
int major,
int minor);
gint major,
gint minor);
GDK_AVAILABLE_IN_3_16
void gtk_gl_area_get_required_version (GtkGLArea *area,
int *major,
int *minor);
gint *major,
gint *minor);
GDK_AVAILABLE_IN_3_16
gboolean gtk_gl_area_get_has_alpha (GtkGLArea *area);
GDK_AVAILABLE_IN_3_16
+1 -1
View File
@@ -7138,7 +7138,7 @@ gtk_label_get_xalign (GtkLabel *label)
/**
* gtk_label_set_yalign:
* @label: a #GtkLabel
* @xalign: the new yalign value, between 0 and 1
* @yalign: the new yalign value, between 0 and 1
*
* Sets the #GtkLabel:yalign property for @label.
*
-5
View File
@@ -624,7 +624,6 @@ static void
gtk_menu_button_init (GtkMenuButton *menu_button)
{
GtkMenuButtonPrivate *priv;
AtkObject *accessible;
priv = gtk_menu_button_get_instance_private (menu_button);
menu_button->priv = priv;
@@ -634,10 +633,6 @@ gtk_menu_button_init (GtkMenuButton *menu_button)
add_arrow (menu_button);
gtk_widget_set_sensitive (GTK_WIDGET (menu_button), FALSE);
accessible = gtk_widget_get_accessible (GTK_WIDGET (menu_button));
if (GTK_IS_ACCESSIBLE (accessible))
atk_object_set_name (accessible, _("Menu"));
}
/**
+4 -2
View File
@@ -4822,6 +4822,8 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
redraw_rect.y = border;
gtk_widget_get_allocation (widget, &allocation);
if (allocation.width <= 1)
return;
get_padding_and_border (notebook, &padding);
@@ -4832,7 +4834,7 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
page->allocation.height - padding.bottom;
/* fall through */
case GTK_POS_TOP:
redraw_rect.width = allocation.width - 2 * border;
redraw_rect.width = MAX (1, allocation.width - 2 * border);
redraw_rect.height = page->allocation.height + padding.top;
break;
@@ -4843,7 +4845,7 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
/* fall through */
case GTK_POS_LEFT:
redraw_rect.width = page->allocation.width + padding.left;
redraw_rect.height = allocation.height - 2 * border;
redraw_rect.height = MAX (1, allocation.height - 2 * border);
break;
}
-2
View File
@@ -4036,7 +4036,6 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
g_object_set (cell,
"xpad", 10,
"ypad", 8,
"follow-state", TRUE,
NULL);
gtk_tree_view_column_pack_start (col, cell, FALSE);
gtk_tree_view_column_set_attributes (col, cell,
@@ -4069,7 +4068,6 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
/* align right, because for some reason gtk+ expands
this even though we tell it not to. */
"xalign", 1.0,
"follow-state", TRUE,
"gicon", eject,
NULL);
gtk_tree_view_column_pack_start (col, cell, FALSE);
+7 -7
View File
@@ -2823,10 +2823,11 @@ _gtk_range_get_wheel_delta (GtkRange *range,
GtkRangePrivate *priv = range->priv;
GtkAdjustment *adjustment = priv->adjustment;
gdouble dx, dy;
gdouble delta;
gdouble delta = 0;
gdouble page_size;
gdouble page_increment;
gdouble scroll_unit;
GdkScrollDirection direction;
page_size = gtk_adjustment_get_page_size (adjustment);
page_increment = gtk_adjustment_get_page_increment (adjustment);
@@ -2842,16 +2843,15 @@ _gtk_range_get_wheel_delta (GtkRange *range,
scroll_unit = 1;
#endif
if (dx != 0 &&
gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
delta = dx * scroll_unit;
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL)
delta = - (dx ? dx : dy) * scroll_unit;
else
delta = dy * scroll_unit;
}
else
else if (gdk_event_get_scroll_direction ((GdkEvent *) event, &direction))
{
if (event->direction == GDK_SCROLL_UP ||
event->direction == GDK_SCROLL_LEFT)
if (direction == GDK_SCROLL_UP ||
direction == GDK_SCROLL_RIGHT)
delta = - scroll_unit;
else
delta = scroll_unit;
+13 -11
View File
@@ -1077,7 +1077,6 @@ gtk_do_render_icon_pixbuf (GtkStyleContext *context,
GdkPixbuf *scaled;
GdkPixbuf *stated;
GdkPixbuf *base_pixbuf;
GtkStateFlags state;
gint width = 1;
gint height = 1;
cairo_t *cr;
@@ -1089,8 +1088,6 @@ gtk_do_render_icon_pixbuf (GtkStyleContext *context,
base_pixbuf = gtk_icon_source_get_pixbuf (source);
G_GNUC_END_IGNORE_DEPRECATIONS;
state = gtk_style_context_get_state (context);
g_return_val_if_fail (base_pixbuf != NULL, NULL);
if (size != (GtkIconSize) -1 &&
@@ -1122,9 +1119,9 @@ gtk_do_render_icon_pixbuf (GtkStyleContext *context,
image_effect = _gtk_css_image_effect_value_get
(_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_GTK_IMAGE_EFFECT));
if (image_effect == GTK_CSS_IMAGE_EFFECT_DIM ||
state & GTK_STATE_FLAG_INSENSITIVE)
switch (image_effect)
{
case GTK_CSS_IMAGE_EFFECT_DIM:
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gdk_pixbuf_get_width (scaled),
gdk_pixbuf_get_height (scaled));
@@ -1139,10 +1136,9 @@ gtk_do_render_icon_pixbuf (GtkStyleContext *context,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
cairo_surface_destroy (surface);
}
else if (image_effect == GTK_CSS_IMAGE_EFFECT_HIGHLIGHT ||
state & GTK_STATE_FLAG_PRELIGHT)
{
break;
case GTK_CSS_IMAGE_EFFECT_HIGHLIGHT:
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
gdk_pixbuf_get_width (scaled),
gdk_pixbuf_get_height (scaled));
@@ -1158,9 +1154,15 @@ gtk_do_render_icon_pixbuf (GtkStyleContext *context,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
cairo_surface_destroy (surface);
break;
default:
g_warn_if_reached ();
/* fall through */
case GTK_CSS_IMAGE_EFFECT_NONE:
stated = scaled;
break;
}
else
stated = scaled;
return stated;
}
+17 -3
View File
@@ -2908,7 +2908,10 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
gboolean handled = FALSE;
gdouble delta_x;
gdouble delta_y;
gdouble delta;
GdkScrollDirection direction;
gboolean shifted;
shifted = (event->state & GDK_SHIFT_MASK) != 0;
scrolled_window = GTK_SCROLLED_WINDOW (widget);
priv = scrolled_window->priv;
@@ -2917,6 +2920,15 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
if (gdk_event_get_scroll_deltas ((GdkEvent *) event, &delta_x, &delta_y))
{
if (shifted)
{
gdouble delta;
delta = delta_x;
delta_x = delta_y;
delta_y = delta;
}
if (delta_x != 0.0 &&
may_hscroll (scrolled_window))
{
@@ -2963,12 +2975,13 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
handled = TRUE;
}
}
else
else if (gdk_event_get_scroll_direction ((GdkEvent *)event, &direction))
{
GtkWidget *range;
gboolean may_scroll;
if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN)
if ((!shifted && (direction == GDK_SCROLL_UP || direction == GDK_SCROLL_DOWN)) ||
(shifted && (direction == GDK_SCROLL_LEFT || direction == GDK_SCROLL_RIGHT)))
{
range = priv->vscrollbar;
may_scroll = may_vscroll (scrolled_window);
@@ -2983,6 +2996,7 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
{
GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (range));
gdouble new_value;
gdouble delta;
delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event);
+3 -43
View File
@@ -263,11 +263,6 @@ static void gtk_spin_button_get_text_area_size (GtkEntry *entry,
gint *y,
gint *width,
gint *height);
static void gtk_spin_button_get_frame_size (GtkEntry *entry,
gint *x,
gint *y,
gint *width,
gint *height);
static void gtk_spin_button_unset_adjustment (GtkSpinButton *spin_button);
static void gtk_spin_button_set_orientation (GtkSpinButton *spin_button,
GtkOrientation orientation);
@@ -335,7 +330,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
entry_class->activate = gtk_spin_button_activate;
entry_class->get_text_area_size = gtk_spin_button_get_text_area_size;
entry_class->get_frame_size = gtk_spin_button_get_frame_size;
class->input = NULL;
class->output = NULL;
@@ -1858,32 +1852,6 @@ gtk_spin_button_activate (GtkEntry *entry)
GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->activate (entry);
}
static void
gtk_spin_button_get_frame_size (GtkEntry *entry,
gint *x,
gint *y,
gint *width,
gint *height)
{
GtkSpinButtonPrivate *priv = GTK_SPIN_BUTTON (entry)->priv;
gint up_panel_width, up_panel_height;
gint down_panel_width, down_panel_height;
gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->up_panel, &up_panel_width, &up_panel_height);
gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->down_panel, &down_panel_width, &down_panel_height);
GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->get_frame_size (entry, x, y, width, height);
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
{
if (y)
*y += up_panel_height;
if (height)
*height -= up_panel_height + down_panel_height;
}
}
static void
gtk_spin_button_get_text_area_size (GtkEntry *entry,
gint *x,
@@ -1895,13 +1863,13 @@ gtk_spin_button_get_text_area_size (GtkEntry *entry,
gint up_panel_width, up_panel_height;
gint down_panel_width, down_panel_height;
gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->up_panel, &up_panel_width, &up_panel_height);
gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->down_panel, &down_panel_width, &down_panel_height);
GTK_ENTRY_CLASS (gtk_spin_button_parent_class)->get_text_area_size (entry, x, y, width, height);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->up_panel, &up_panel_width, &up_panel_height);
gtk_spin_button_panel_get_size (GTK_SPIN_BUTTON (entry), priv->down_panel, &down_panel_width, &down_panel_height);
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
{
if (x)
@@ -1911,14 +1879,6 @@ gtk_spin_button_get_text_area_size (GtkEntry *entry,
if (width)
*width -= up_panel_width + down_panel_width;
}
else
{
if (y)
*y += up_panel_height;
if (height)
*height -= up_panel_height + down_panel_height;
}
}
static void
+2 -2
View File
@@ -482,7 +482,7 @@ gtk_stack_sidebar_set_stack (GtkStackSidebar *sidebar,
{
GtkStackSidebarPrivate *priv;
g_return_if_fail (GTK_IS_SIDEBAR (sidebar));
g_return_if_fail (GTK_IS_STACK_SIDEBAR (sidebar));
g_return_if_fail (GTK_IS_STACK (stack) || stack == NULL);
priv = gtk_stack_sidebar_get_instance_private (sidebar);
@@ -525,7 +525,7 @@ gtk_stack_sidebar_get_stack (GtkStackSidebar *sidebar)
{
GtkStackSidebarPrivate *priv;
g_return_val_if_fail (GTK_IS_SIDEBAR (sidebar), NULL);
g_return_val_if_fail (GTK_IS_STACK_SIDEBAR (sidebar), NULL);
priv = gtk_stack_sidebar_get_instance_private (sidebar);
+2 -2
View File
@@ -33,9 +33,9 @@ G_BEGIN_DECLS
#define GTK_TYPE_STACK_SIDEBAR (gtk_stack_sidebar_get_type ())
#define GTK_STACK_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STACK_SIDEBAR, GtkStackSidebar))
#define GTK_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STACK_SIDEBAR))
#define GTK_IS_STACK_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STACK_SIDEBAR))
#define GTK_STACK_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STACK_SIDEBAR, GtkStackSidebarClass))
#define GTK_IS_SIDEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STACK_SIDEBAR))
#define GTK_IS_STACK_SIDEBAR_CLASS(klass)(G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STACK_SIDEBAR))
#define GTK_STACK_SIDEBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STACK_SIDEBAR, GtkStackSidebarClass))
typedef struct _GtkStackSidebar GtkStackSidebar;
+194 -890
View File
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More