Compare commits

...

427 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
Matthias Clasen 1349b0f72d 3.15.11 2015-03-12 08:11:03 -04:00
Matthias Clasen b974ced51b Fix make dist
Add a missing quote.
2015-03-12 08:11:03 -04:00
Matthias Clasen c9faea04c5 Drop unused files 2015-03-12 07:41:52 -04:00
Dušan Kazik 171d4305f4 Updated Slovak translation 2015-03-12 10:20:08 +00:00
Milo Casagrande d96cbb3b59 Updated Italian translation 2015-03-12 08:57:43 +00:00
Jordi Mas e944525596 Update Catalan translation 2015-03-11 23:37:54 -04:00
Benjamin Otte 49881eebbb Revert "iconhelper: Don't check states"
This reverts commit 63f59dde3a.

It turns out, the state was not just necessary for style computation,
but also for tracking RTL and LTR. And so it broke the reftests.
2015-03-12 04:31:45 +01:00
Matthias Clasen 8615a52ca3 Add some reftests related to textview tags
This test shows that a) tags override the text view style and
b) tags override each other in the expected way.
2015-03-11 22:04:29 -04:00
Benjamin Otte 7ad203732f iconhelper: Use the screen's icon theme
... and not the default one.
2015-03-12 01:15:38 +01:00
Benjamin Otte 93f8966bd9 iconhelper: Replace function
The old one just calls the other one.
2015-03-12 01:15:38 +01:00
Benjamin Otte 181e58e402 iconhelper: Move function from style context into only user 2015-03-12 01:15:38 +01:00
Benjamin Otte 63f59dde3a iconhelper: Don't check states
This is the wrong thing to do in today's world.
2015-03-12 01:15:38 +01:00
Matthias Clasen b2d40afdf5 App Chooser: Fix app icons in HighContrast
We need to follow-state here as well, to make sure the
icons are visible on selected rows.
2015-03-11 15:32:47 -04:00
Changwoo Ryu f82341d1d3 Updated Korean translation 2015-03-12 02:52:52 +09:00
Philip Withnall 80013436d0 gtkentry: Document vfuncs in GtkEntryClass
Clarify that the signal handler vfuncs can be NULL, nothing else can,
and that they all have default implementations.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-11 11:24:29 +00:00
Philip Withnall 52858f709c gtktreeselection: Fix an abort on selecting an invalid range
gtk_tree_selection_real_modify_range() has a g_return_if_fail() if the
start or end paths passed to it do not correspond to real tree nodes.
However, GtkTreePaths inherently do not have to be valid, so it should
be acceptable to call gtk_tree_selection_select_range() with
non-existent paths. Replace the g_return_if_fail() by a silent return,
and add a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-11 11:24:29 +00:00
Philip Withnall d65ccf96ee gtknotebook: Add more non-NULL checks for cur_page
These were not spotted by scan-build, but from some brief mental
reasoning could potentially be problem areas.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-11 11:24:29 +00:00
Matthias Clasen 3b45be94e8 Gestures: Properly handle weak references
Every call to g_object_add_weak_pointer must be matched with
a g_object_remove_weak_pointer call, or we will get invalid
writes inside GObject.

https://bugzilla.gnome.org/show_bug.cgi?id=746013
2015-03-11 06:47:04 -04:00
Jonas Ådahl b4344861a0 wayland: Only bind to supported gtk-shell versions
The gtk-shell Wayland protocol extension is not meant to be backward
compatible right now, so avoid binding to any version that is not the
one supported.

https://bugzilla.gnome.org/show_bug.cgi?id=745721
2015-03-11 11:37:37 +08:00
Emmanuele Bassi a52ff2f66e build: Fix generating introspection on MacOS
We need to filter out platform-specific sources from the files that we
use with the introspection scanner.

In this specific case I could have moved the gtkclipboard-quartz.c and
the gtkdnd-quartz.c files out of the $(gtk_base_c_sources) variable, but
doing a filter-out on the variable itself is more resilient in case we
eventually add files and we forget about the result.
2015-03-10 22:15:56 +00:00
Matthias Clasen 073a9c9cd5 inspector: Add some margin to css editor
Requested in
https://bugzilla.gnome.org/show_bug.cgi?id=745918
2015-03-10 14:07:27 -04:00
Carlos Garnacho 622a930c5a window: reset both press/drag gestures when move/resize drag starts
Now that this is split in two separate gestures, both must be reset
when the WM grabs the pointer. Also, do on resize drags like on move
drags, and claim the gesture before resetting, so the ownership is
properly transferred across any other widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=745969
2015-03-10 16:48:16 +01:00
Anders Jonsson 2f8938cf23 Updated Swedish translation 2015-03-10 12:28:37 +00:00
Anders Jonsson 1cc35cdc6d Updated Swedish translation 2015-03-10 12:27:18 +00:00
Benjamin Otte 9e2cdce58e notebook: Fix boolean check
Commit c352093bde swapped the condition
when turning it into a return_if_fail().
2015-03-10 13:23:06 +01:00
Carlos Garnacho 94ec6b4418 entrycompletion: Ensure transient_for is set before showing window
gtk_entry_set_completion() (and _gtk_entry_completion_connect underneath)
may happen when the entry has no toplevel yet. This window acts as the
"parent" for subsurface windows on wayland, and is indispensable to create
its backing wl_subsurface, so this resulted in non-visible popups there.
Fix this by ensuring transient_for is set before showing the popup.

https://bugzilla.gnome.org/show_bug.cgi?id=745463
2015-03-10 11:15:04 +01:00
Philip Withnall c352093bde gtknotebook: Fix potential use of uninitialised variables
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-10 07:32:19 +00:00
Philip Withnall ac4da770e1 gtkprintunixdialog: Fix a potential g_object_unref(NULL) call
The code above checks whether (printer == NULL), so we’d better do so
here as well.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-10 07:32:19 +00:00
Matthias Clasen 5ced234144 Revert "csd: Drop the GTK_FRAME_EXTENTS requirement"
This reverts commit fb9a6bb6d8.

In a recent test, I've found that Xfce and Mate now support
this, so they will not be affected by this requirement. And
adding the check back will solve the 'client-side shadow'
problem in KDE.
2015-03-09 20:48:47 -04:00
Benjamin Otte 9ec2804775 stylecontext: Store the right style in the cache
Store the newly computed style, not the old and wrong one.

Fixes HighContrast menuitem color sometimes being black-on-black for
selected items.
2015-03-09 23:54:41 +01:00
Philip Withnall f8eac08a0a gtkclipboard: Fix a potential g_signal_handler_disconnect(NULL) call
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall af36220bca gtkprintcontext: Fix several potential g_object_[un]ref(NULL) calls
The page_setup of a GtkPrintContext or GtkPrintUnixDialog is nullable,
so all reference count changes to it have to be guarded against NULL
values.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 8e3b499699 gtktreeselection: Fix a potential use of uninitialised variables
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 968780d8da gtktreeselection: Fix potential NULL pointer dereferences
_gtk_rbtree_first() can potentially return NULL if the RB tree is empty,
which would result in NULL pointer dereferences in the GtkTreeSelection
code. Gracefully handle them.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 4fc6880d83 gtktextview: Fix a definite use of an uninitialised variable
This seems to have been a typo in the original code, and allowed access
to virtual_cursor_y when it was uninitialised.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 51971d56bc gtknotebook: Remove dead variable assignments
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall c7f5f10853 gtknotebook: Fix a potential NULL pointer dereference
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 61c46d911f gtkentry: Return early from gtk_entry_clear() if no icon info exists
This helps scan-build avoid some false positive potential NULL pointer
dereference warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 19222a6364 gtkentry: Remove dead assignments
Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 7479133753 gtkentry: Call get_*_size() vfuncs unconditionally
These vfuncs cannot be NULL: implementations are provided by GtkEntry,
and subclasses should not set them to NULL. Instead of conditionalising
the calls to the vfuncs, assert that they’re set and call them
unconditionally.

This prevents the possibility of a subclass setting the vfunc to NULL
and then a gtk_entry_get_*_size() call returning undefined values in its
out variables.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 0282714d86 gtkentry: Fix potential use of uninitialised variables
Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Philip Withnall 586240d2f8 gdkwindow: Fix potential NULL pointer dereference
gdk_window_ensure_native() can end up with a NULL parent pointer, which
it passes to find_native_parent_above()…but that expects a non-NULL
parent.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-09 13:41:37 +00:00
Andre Heinecke e99e282b5a Prevent empty password request popup for kerberos
If auth_info_required is only set to "negotiate" the
    request password dialog is shown anyway for each print
    job without any input fields. As the request_password
    dialog only handles username, password and domain.

    https://bugzilla.gnome.org/show_bug.cgi?id=669008
2015-03-09 14:19:57 +01:00
Bastian Ilsø 52f5a78c6d Update hello-world.c to GtkApplication, document 2015-03-09 12:17:31 +01:00
Matthias Clasen 01d76b7701 Print dialog: Fix printer icons in HighContrast
We need to make the cell renderer follow the state,
for recoloring to work.
2015-03-08 22:05:37 -04:00
Matthias Clasen 59d12be94f HighContrast: Some formatting fixes 2015-03-08 21:32:38 -04:00
Matthias Clasen 9b18deee1f Add a missing word in the docs 2015-03-08 18:16:11 -04:00
Aurimas Černius 7385784ded Updated Lithuanian translation 2015-03-08 20:22:54 +02:00
Emmanuele Bassi 6950116678 docs: Reword the deprecation notice for gtk_widget_override_*
They are a bit terse, and they should point to the preferred way of
overriding the theme, i.e. using a GtkStyleProvider for your
application, and custom style classes.
2015-03-08 14:39:18 +00:00
Emmanuele Bassi 247e62390b docs: Clarify replacement for gtk_style_context_get_background_color()
It seems odd that a getter function for the style context state is
replaced by a rendering call, but it makes sense in context.
2015-03-08 14:29:04 +00:00
Matthias Clasen ec567e5fad Add a test for builder-constructed file filters 2015-03-08 09:12:21 -04:00
Matthias Clasen 6b23c44056 GtkFileFilter: Set name from builder id
Suggested in https://bugzilla.gnome.org/show_bug.cgi?id=577862
as a way to make file filters constructed with GtkBuilder more
useful.
2015-03-08 09:12:21 -04:00
Baurzhan Muftakhidinov f6d0b9e9a9 Updated Kazakh translation 2015-03-08 11:17:09 +00:00
Frédéric Péters 70775e1985 docs: fix reference to GTK+ 2 index of deprecated symbols 2015-03-08 09:43:04 +01:00
Eric Le Bihan 8ecc51ad8a Fix undefined reference to get_xkb()
When configuring Gtk+ with --disable-xkb, the build fails because of an
undefined reference to get_xkb().

This patch fixes this issue.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>

https://bugzilla.gnome.org/show_bug.cgi?id=739070
2015-03-07 18:42:27 -05:00
Matthias Clasen 4938aa9c6b Modernize the xReply check
Using AC_CHECK_TYPE instead of AC_TRY_COMPILE avoids compiler
warnings from -Werror.

https://bugzilla.gnome.org/show_bug.cgi?id=535929
2015-03-07 18:25:57 -05:00
Matthias Clasen 1f3328c096 Avoid calling g_object_ref on NULL
gtk_widget_set_visual() allows NULL for the visual, so be
careful ot to ref it unconditionally.
2015-03-07 17:48:11 -05:00
Matthias Clasen 6e7ad732fc scrolled window: Fix size requisition with overlay scrolling
When the scrollbars are overlayed, the size requisition of the
scrolled window should not depend on whether the scrollbars are
visible or not. This was not quite the case, because we forgot
one case where scrollbar size was still added to the requisition.
2015-03-07 14:18:13 -05:00
Matthias Clasen cbf5b49cb8 Add an example for accelerators with manual image menuitems
This is somewhat tricky to work out, so put some example
code here for future reference. The tricky part is that
GtkAccelLabel tries to be smart about hiding the accel
if there's not enough space, so we have to make sure to
pack the label with expand=TRUE and set align=GTK_ALIGN_FILL,
or things won't work.
2015-03-06 20:36:11 -05:00
Chun-wei Fan b3725a455d test/gtkgears.c: Fix on C89 Compilers
Make sure that variables are declared at the top of the block.

Break up one of the sincos() calls into individual calls to sin() and cos()
so that we do not have to complicate the initialization of the following
GLfloat array.
2015-03-06 23:47:35 +08:00
Changwoo Ryu 9c545ac2e8 Updated Korean translation 2015-03-06 22:14:22 +09:00
Niels Nesse b87715973f gl: Warn the user if they request a GL context version less than 3.2
If the user requests a version less than 3.2 the version is forced to 3.2.
Previous checking code have an inconsistent behavior depending on which
minor version number was specified. This is avoided now by temporarily
converting the major/minor pair into a single integer.

https://bugzilla.gnome.org/show_bug.cgi?id=744288
2015-03-06 14:02:55 +01:00
Chun-wei Fan 064f4db012 Update config.h.win32.in for sincos()
There was an added check in configure.ac for sincos() for gtkgears.c, where
that function is actually a GCC- and glibc-specific extension, which is
not available on Windows.  Reflect on this in config.h.win32.in for the
Visual Studio/Windows builds.
2015-03-06 10:49:25 +08:00
Chun-wei Fan 45da8bf045 MSVC Builds: "Install" .pdb Files
"Install" the .pdb files that were generated along with the build, to make
it easier for people to develop and debug GTK+, especially when used as a
stack, and as the .pdb files are already generated with all builds.

Also make the copy of the .dll, .lib and .exe files more selective so that
we do not accidently copy files that are not meant to be "installed", or
end up making extra copies of plugin DLLs in the wrong places, when the
projects here are included as a part of a grand solution that is used to
build the entire GTK+ stack, for example.
2015-03-06 10:40:46 +08:00
Chun-wei Fan 91bc414360 MSVC 2010+ Builds: Fix .pdb Generation
For Visual Studio 2010 and later, the .pdb filename needs to be explicitly
specified so that it will match the filename of the target, if the project
name differs from the filename of the target.  Make sure that is the case
for the 3 DLLs that we build for Visual Studio 2010 and later.
2015-03-06 10:25:18 +08:00
Piotr Drąg e2190d7a01 Updated Polish translation 2015-03-05 23:48:19 +01:00
Matthias Clasen 7fbbf850c3 Improve some GtkStock deprecation notes
Point at edit-delete and edit-paste as available icons.
2015-03-05 16:07:30 -05:00
Dušan Kazik 1fb172011c Updated Slovak translation 2015-03-05 13:17:37 +00:00
Dušan Kazik 4691049f9e Updated Slovak translation 2015-03-05 12:14:18 +00:00
Carlos Garnacho 40c8d8bcf4 window: Add comment documenting the target widget checks during window drag
Was suggested during review of
https://bugzilla.gnome.org/show_bug.cgi?id=745562#c2
2015-03-05 11:52:24 +01:00
Claude Paroz 08b5de7836 Updated French translation 2015-03-05 08:49:50 +01:00
Matthias Clasen 6ac3ec0b53 HighContrast: Make sure selections are visible in infobars
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=745622
2015-03-04 21:56:02 -05:00
Matthias Clasen 2b7eaaf86e Adwaita: Make sure selections are visible in infobars
Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=745622
2015-03-04 21:55:11 -05:00
Carlos Garnacho 08494f86a0 widget: Improve hack to ignore drags from widgets using motion events
Postpone until the last moment whether the target widget still
potentially uses updates from this sequence, or window dragging
actually applies because all gestures on the target went to denied
state.

This fixes window dragging on empty space in a headerbar that is
contained in a paned (as in e.g. gedit).

https://bugzilla.gnome.org/show_bug.cgi?id=745562
2015-03-04 21:20:29 -05:00
Matthias Clasen 768e6a4579 Ensure print-related types are registered
These types are not covered by g_test_register_all_types,
and having the types registered when a print dialog is used
helps in cases where GTK+ is dlopened.

https://bugzilla.gnome.org/show_bug.cgi?id=745065
2015-03-04 20:37:01 -05:00
Georges Basile Stavracas Neto ce9a5a3fec places sidebar: compare bookmarks by index
GtkPlacesSidebar applies a sorting function on
the tree model that does not consider the case
of bookmarks, which are sorted by their indexes.

By adding the bookmarks corner case and comparing
then by their indexes, GtkPlacesSidebar can sort
the bookmarks properly in the order they're saved.

https://bugzilla.gnome.org/show_bug.cgi?id=744589
2015-03-04 17:20:40 -03:00
Matthias Clasen 17bc7aaefd Check for existence of sincos
It apparently doesn't exist everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=745578
2015-03-04 06:30:13 -05:00
Matthias Clasen 71bd1c7e2c file chooser: Really stop typeahead search popups
GtkTreeView is a bad widget and constantly resets the search-column
behind our back. We need to re-unset it every time a model is set :-(
2015-03-03 18:03:26 -05:00
Fran Dieguez b92573e42e Updated Galician translations 2015-03-03 23:44:15 +01:00
Matthias Clasen 76c66ef2ed make-pot: Document variables
Damn-lies will have to use one of these to override the name
of the generated file. Lets document them all, while I still
remember this.
2015-03-03 15:01:15 -05:00
Carlos Garnacho 5751d4f66e filechooser: Only do search_start_query() while we are in search mode
This signal can be emitted by GtkSearchEntry after search has been
cancelled, and other operation mode is set. It doesn't make sense to
populate the search model in that state anymore, so just avoid doing it.

https://bugzilla.gnome.org/show_bug.cgi?id=745479
2015-03-03 17:57:08 +01:00
Carlos Garnacho b2f3b67494 searchenginetracker: Keep a reference on the search engine while querying
The object might be destroyed when mid operation, causing crashes as the
query callback still expects the object pointer to be valid. Also, remove
the gdk_threads_enter/leave pairs, the callback will be executed on the
caller (UI) thread, so this is not necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=745479
2015-03-03 17:57:08 +01:00
Carlos Garnacho a994f4edfb filechooser: Disconnect signal handlers from search engine before destroying
The search engine might stay alive longer due to extra temporary refs, so
the signal handlers should be removed for the filechooser to ignore these
properly.

https://bugzilla.gnome.org/show_bug.cgi?id=745479
2015-03-03 17:57:08 +01:00
Matthias Clasen 79321c0d8a Make a pot generating command available
Translators don't want to run autogen before generating pot,
so give them a script.
2015-03-03 07:22:41 -05:00
Chun-wei Fan 48c93fb347 MSVC 2008 Builds: Speed Up Release Builds
Use the /MP compiler option, where the build time for release builds can
be cut down by quite a bit.  This will however cause a brief warning with
debug builds due to the use of /Gm, but the code will otherwise build
normally.  Unlike the Visual Studio 2010+ builds, we can't use /d2Zi+ as
Visual Studio 2008 does not support that, so we can't get a better
debugging experience for release builds here.
2015-03-03 18:40:32 +08:00
Chun-wei Fan 163f7e75bf Fix "MSVC Builds: Update icon-browser Projects"
The Visual Studio 2008 Project was not updated correctly, so fix that.
2015-03-03 18:37:26 +08:00
Stefan Sauer bb78a39103 tooltip: remove unused variable and related g_object_set
We never use the value of has_tooltip. This is a left-over from the refactoring
of gtk_tooltip_run_requery().
2015-03-03 09:59:53 +01:00
Chun-wei Fan 05ef31362d MSVC Builds: Update icon-browser Projects
There is a new source file that needs to be built, so fix the projects...
2015-03-03 14:08:51 +08:00
Chun-wei Fan a4f69408ac MSVC Builds: Improve Build Speed and Debugging
Use Multiprocessor compilation which can cut down build times by quite a
bit and use the /d2Zi+ flag to have better debugging info being logged to
the .pdb for release builds.

These are only applicable for Visual Studio 2010/2012 and later.
2015-03-03 14:07:26 +08:00
Chun-wei Fan e31a936e3e gtkswitch.c: Fix Build on C89 Compilers
This file now uses round(), which was not available until C99, so include
fallback-c89.c instead of math.h, which includes math.h and does a fallback
implementation of round().
2015-03-03 12:14:24 +08:00
Matthias Clasen 32c0c6fee0 3.15.10 2015-03-02 20:58:01 -05:00
Matthias Clasen 238cdd5e37 Avoid stray output from configure
The new xgettext check was leaving a messages.po file behind.
2015-03-02 20:58:01 -05:00
Matthias Clasen 3569d373a2 Fix 7c4bf742e8
The objects-finalize test constructs gestures with NULL as
a widget. The recent addition of weak references was not
ready for that.
2015-03-02 20:18:15 -05:00
Emmanuele Bassi 0019eb7bf9 gears: Update to slightly more modern OpenGL
Instead of using glxgears, which still uses OpenGL 2.1 and the fixed
pipeline, we use a slightly modified es2gears, OpenGL 3.2, and the
programmable pipeline.
2015-03-03 00:06:35 +00:00
Matthias Clasen 209c5c37f3 file chooser: Avoid animated scrolling for editing
Avoid scrolling animation when scrolling to where we want
to insert the new folder, since adding the entry doesn't
do the right thing if the treeview is still scrolling.

An alternative would be to wait for the animated scrolling
to reach its target before starting the editing, but this
is easier.

https://bugzilla.gnome.org/show_bug.cgi?id=729366
2015-03-02 16:25:30 -05:00
Matthias Clasen 18de5e6547 file chooser: Avoid triggering assertions
cairo surfaces are boxed types, so don't try to set them
with g_value_set_object().
2015-03-02 16:25:30 -05:00
Matthias Clasen d2fe45ab57 file chooser: Avoid warnings from the location column
Avoid criticals that would come out of this code if file is / or NULL.
2015-03-02 16:25:30 -05:00
Claude Paroz 65b55938ca Updated French translation 2015-03-02 18:32:07 +00:00
Carlos Garnacho 4cae9bdd05 x11: Store last axes from device
And use these for the missing axes if the valuator mask is incomplete.
This used to work fine on tablets because the Wacom driver ensures all
valuators are sent, which is not true if using the evdev driver.

https://bugzilla.gnome.org/show_bug.cgi?id=703610
2015-03-02 18:57:04 +01:00
Carlos Garnacho 3ccfcf5b9f scrolledwindow: Cancel kinetic/overshoot animation on captured scroll events
This ensures the animation is cancelled if the child widget happens to
GDK_EVENT_STOP scroll events.

https://bugzilla.gnome.org/show_bug.cgi?id=745315
2015-03-02 17:42:04 +01:00
Matthias Clasen da679f3866 Updates 2015-03-02 11:11:24 -05:00
Carlos Garnacho 1feaa6f301 scrolledwindow: Add motion mask to the widget window
This is not specified specifically by the attached controllers, so let
the scrolledwindow set the mask, as motion events with no buttons pressed
are interesting to it.

https://bugzilla.gnome.org/show_bug.cgi?id=745344
2015-03-02 15:49:40 +01:00
Yosef Or Boczko 22c83e5ea7 Updated Hebrew translation 2015-03-02 15:39:40 +02:00
Carlos Garnacho eaebc2cb4b wayland: Delay wl_subsurface interface creation until the window is shown
It isn't really necessary anytime before, so just make sure it's there only
when the window is visible.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Carlos Garnacho d070e4c742 gtkwindow: Do not show subsurface windows for hidden popover widgets
This is really just necessary when we have a visible widget, otherwise
the window would temporarily linger with odd size and surface.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Carlos Garnacho c55fcd35fe wayland: Thaw the clock if we hide a GdkWindow mid-frame
When a window is hidden, its surface and all its roles are destroyed,
if this happens when we already issued a wl_surface_commit and are
awaiting for a frame callback, the clock will remain frozen for the
next time the window is shown.

To avoid this, keep track of the wl_surface_frame() calls issued,
and ensure the clock is thawed after hiding. If we happen to receive
the frame callback, it is just ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=743427
2015-03-02 12:11:59 +01:00
Carlos Garnacho 13e22e2030 gtkwindow: Move window dragging to a standalone drag gesture
The gesture is hooked to the capture phase, so it works for buttons in
header bars and whatnot. In order to be friendly to the widget it is
capturing events from, an ugly hack is in place to avoid capturing
events when the target widget has a gesture that would consume motion
events.
2015-03-02 12:03:39 +01:00
Carlos Garnacho 0796d7b6ff gtkmenubutton: Popup menu/popover on GtkButton:clicked
This happens on button release, which is more convenient if the gesture
can be consumed by something else (eg. window dragging), and already behaves
correctly wrt cancelled gestures, broken grabs, etc.

This also allows us to unify pointer and keyboard behavior, popping up the
menu widget in a single place.
2015-03-02 12:01:07 +01:00
Carlos Garnacho 2e52e9964b gesture: On cancel, remove touchpoint before checking the recognized state
Otherwise the touch being removed doesn't account in recognition.
2015-03-02 12:01:07 +01:00
Carlos Garnacho a4e0de1839 button: Ensure the button is "left" when a gesture is cancelled
This prevents from stale widget states if the gesture happens to be
cancelled mid-press.
2015-03-02 12:01:07 +01:00
Debarshi Ray 0910eaf6fe eventcontroller: Chain up on constructed
https://bugzilla.gnome.org/show_bug.cgi?id=745225
2015-03-02 11:53:56 +01:00
Debarshi Ray 7c4bf742e8 eventcontroller, widget: Don't crash if destroyed before the other
There are two scenarios. A widget sub-class owns a GtkEventController
and passes itself to it, or a controller owned by something else is
passed a widget.

In the second case, if the widget is destroyed before the controller,
we will have a crash when destructing the controller because we will
be accessing invalid memory. Adding a weak reference on the widget
addresses that problem.

This leads to a crash in the first case. When the widget is getting
destroyed, it will drop the reference to its own controller. The
controller will skip touching the widget because the weak reference
would have turned it to NULL. However, when the widget sub-class chains
up to GtkWidget it will try to free all the controllers in its list.
Unfortunately, all these controllers have already been destroyed. So
we need to guard against this too.

https://bugzilla.gnome.org/show_bug.cgi?id=745225
2015-03-02 11:53:52 +01:00
Murray Cumming 66d25c4a06 gtk_label_set_yalign(): Fix xalign/yalign typo in parameter name. 2015-03-02 10:58:53 +01:00
Marek Kasik c2aff4ab6e printing: Set printer state correctly
Consider NULL printer state message as empty too.
Printer state IPP_PRINTER_STOPPED can be considered as paused state.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-03-02 10:51:07 +01:00
Murray Cumming bc77408e3c gtk_misc_set_alignment(): Improve the deprecation documenation.
To link to GtkWidget.halign/valign and to mention
GtkLabel.xalign/yalign.
2015-03-02 09:46:49 +01:00
Ryan Lortie c91076f64c gdkglcontext-win32: fix variable names in GDK_NOTE
These probably weren't caught because GDK_NOTE was disabled when the
change was tested.

https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Ryan Lortie 4f0ab5656b gdkglcontext-win32: remove unused variables
https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Marek Černocký 9ba4bed117 Updated Czech translation 2015-03-01 18:54:56 +01:00
Carlos Garnacho fc838cefbf searchenginetracker: Unify fts/non-fts query
This makes sure we use location_uri for both types of query, and the fts
query has been made more similar to the one used by nautilus.
2015-02-28 21:19:47 -05:00
Matthias Clasen d87041bfe3 tracker: Turn on fts
We want to match what nautilus does, and the non-fts query
ignores the location, which yields somewhat broken UI in
the file chooser.
2015-02-28 16:44:21 -05:00
Matthias Clasen 8a0d02c548 Formatting fixes 2015-02-28 16:44:21 -05:00
Matthias Clasen f126157bfa file chooser: Don't start search too eagerly
We were trying to start search when the user types anything,
but this is annoying more often than helpful, and interferes
with the location entry. So, stick with explicitly enabled
search (via the search button or Alt-S) for now.
2015-02-28 16:44:21 -05:00
Dušan Kazik 6ed479e71c Updated Slovak translation 2015-02-28 20:21:13 +00:00
Peter Bloomfield 5611cf2096 Do not return NULL AtkStateSet
https://bugzilla.gnome.org/show_bug.cgi?id=741511
2015-02-28 13:52:22 -05:00
Friedel Wolff 2a3f1a49de Updated translation for Afrikaans (af) 2015-02-28 19:32:23 +02:00
Trần Ngọc Quân a764e343c7 Updated Vietnamese translation
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
2015-02-28 14:23:14 +07:00
Matthias Clasen af86bc58b9 wayland: Add debug spew 2015-02-28 00:58:05 -05:00
Matthias Clasen 94c5d691df wayland: Formatting fixes 2015-02-28 00:02:30 -05:00
Matthias Clasen a0eb0e2346 wayland: Apply maximized and fullscreen state
We were just throwing the request away if the app asks to
fullscreen or maximize a window before it has been mapped.
This is something the GdkWindow API explicitly supports,
so make it work by saving the state until the surface exists.

This fixes things under weston. There are bugs in mutter
that keep this from working correctly with gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=745303
2015-02-27 19:09:03 -05:00
Matthias Clasen 3d205a2037 wayland: Drop some pointless lines
No need for these parameter checks, really.
2015-02-27 19:09:03 -05:00
Aurimas Černius 3b10269a12 Updated Lithuanian translation 2015-02-28 00:02:57 +02:00
Matthias Clasen 6ccef21d49 Fix a typo
Follow-up fix for commit 7cee6c5cc6.
2015-02-27 17:00:08 -05:00
Olivier Fourdan 53028ff3bb wayland: Don't use g_error() on connection lost
When the Wayland compositor vanishes, all applications connected will
receive a SIGPIPE as soon as they try to use wl_display_dispatch().

Do not use g_error() to terminate the applications when this occurs,
g_error() means an error in the application while here it's not truly
the case.

Use g_warning() and exit() instead.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=745289
2015-02-27 16:26:39 -05:00
Balázs Úr ff85f6ce3f Updated Hungarian translation 2015-02-27 21:18:14 +00:00
Balázs Úr 0507a4d39a Updated Hungarian translation 2015-02-27 21:13:55 +00:00
Emmanuele Bassi 7cee6c5cc6 gdk: Use a better error message
Having "Assertion failed: success" on the console is not going to help
anyone.
2015-02-27 21:02:16 +00:00
Piotr Drąg ab3084b714 Updated POTFILES.in and POTFILES.skip 2015-02-27 19:46:55 +01:00
Piotr Drąg 00f4c070f4 Updated Polish translation 2015-02-27 19:37:40 +01:00
Yosef Or Boczko 668df30b60 Updated Hebrew translation 2015-02-27 16:47:30 +02:00
Rafal Luzynski 3ce3593ebf GtkListBoxRow: add g_return_if_fail to grab_focus, don't crash
Although gtk_list_box_row_grab_focus() is not a public function
it can be easily called by gtk_widget_grab_focus() with a row argument
which has been removed from the list box and has box == NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=744879
2015-02-27 06:31:06 -05:00
Efstathios Iosifidis 45210d5835 Updated Greek translation 2015-02-27 11:20:42 +00:00
Matthias Clasen f96f69996a file chooser dialog: Prevent uneven button heights
The height of the text buttons depends on the font height,
whereas the search button has a fixed-size icon in it...
Prevent unevent heights by putting them all in a size group.

https://bugzilla.gnome.org/show_bug.cgi?id=745263
2015-02-26 21:17:06 -05:00
Matthias Clasen 6855e1eec3 app chooser dialog: Prevent uneven button heights
The height of the text buttons depends on the font height,
whereas the search button has a fixed-size icon in it...
Prevent unevent heights by putting them all in a size group.
2015-02-26 21:16:58 -05:00
Matthias Clasen c951740cf9 Add a configure check for new enough gettext
Check that xgettext understands glade files.
2015-02-26 19:00:24 -05:00
Matthias Clasen 5840c931b3 Stop building extract-strings
It is no longer needed.
2015-02-26 16:54:16 -05:00
Matthias Clasen b08015371b Stop using extract-headers
Since 0.18.3, xgettext can extract strings from ui files.
2015-02-26 16:54:16 -05:00
Dušan Kazik b3a5d86d5d Updated Slovak translation 2015-02-26 11:59:18 +00:00
Efstathios Iosifidis b618256a4c Updated Greek translation 2015-02-26 11:23:48 +00:00
Baurzhan Muftakhidinov 6a0290145d Updated Kazakh translation 2015-02-26 07:11:37 +00:00
Marek Kasik f74067dda2 printing: Always get details of Avahi printers via IPP
Request details of Avahi browsed printers even when
we've got their PPDs already. Some options are not
present in PPD.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-02-25 15:58:23 +01:00
Marek Kasik 979a4c1b08 printing: Get covers for each printer individually
Since we combine Avahi browsed printers and
printers of local CUPS in one backend we need to
get covers for each printer separately.

https://bugzilla.gnome.org/show_bug.cgi?id=743323
2015-02-25 15:58:19 +01:00
Daniel Mustieles 7fa9089196 Updated Spanish translation 2015-02-25 12:34:02 +01:00
Matthias Clasen ff0aabe576 3.15.9 2015-02-24 20:38:33 -05:00
Jonas Ådahl f13157f4bb wayland: Don't allocate a full size SHM buffer when drawing using OpenGL
Before this patch, we'd always allocate a full size SHM buffer via
the wl_shm_pool, even though it would never be used. Instead allocate a
logical 1x1 cairo image surface.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:03 -05:00
Jonas Ådahl aa81262f11 wayland: Scale up wl_egl_window according to window scale
In order to support window scales for EGL windows, resize the
wl_egl_window to the window dimension multiplied with the window scale,
just as with SHM window buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:03 -05:00
Jonas Ådahl 56c9eac16e wayland: Properly support changing of surface scale
When the preferred surface scale changes, for example when entering a
wl_output with a higher scale than any previous entered output, recreate
the shm surface and redraw the window content with the new window scale.

Before this patch, the internal scale would be changed, but the shm
surface would not be recreated given the new scale, i.e. we'd attach a
buffer for a different scale than wl_surface.set_scale specified.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:02 -05:00
Jonas Ådahl a70b478a5c wayland: Don't ever try to set surface buffer scale when not supported
If the compositor is too old for handling surface buffer scales, never
tyr to set change it. This will effectively always leave it to its
initial state, i.e. 1.

https://bugzilla.gnome.org/show_bug.cgi?id=745076
2015-02-24 20:22:02 -05:00
Benjamin Otte 40f2af665d gdkcairo: Bail if surface is in error
Don't try to paint onto an error surface. This happens for example when
gdk_cairo_set_source_pixbuf() is called with a pixbuf that is too big
for Cairo to handle.

Spotted by Christian Boxdörfer
2015-02-25 01:55:28 +01:00
Benjamin Otte 0ab48fcc42 css: Fix _gtk_bitmask_subtract()
We were doing the wrong thing *and* writing uninitialized memory while
doing so. BAD.

Also added tests exposing these.

https://bugzilla.redhat.com/show_bug.cgi?id=1185585
2015-02-25 01:55:28 +01:00
Fran Dieguez 9e50fe0aeb Updated Galician translations 2015-02-24 22:43:36 +01:00
Piotr Drąg e86cad1006 Updated POTFILES.in 2015-02-24 22:09:30 +01:00
Daniel Mustieles 1b578ef33a Updated Spanish translation 2015-02-24 19:21:02 +01:00
Matej Urbančič 02774f9fd5 Updated Slovenian translation 2015-02-24 19:18:22 +01:00
Matej Urbančič d582e71ba8 Updated Slovenian translation 2015-02-24 19:04:49 +01:00
Yosef Or Boczko f986730c14 Updated Hebrew properties translation 2015-02-24 19:31:13 +02:00
Carlos Garnacho 0c903156ef scrolledwindow: Only start fade animation on "visible" scrollbars
If a scrollbar is not shown (because of policies, or because it isn't
necessary), it doesn't make sense to start fade animations on its window
on captured motion events.
2015-02-24 14:55:23 +01:00
Yosef Or Boczko b06908ad52 Updated Hebrew translation 2015-02-24 15:05:00 +02:00
Matthias Clasen 913e10fe3b Fix the previous commit
The C_() macro only takes string literals.
Use g_dpgettext2() instead
2015-02-23 22:25:11 -05:00
Matthias Clasen b0b38c106d Make gtk-im-context-none work
This was added a few years ago, as a way to have _no_ im context
at all. But it didn't actually work. Make it work, and streamline
the handling of none by moving it all to gtkimmodule.c.

As part of this, add context to the translated names of all
im modules we ship.
2015-02-23 22:06:02 -05:00
Daniel Drake aba2de3443 icontheme: allow directories with mtime 0
In order to provide a constant mtime between OS build and deploy time,
while also maintaining a hardlink content-addressed model independent of
timestamps, ostree sets all mtimes to 0.

The icon cache code currently ignores directories with mtime 0, assuming
they don't exist.

Track directory existence in a more precise way.

https://bugzilla.gnome.org/show_bug.cgi?id=745052
2015-02-23 15:09:15 -06:00
Bastian Ilsø 761c781168 getting-started: move Drawing section to bottom. 2015-02-23 21:42:56 +01:00
Daniel Mustieles b85fc8045c Updated Spanish translation 2015-02-23 19:15:08 +01:00
Cosimo Cecchi eddaf01676 icontheme: use desired size instead of negative for DIR_UNTHEMED SVGs
When loading SVGs from ICON_THEME_DIR_UNTHEMED GtkIconInfos,
such as those created for a GLoadableIcon, the size of the pixbuf to
load is set as a product of icon_info->scale.
But a few lines above, icon_info->scale is set to -1 for
ICON_THEME_DIR_UNTHEMED GtkIconInfos, so we'll end up always passing a
negative size to the GdkPixbuf loader, which is interpreted as the
nominal size of the image file.
Instead load the SVG at the desired scaled size in that case.

This fixes blurry icon in the notification panel in gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=744991
2015-02-23 09:56:06 -08:00
Cosimo Cecchi acd72ffabe icontheme: fill correct information when loading GResource-backed GIcons
When loading a GResource-backed GFileIcon into a GtkIconInfo we
currently fail to populate the is_resource private field.
Also, since is_svg is set by looking at the filename, and
g_file_get_path() returns NULL for a GResourceFile, is_svg was always
FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=744991
2015-02-23 09:56:06 -08:00
Piotr Drąg e7a2fc2d01 Updated POTFILES.in 2015-02-23 17:41:30 +01:00
Bastian Ilsø ec07987a90 Getting-started: port drawing.c to GtkApplication 2015-02-23 16:00:36 +01:00
Matthias Clasen c73ab94d3f range: Make steppers use smooth autoscrolling
This makes them work much nicer than the old timer-based
implementation.
2015-02-23 08:38:38 -05:00
Matthias Clasen 3222de2f91 range: Make zoom scrolling less sensitive
Use the new long press delay factor to make the zoom
scrolling less easy to trigger accidentally.
2015-02-23 08:38:25 -05:00
Matthias Clasen 2b6376248d long press: Add a delay-factor property
Add a way to set a delay factor that can be used
to make the long press more or less sensitive.
Making this a factor instead of exposing the delay
itself preserves the value of the setting as an
overall 'slow down long press' setting.
2015-02-23 08:37:26 -05:00
Matthias Clasen c060d93e3d zoom scrolling: Improve the previous fix
As Sebastian pointed out, just resetting the initial slider
position was an incomplete fix, because it does not cause the
delta to be recomputed, which is important in this scenario,
because you've likely travelled some distance over the slider
before the long press kicks in.
Instead, explicitly record both the slider position and the
delta.
2015-02-23 07:28:40 -05:00
Matthias Clasen 8726c6d5d2 zoom scrolling: avoid 'jumping back'
We record the starting position on button press, but only
start the zoom mode when the long press timeout kicks in.
Depending on circumstances, this can cause a noticable jump.

Avoid this by resetting the recorded starting position after
the long press timeout. Suggested by Sebastian Keller.
2015-02-23 06:46:21 -05:00
Chao-Hsiung Liao 1402e22862 Updated Chinese (Taiwan) translation 2015-02-23 07:32:08 +00:00
Chao-Hsiung Liao 5a0ad907b4 Updated Chinese (Taiwan) translation 2015-02-23 07:30:34 +00:00
Matthias Clasen 25308477e7 Silence a compiler warning 2015-02-22 17:01:52 -05:00
Balázs Úr 44d3b71678 Updated Hungarian translation 2015-02-22 21:19:26 +00:00
Matthias Clasen 1ffcdfcc32 icon browser: Set up dnd from the detail popup
Allow dragging the various icon sizes as images.
2015-02-22 14:44:10 -05:00
Matthias Clasen ae63b21c61 icon browser: Add some dnd support
Use a custom tree model and enable dragging from the icon view.
Currently, we just support dropping the icon name as text.
2015-02-22 14:44:10 -05:00
Matthias Clasen 967ba60303 icon browser: Activate on single-click
We want to get away from double-clicks everywhere.
2015-02-22 14:44:10 -05:00
Matthias Clasen ee857cd261 icon browser: stop selecting
We don't need the selection here.
2015-02-22 14:44:09 -05:00
Thibault Saunier fb581a1084 gdk/quartz: Fix mixup in attributes usage creating window implementation
First, attributes can be NULL (which is always the case when calling
gdk_window_ensure_native) so do not unconditionally dereference it.

Then the window_type should be taken directly from the GdkWindow as
in other backends (such as the X11 one for example).

https://bugzilla.gnome.org/show_bug.cgi?id=744942
2015-02-22 15:50:39 +01:00
Dušan Kazik 77c982ed3f Updated Slovak translation 2015-02-21 16:13:03 +00:00
Ignacio Casal Quinteiro 486b56e179 statusicon: missed setting one uID 2015-02-21 16:00:31 +01:00
Arnav Singh f07677c105 statusicon: fix crash storing pointer in UINT
https://bugzilla.gnome.org/show_bug.cgi?id=696505
2015-02-21 15:49:15 +01:00
Chao-Hsiung Liao 851d784f6d Updated Chinese (Taiwan) translation 2015-02-21 11:06:35 +00:00
Chao-Hsiung Liao 178d9bd84c Updated Chinese (Taiwan) translation 2015-02-21 11:06:14 +00:00
Efstathios Iosifidis 09daf9b916 Updated Greek translation 2015-02-20 21:18:20 +00:00
Matthias Clasen 415ab252f4 3.15.8 2015-02-20 09:14:41 -05:00
Carlos Garnacho fa48b42ef1 menubutton: Fix possible button/popover state inconsistences
While a popover is hiding, the modal grab is already gone and the toggle
button is clickable again, but clicking again at that time will result in
gtk_widget_show() trying to show an already shown widget (although fading
out and hidden soon) and the toggle button activated.

So let the menubutton set the active status only if the menu/popover
widget wasn't already shown, and ensure this doesn't get triggered by
double/triple button press events.
2015-02-20 14:44:17 +01:00
Carlos Garnacho 85ad434290 inspector: Destroy popovers on unmap
As an implementation detail, the popover hooks the fade out animation
on ::hide. Destroying the popover right away here is not a problem, but
prevents the animation from actually running. ::unmap will be run after
the animation is finished, so destroy the popover there.
2015-02-20 14:44:17 +01:00
Carlos Garnacho cff1694c99 popover: Add show/hide transitions
These have the same visual effect and timing than the gnome-shell ones.
During the hide animation, the popover has been made to take focus
elsewhere, and refuse to take any pointer/keyboard input until the popover
is shown again.

This has been based on work from Timm Bäder.

https://bugzilla.gnome.org/show_bug.cgi?id=741405
2015-02-20 14:44:17 +01:00
Matthias Clasen 3a671994d4 scrolled window: Avoid a crash
gtk_scrolled_window_allocate_scrollbar was calling
gtk_scrolled_window_allocate_child just to get the relative
allocation, overlooking the fact that that function is only
safe to call if the scrolled window _has_ a child. Unfortunately,
gtk_scrolled_window_allocate_scrollbar will sometimes get called
when that is not the case. Since we are really only interested
in the relative allocation, just get that directly. This
fixes a segfault in the style-properties-nth-child reftest.
2015-02-20 08:28:58 -05:00
Matthias Clasen 4fc98ae345 scrolled window: Drop dead code
The allocation is never used in this function, so don't bother
getting it.
2015-02-20 08:28:58 -05:00
Marek Kasik 00f9f1cc6b printing: Use correct units for margins taken via IPP
cups_printer_get_hard_margins() returned margins in millimeters
for margins taken via IPP request instead of Units used before.
2015-02-20 12:27:12 +01:00
Carlos Garnacho cc780116a2 dnd: Set the parent DnD wayland surface on gtk_drag_set_icon_window()
This is a better place to call this, both lets us remove all other calls,
and additionally handles the gtk_drag_set_icon_widget() entry point.
2015-02-19 20:54:25 +01:00
Ignacio Casal Quinteiro 4a7da1e143 Do not return on void functions 2015-02-19 14:46:32 +01:00
Ignacio Casal Quinteiro b8005f4de9 pathbar: use the same parameter as in the declaration 2015-02-19 14:46:32 +01:00
Philip Withnall 8b4863f0c4 docs: Add extra symbol links to input handling documentation
Cross-reference to the API documentation more consistently.

https://bugzilla.gnome.org/show_bug.cgi?id=744054
2015-02-19 12:48:42 +00:00
Philip Withnall 09bb109f01 docs: Expand input handling documentation to cover event masks
Also try and clarify a few things about event propagation. Move
input-handling.xml into gtk-doc’s expand_content_files variable so it
automatically links to widget documentation. Add links from
gtk_widget_add_events() and friends to the new documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=744054
2015-02-19 12:48:42 +00:00
Philip Withnall 668d5d8665 docs: Mention events in the input handling documentation title
Make it a little easier to find these docs when searching for ‘event’.

https://bugzilla.gnome.org/show_bug.cgi?id=744054
2015-02-19 12:48:42 +00:00
Philip Withnall b397dd04c4 gtk: Remove documentation references to the GTK_NO_WINDOW flag
It has been removed entirely, and replaced by
gtk_widget_get_has_window().

https://bugzilla.gnome.org/show_bug.cgi?id=744054
2015-02-19 12:48:41 +00:00
Fran Dieguez 5091ae5e04 Updated Galician translations 2015-02-19 09:56:49 +01:00
Matthias Clasen c85e32d56e color scale: simplify code a bit
It is not necessary to call gtk_widget_get_accessible repeatedly.
2015-02-18 17:28:08 -05:00
Matthias Clasen 50c848a992 Explicitly set the a11y role of tooltip windows
This seems better than trying to identify the 'tooltipness'
of the window on the other side.

https://bugzilla.gnome.org/show_bug.cgi?id=744683
2015-02-18 17:28:08 -05:00
Matthias Clasen 7624418ddf Drop nonworking code to set a11y roles of tooltips
This code relied on widget names, and we don't set those anymore.
2015-02-18 17:28:07 -05:00
Matthias Clasen e1100813e6 widget factory: Don't make file chooser local-only
There's no reason to.
2015-02-18 17:28:07 -05:00
Balázs Úr 11960fa916 Updated Hungarian translation 2015-02-18 22:20:45 +00:00
Ting-Wei Lan 359fc25aad build: Don't use shopt in the build command
shopt command only works in bash, so we should not use it in gtk/Makefile.am.

https://bugzilla.gnome.org/show_bug.cgi?id=743647
2015-02-19 01:27:44 +08:00
Philip Withnall 3d88899072 gtk: Fix various tiny typos in documentation comments
e.g. Invalid syntax in introspection annotations, typos in object names,
accidentally using a gtk-doc comment for an internal function.
2015-02-18 11:38:37 +00:00
Philip Withnall e160befdf8 docs: Remove non-existent symbols from gtk3-sections.txt
Eliminate a couple of gtk-doc warnings.
2015-02-18 11:38:37 +00:00
Philip Withnall 8c32f403fb docs: Ignore generated files when building documentation 2015-02-18 11:38:37 +00:00
Rico Tzschichholz a0a1ea10a8 AppChooserDialog: Fix memleak 2015-02-18 11:38:29 +01:00
Daniel Mustieles 7233281d05 Updated Spanish translation 2015-02-18 10:55:57 +01:00
Milo Casagrande eb995ce453 Updated Italian translation 2015-02-18 08:14:48 +00:00
Carlos Garnacho e43ec48e83 wayland: Use display from GdkDragContext device
It will be useless to check the source window on the destination side,
it's at the moment always NULL. Fetch the display from the device instead,
which will be set for every GdkDragContext.
2015-02-17 19:50:05 +01:00
Daniel Mustieles 4162fccaa2 Updated Spanish translation 2015-02-17 18:36:57 +01:00
Daniel Mustieles bf22ac8337 Updated Spanish translation 2015-02-17 18:36:41 +01:00
Carlos Garnacho 5a907cc094 scrolledwindow: Ensure indicator windows are created at the right place
At the time of creating the indicator window, the scrollbar allocation is
poked and reused as the initial window dimensions. This usually happens
on two circumstances, either initially (so a ::size-allocate is emitted,
relocating the windows in the right places), or post-initialization when
calling set_overlay_scrolling() (so the scrollbars already have a valid
size allocation)

However, if the scrolledwindow is unrealized, and later re-realized again,
the scrollbars will already have a valid allocation, although 0,0 based
due to being contained in the previous indicator window. This comes out
wrong then, and the indicator window is given 0,0 based coordinates too.

Fix this by refactoring the scrollbar allocation code out of size_allocate,
and also use that given size at the time of creating the indicator windows,
this will provide the right widget-relative allocation anytime.
2015-02-17 16:32:36 +01:00
Carlos Garnacho c473afbdc9 scrolledwindow: Fully reset indicators' state on unrealize
This avoids timers to run after realize(), and inconsistent initial states
if the scrolledwindow is just realized again.
2015-02-17 16:32:36 +01:00
Matthias Clasen b3043e429b Avoid a crash in the inspector under wayland
The Wayland-specific popover code in GtkWindow was not doing the
right thing with the separate display connection we use for the
inspector.
2015-02-17 09:37:18 -05:00
Paolo Borelli f4510c93b7 Do not use "return" when chaining up to a void function 2015-02-17 14:54:51 +01:00
Milo Casagrande 0cf63ec892 Updated Italian translation 2015-02-17 13:43:52 +00:00
Emmanuele Bassi 0a4879b9ac glarea: Better error handling
Currently, GtkGLArea will leak GError instances set during the context
creation, if an error is set.

If any error is set post-context creation, it should be displayed even
in the case a GL context exists; for instance, we can use the error
display facility for shader compilation errors.
2015-02-17 10:21:41 +00:00
Benjamin Otte da559c08f9 switch: Have a priv varibale in the constructor 2015-02-16 23:57:04 +01:00
Benjamin Otte e1081bc471 switch: Change handle_x to handle_pos
Make that variable go from 0.0 to 1.0 where 0.0 means inactive (slider
is on the left) and 1.0 means active (slider is on the right).

The math is simpler that way and most importantly the value is
independent of size.
2015-02-16 23:57:04 +01:00
Benjamin Otte 86a41b108e switch: Get rid of offset member variable
We can compute it on-demand whereever we need it.
2015-02-16 23:57:04 +01:00
Benjamin Otte 1b171e812e switch: Remove unused variables from private struct 2015-02-16 23:57:03 +01:00
Benjamin Otte 295b8aab0c css: Implement animations for font-weight property 2015-02-16 23:57:03 +01:00
Benjamin Otte 0c4a42e629 css: Implement "bolder" and "lighter" font weights 2015-02-16 23:57:03 +01:00
Yosef Or Boczko a414faa997 Updated Hebrew Property translation 2015-02-16 22:22:57 +02:00
Yosef Or Boczko 36fcd7327c Updated Hebrew translation 2015-02-16 22:21:51 +02:00
A S Alam 1500626d44 update Punjabi Translation 2015-02-16 14:15:28 -06:00
Matej Urbančič 978c364847 Updated Slovenian translation 2015-02-16 20:54:10 +01:00
Matej Urbančič 26cc941a9e Updated Slovenian translation 2015-02-16 20:41:39 +01:00
Kjartan Maraas 0550ba4208 Updated Norwegian bokmål translation. 2015-02-16 18:33:56 +01:00
324 changed files with 88953 additions and 74384 deletions
+3 -2
View File
@@ -1,7 +1,7 @@
## Makefile.am for GTK+
include $(top_srcdir)/Makefile.decl
SRC_SUBDIRS = util gdk gtk libgail-util modules demos tests testsuite examples
SRC_SUBDIRS = gdk gtk libgail-util modules demos tests testsuite examples
SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
@@ -21,7 +21,8 @@ EXTRA_DIST += \
gtk-zip.sh.in \
sanitize-la.sh \
po/README.translators \
po/po2tbl.sed.in
po/po2tbl.sed.in \
make-pot
MAINTAINERCLEANFILES = \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
+195
View File
@@ -1,3 +1,198 @@
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
===================================
* Go back to requiring GTK_FRAME_EXTENTS support for CSD,
to fix shadow problems in KDE.
* Bug fixes:
535929 Fix warnings from xReply test in configure.in
577862 FileFilter name not set
669008 Kerberos authentication popup
712760 Clang static analysis fixes
739070 Undefined reference to get_xkb() when building with --disable-xkb
744288 gdk_gl_context_set_required_version() handles version requests...
744589 nautilus bookmarks changing places randomly
745065 GtkPrintOperation dialog creation fails when GTK is locally loaded
745463 Search suggestions are not shown in Clocks / Weather
745479 Tracker search in file chooser causes a crash
745562 gedit titlebar is no longer draggable
745578 sincos is not portable
745622 Selected text not highlighted in GtkInfoBar
745721 wayland: Add support for gtk_window_set_modal
745918 add padding to textview in CSS section of GtkInspector
745969 CSD windows cannot be moved immediately after being resized
746013 Invalid write of size 8
Print dialog: Fix icons in HighContrast
Fix selected menu items in HighContrast
App chooser: Fix icons in HighContrast
* Translation updates:
French
Galician
Kazakh
Korean
Lithuanian
Polish
Slovak
Swedish
Overview of Changes in GTK+ 3.15.10
===================================
* GtkFileChooser:
- Don't start search too eagerly
- Use fts with tracker
- Make tracker queries more similar to nautilus
GtkWindow:
- Improve window dragging on header bars
* Printing:
- Make avahi-browsed printers work
- Set printer state correctly
* Wayland
- Exit cleanly if the compositor goes away
- Don't ignore early maximization/fullscreening
- Make subsurface popovers work under Weston
* GL
- Port GdkGears example to modern OpenGL
* Bugs fixed:
741511 Critical message: NULL is passed to g_object_unref() in spi_...
743323 avahi-discovered CUPS printers don't work
743427 subsurface-using popovers don't work on Weston
744879 Another core dump when clicking the Back button
745225 eventcontroller: Don't crash if the widget is destroyed first
745263 The Open button in the new file chooser is too low/thin
745289 wayland: do not use g_error() on connection errors
745303 Wayland: Initial setup window is not maximised
745344 overlay scrollbar fail
745400 fix a couple of issues in gdkglcontext-win32
703610 Problems with UC-Logic WA60 tablet
729366 Changes to folder name are not shown when creating new fol...
745315 Overshoot deceleration causes WebKitGTK1 web view to jump ...
* Translation updates
Afrikaans
Czech
French
Greek
Hebrew
Hungarian
Kazakh
Lithuanian
Polish
Slovak
Spanish
Vietnamese
Overview of Changes in GTK+ 3.15.9
==================================
* GtkScrolledWindow
- Avoid 'jumping' when zoom scrolling kicks in
- Make zoom scrolling less easy to trigger
- Make steppers use smooth autoscrolling
* Input methods can now be turned off entirely, which
can be useful to free up the Ctrl-Shift-u shortcut
* Add some DND support to gtk3-icon-browser
* Bugs fixed:
696505 Segfault on Windows x64: gtkstatusicon.c tries to put 64-bit...
744942 quartz: Avoid segfaulting when calling gdk_window_ensure_native
744991 Fix loading of GResource SVGs
745052 Icon theme code assumes directories with mtime 0 don't exist
745076 Various DPI and OpenGL related fixes in the Wayland backend
Fix crash and miscalculation in css bitmask manipulation
Fix a crash due to too large surfaces
* Translation updates
Chinese (Taiwan)
Hebrew
Hungarian
Galician
Greek
Slovak
Spanish
Overview of Changes in GTK+ 3.15.8
==================================
* CSS
- Support animated font weight changes
* GtkScrolledWindow:
- Ensure indicators appear in the correct place
* Wayland:
- DND fixes
* GtkPopover:
- has a map/unmap animation now
* Bugs fixed:
743647 image-missing is missing from libgtk's resources
744054 Clarify documentation for event propagation a...
744683 Tooltips should have ATK_ROLE_TOOL_TIP (like ...
* Translation updates
Galician
Hebrew
Hungarian
Italian
Norwegian bokmål
Punjabi
Slovenian
Spanish
Overview of Changes in GTK+ 3.15.7
==================================
+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
======================
+4
View File
@@ -89,6 +89,7 @@
<AdditionalDependencies>atk-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<ModuleDefinitionFile>..\..\..\libgail-util\gailutil.def</ModuleDefinitionFile>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<SubSystem>Windows</SubSystem>
@@ -113,6 +114,7 @@
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<ModuleDefinitionFile>..\..\..\libgail-util\gailutil.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
@@ -135,6 +137,7 @@
<AdditionalDependencies>atk-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<ModuleDefinitionFile>..\..\..\libgail-util\gailutil.def</ModuleDefinitionFile>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<SubSystem>Windows</SubSystem>
@@ -158,6 +161,7 @@
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<ModuleDefinitionFile>..\..\..\libgail-util\gailutil.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
+8
View File
@@ -147,6 +147,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
@@ -169,6 +170,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
@@ -188,6 +190,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -209,6 +212,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -233,6 +237,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
@@ -255,6 +260,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
@@ -274,6 +280,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -295,6 +302,7 @@
<AdditionalDependencies>imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
+2
View File
@@ -21,6 +21,8 @@
<AdditionalIncludeDirectories>..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>pangocairo-1.0.lib;cairo.lib;cairo-gobject.lib;pango-1.0.lib;gdk_pixbuf-2.0.lib;gio-2.0.lib;gmodule-2.0.lib;gobject-2.0.lib;glib-2.0.lib;intl.lib;epoxy.lib;%(AdditionalDependencies)</AdditionalDependencies>
+58 -15
View File
@@ -11,26 +11,69 @@
<GtkDoInstallBin>
mkdir $(CopyDir)\bin
mkdir $(CopyDir)\lib
copy "$(BinDir)\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll" $(CopyDir)\bin
copy "$(BinDir)\$(GtkDllPrefix)gdk$(GtkDllSuffix).pdb" $(CopyDir)\bin
copy "$(BinDir)\gdk-$(ApiVersion).lib" $(CopyDir)\lib
if "$(Configuration)" == "Release_Broadway" goto DO_BROADWAY_BIN
if "$(Configuration)" == "Debug_Broadway" goto DO_BROADWAY_BIN
copy "$(BinDir)\*.dll" $(CopyDir)\bin
copy "$(BinDir)\*-$(ApiVersion).lib" $(CopyDir)\lib
copy "$(BinDir)\*.exe" $(CopyDir)\bin
copy "$(BinDir)\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll" $(CopyDir)\bin
copy "$(BinDir)\$(GtkDllPrefix)gtk$(GtkDllSuffix).pdb" $(CopyDir)\bin
copy "$(BinDir)\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll" $(CopyDir)\bin
copy "$(BinDir)\$(GtkDllPrefix)gailutil$(GtkDllSuffix).pdb" $(CopyDir)\bin
copy "$(BinDir)\gtk-$(ApiVersion).lib" $(CopyDir)\lib
copy "$(BinDir)\gailutil-$(ApiVersion).lib" $(CopyDir)\lib
copy "$(BinDir)\gtk3-demo.exe" $(CopyDir)\bin
copy "$(BinDir)\gtk3-demo.pdb" $(CopyDir)\bin
copy "$(BinDir)\gtk3-demo-application.exe" $(CopyDir)\bin
copy "$(BinDir)\gtk3-demo-application.pdb" $(CopyDir)\bin
copy "$(BinDir)\gtk3-icon-browser.exe" $(CopyDir)\bin
copy "$(BinDir)\gtk3-icon-browser.pdb" $(CopyDir)\bin
copy "$(BinDir)\gtk-encode-symbolic-svg.exe" $(CopyDir)\bin
copy "$(BinDir)\gtk-encode-symbolic-svg.pdb" $(CopyDir)\bin
goto DONE_BIN
:DO_BROADWAY_BIN
copy "$(BinDir)\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll" $(CopyDir)\bin
copy "$(BinDir)\gdk-$(ApiVersion).lib" $(CopyDir)\lib
copy "$(BinDir)\broadwayd.exe" $(CopyDir)\bin
if "$(Configuration)" == "Release_Broadway" copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin
if "$(Configuration)" == "Release_Broadway" copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin
if "$(Configuration)" == "Release_Broadway" copy .\Release\$(Platform)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib
if "$(Configuration)" == "Release_Broadway" copy .\Release\$(Platform)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib
if "$(Configuration)" == "Release_Broadway" copy .\Release\$(Platform)\bin\*.exe $(CopyDir)\bin
if "$(Configuration)" == "Debug_Broadway" copy .\Debug\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin
if "$(Configuration)" == "Debug_Broadway" copy .\Debug\$(Platform)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin
if "$(Configuration)" == "Debug_Broadway" copy .\Debug\$(Platform)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib
if "$(Configuration)" == "Debug_Broadway" copy .\Debug\$(Platform)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib
if "$(Configuration)" == "Debug_Broadway" copy .\Debug\$(Platform)\bin\*.exe $(CopyDir)\bin
copy "$(BinDir)\broadwayd.pdb" $(CopyDir)\bin
if "$(Configuration)" == "Release_Broadway" goto DO_BROADWAY_RELEASE
if "$(Configuration)" == "Debug_Broadway" goto DO_BROADWAY_DEBUG
:DO_BROADWAY_RELEASE
copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin
copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).pdb $(CopyDir)\bin
copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin
copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).pdb $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib
copy .\Release\$(Platform)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib
copy .\Release\$(Platform)\bin\gtk3-demo.exe $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk3-demo.pdb $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk3-demo-application.exe $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk3-demo-application.pdb $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk3-icon-browser.exe $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk3-icon-browser.pdb $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk-encode-symbolic-svg.exe $(CopyDir)\bin
copy .\Release\$(Platform)\bin\gtk-encode-symbolic-svg.pdb $(CopyDir)\bin
goto DONE_BIN
:DO_BROADWAY_DEBUG
copy .\Debug\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).pdb $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).pdb $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib
copy .\Debug\$(Platform)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib
copy .\Debug\$(Platform)\bin\gtk3-demo.exe $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk3-demo.pdb $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk3-demo-application.exe $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk3-demo-application.pdb $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk3-icon-browser.exe $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk3-icon-browser.pdb $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk-encode-symbolic-svg.exe $(CopyDir)\bin
copy .\Debug\$(Platform)\bin\gtk-encode-symbolic-svg.pdb $(CopyDir)\bin
:DONE_BIN
</GtkDoInstallBin>
<GtkDoInstall>
+4
View File
@@ -89,6 +89,7 @@
<AdditionalDependencies>atk-1.0.lib;pangowin32-1.0.lib;imm32.lib;winspool.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
@@ -108,6 +109,7 @@
<AdditionalDependencies>atk-1.0.lib;pangowin32-1.0.lib;imm32.lib;winspool.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -132,6 +134,7 @@
<AdditionalDependencies>atk-1.0.lib;pangowin32-1.0.lib;imm32.lib;winspool.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(ProjectName)-$(ApiVersion).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
@@ -151,6 +154,7 @@
<AdditionalDependencies>atk-1.0.lib;pangowin32-1.0.lib;imm32.lib;winspool.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -161,6 +161,7 @@
<ItemGroup>
<ClCompile Include="..\..\..\demos\icon-browser\iconbrowserapp.c" />
<ClCompile Include="..\..\..\demos\icon-browser\iconbrowserwin.c" />
<ClCompile Include="..\..\..\demos\icon-browser\iconstore.c" />
<ClCompile Include="..\..\..\demos\icon-browser\main.c" />
<ClCompile Include="..\..\..\demos\icon-browser\resources.c" />
</ItemGroup>
@@ -17,6 +17,7 @@
<ItemGroup>
<ClCompile Include="..\..\..\demos\icon-browser\iconbrowserapp.c"><Filter>Sources</Filter></ClCompile>
<ClCompile Include="..\..\..\demos\icon-browser\iconbrowserwin.c"><Filter>Sources</Filter></ClCompile>
<ClCompile Include="..\..\..\demos\icon-browser\iconstore.c"><Filter>Sources</Filter></ClCompile>
<ClCompile Include="..\..\..\demos\icon-browser\main.c"><Filter>Sources</Filter></ClCompile>
<ClCompile Include="..\..\..\demos\icon-browser\resources.c"><Filter>Sources</Filter></ClCompile>
</ItemGroup>
@@ -12,6 +12,7 @@
AdditionalIncludeDirectories="..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0"
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES"
ForcedIncludeFiles="msvc_recommended_pragmas.h"
AdditionalOptions="/MP"
/>
<Tool
Name="VCLinkerTool"
+52 -15
View File
@@ -10,26 +10,63 @@
Value="
mkdir $(CopyDir)\bin&#x0D;&#x0A;
mkdir $(CopyDir)\lib&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).pdb $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; goto DO_BROADWAY_BIN&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; goto DO_BROADWAY_BIN&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\*.dll $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\*-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\*.exe $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).pdb $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).pdb $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk3-demo.exe $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk3-demo.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk3-demo-application.exe $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk3-demo-application.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk3-icon-browser.exe $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk3-icon-browser.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk-encode-symbolic-svg.exe $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gtk-encode-symbolic-svg.pdb $(CopyDir)\bin&#x0D;&#x0A;
goto DONE_BIN&#x0D;&#x0A;
:DO_BROADWAY_BIN&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\gdk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\broadwayd.exe $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; copy .\Release\$(PlatformName)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; copy .\Release\$(PlatformName)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; copy .\Release\$(PlatformName)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; copy .\Release\$(PlatformName)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; copy .\Release\$(PlatformName)\bin\*.exe $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; copy .\Debug\$(PlatformName)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; copy .\Debug\$(PlatformName)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; copy .\Debug\$(PlatformName)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; copy .\Debug\$(PlatformName)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; copy .\Debug\$(PlatformName)\bin\*.exe $(CopyDir)\bin&#x0D;&#x0A;
copy $(ConfigurationName)\$(PlatformName)\bin\broadwayd.pdb $(CopyDir)\bin&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Release_Broadway&quot; goto DO_BROADWAY_RELEASE&#x0D;&#x0A;
if &quot;$(ConfigurationName)&quot; == &quot;Debug_Broadway&quot; goto DO_BROADWAY_DEBUG&#x0D;&#x0A;
:DO_BROADWAY_RELEASE&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk3-demo.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk3-demo.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk3-demo-application.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk3-demo-application.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk3-icon-browser.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk3-icon-browser.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk-encode-symbolic-svg.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Release\$(PlatformName)\bin\gtk-encode-symbolic-svg.pdb $(CopyDir)\bin&#x0D;&#x0A;
goto DONE_BIN&#x0D;&#x0A;
:DO_BROADWAY_DEBUG&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\$(GtkDllPrefix)gailutil$(GtkDllSuffix).dll $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gailutil-$(ApiVersion).lib $(CopyDir)\lib&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk3-demo.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk3-demo.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk3-demo-application.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk3-demo-application.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk3-icon-browser.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk3-icon-browser.pdb $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk-encode-symbolic-svg.exe $(CopyDir)\bin&#x0D;&#x0A;
copy .\Debug\$(PlatformName)\bin\gtk-encode-symbolic-svg.pdb $(CopyDir)\bin&#x0D;&#x0A;
:DONE_BIN&#x0D;&#x0A;
"
/>
+1
View File
@@ -158,6 +158,7 @@
>
<File RelativePath="..\..\..\demos\icon-browser\iconbrowserapp.c" />
<File RelativePath="..\..\..\demos\icon-browser\iconbrowserwin.c" />
<File RelativePath="..\..\..\demos\icon-browser\iconstore.c" />
<File RelativePath="..\..\..\demos\icon-browser\main.c" />
<File RelativePath="..\..\..\demos\icon-browser\resources.c" />
</Filter>
+3
View File
@@ -141,6 +141,9 @@
#define HAVE_ROUND 1
#endif
/* Define to 1 if sincos() is available */
/* #undef HAVE_SINCOS */
/* Have the sockaddr_un.sun_len member */
/* #undef HAVE_SOCKADDR_UN_SUN_LEN */
+20 -19
View File
@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [15])
m4_define([gtk_micro_version], [7])
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)])
@@ -147,7 +147,6 @@ AC_PROG_MKDIR_P
AC_PROG_INSTALL
AC_PROG_MAKE_SET
GETTEXT_PACKAGE=gtk30
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
@@ -666,6 +665,15 @@ fi
# i18n stuff
ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
AM_GLIB_GNU_GETTEXT
AC_MSG_CHECKING([whether xgettext supports ui files])
if $ac_cv_path_XGETTEXT --output=- --language=Glade $srcdir/gtk/ui/gtkfilechooserwidget.ui > /dev/null 2>&1; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([GNU gettext 0.18.3 or newer is required])
fi
LIBS="$LIBS $INTLLIBS"
AC_CONFIG_COMMANDS([po-properties],
[[case "$CONFIG_FILES" in *po-properties/Makefile.in*)
@@ -818,7 +826,7 @@ AC_TYPE_UID_T
# Check for round(), rint(), isnan(), isinf() and nearbyint()
AC_CHECK_LIB(m,round,,)
AC_CHECK_FUNCS(round rint nearbyint)
AC_CHECK_FUNCS(round rint nearbyint sincos)
AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
# Checks for gdkspawn
@@ -1023,22 +1031,16 @@ if test "x$enable_x11_backend" = xyes; then
AC_CHECK_FUNC(XextFindDisplay, :,
AC_MSG_ERROR([*** libX11 and libXext not found. Check 'config.log' for more details.]))
# Check for xReply
# Check if <X11/extensions/XIproto.h> is needed for xReply.
AC_MSG_CHECKING([if <X11/extensions/XIproto.h> is needed for xReply])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlibint.h>]],
[[xReply *rep = NULL;
rep = rep;]])],
[AC_MSG_RESULT([no])],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/XIproto.h>
#include <X11/Xlibint.h>]],
[[xReply *rep = NULL;
rep = rep;]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([NEED_XIPROTO_H_FOR_XREPLY], [1],
[Define if <X11/extensions/XIproto.h> needed for xReply])],
[AC_MSG_RESULT([unknown])
AC_MSG_ERROR([xReply type unavailable. X11 is too old])])])
AC_CHECK_TYPE([xReply], ,
[AC_CHECK_TYPE([xReply],
[AC_DEFINE([NEED_XIPROTO_H_FOR_XREPLY], 1,
[Define if <X11/extensions/XIproto.h> needed for xReply])],
[AC_MSG_ERROR([xReply type unavailable. X11 is too old])],
[[#include <X11/extensions/XIproto.h>
#include <X11/Xlibint.h>]])],
[[#include <X11/Xlibint.h>]])
# Check for XKB support.
@@ -1906,7 +1908,6 @@ gtk/makefile.msc
gtk/gtkversion.h
gtk/gtk-win32.rc
gtk/libgtk3.manifest
util/Makefile
libgail-util/Makefile
modules/Makefile
modules/input/Makefile
-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
@@ -20,6 +20,7 @@ gtk3_icon_browser_SOURCES = \
main.c \
iconbrowserapp.c iconbrowserapp.h \
iconbrowserwin.c iconbrowserwin.h \
iconstore.c iconstore.h \
resources.c
BUILT_SOURCES = \
+94 -27
View File
@@ -1,6 +1,7 @@
#include <string.h>
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "iconstore.h"
#include <gtk/gtk.h>
typedef struct
@@ -42,13 +43,6 @@ struct _IconBrowserWindowClass
GtkApplicationWindowClass parent_class;
};
enum {
NAME_COLUMN,
SYMBOLIC_NAME_COLUMN,
DESCRIPTION_COLUMN,
CONTEXT_COLUMN
};
G_DEFINE_TYPE(IconBrowserWindow, icon_browser_window, GTK_TYPE_APPLICATION_WINDOW);
static void
@@ -64,16 +58,31 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
gtk_tree_model_filter_refilter (win->filter_model);
}
static void
set_image (GtkWidget *image, const gchar *name, gint size)
static GdkPixbuf *
get_icon (GtkWidget *image, const gchar *name, gint size)
{
gtk_image_set_from_icon_name (GTK_IMAGE (image), name, 1);
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
GtkIconInfo *info;
GtkStyleContext *context;
GdkPixbuf *pixbuf;
context = gtk_widget_get_style_context (image);
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL);
g_object_unref (info);
return pixbuf;
}
static void
selection_changed (GtkIconView *icon_view, IconBrowserWindow *win)
set_image (GtkWidget *image, const gchar *name, gint size)
{
GdkPixbuf *pixbuf;
gtk_image_set_from_icon_name (GTK_IMAGE (image), name, 1);
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
pixbuf = get_icon (image, name, size);
gtk_drag_source_set_icon_pixbuf (gtk_widget_get_parent (image), pixbuf);
g_object_unref (pixbuf);
}
static void
@@ -87,14 +96,14 @@ item_activated (GtkIconView *icon_view, GtkTreePath *path, IconBrowserWindow *wi
gtk_tree_model_get_iter (GTK_TREE_MODEL (win->filter_model), &iter, path);
if (win->symbolic)
column = SYMBOLIC_NAME_COLUMN;
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;
else
column = NAME_COLUMN;
column = ICON_STORE_NAME_COLUMN;
gtk_tree_model_get (GTK_TREE_MODEL (win->filter_model), &iter,
column, &name,
DESCRIPTION_COLUMN, &description,
ICON_STORE_DESCRIPTION_COLUMN, &description,
-1);
if (name == NULL || !gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), name))
{
g_free (description);
@@ -146,10 +155,10 @@ add_icon (IconBrowserWindow *win,
symbolic_name = NULL;
}
gtk_list_store_insert_with_values (win->store, NULL, -1,
NAME_COLUMN, regular_name,
SYMBOLIC_NAME_COLUMN, symbolic_name,
DESCRIPTION_COLUMN, description,
CONTEXT_COLUMN, context,
ICON_STORE_NAME_COLUMN, regular_name,
ICON_STORE_SYMBOLIC_NAME_COLUMN, symbolic_name,
ICON_STORE_DESCRIPTION_COLUMN, description,
ICON_STORE_CONTEXT_COLUMN, context,
-1);
}
@@ -702,13 +711,13 @@ icon_visible_func (GtkTreeModel *model,
search_text = gtk_entry_get_text (GTK_ENTRY (win->searchentry));
if (win->symbolic)
column = SYMBOLIC_NAME_COLUMN;
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;
else
column = NAME_COLUMN;
column = ICON_STORE_NAME_COLUMN;
gtk_tree_model_get (model, iter,
column, &name,
CONTEXT_COLUMN, &context,
ICON_STORE_CONTEXT_COLUMN, &context,
-1);
if (!name)
visible = FALSE;
@@ -731,9 +740,11 @@ symbolic_toggled (GtkToggleButton *toggle, IconBrowserWindow *win)
win->symbolic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
if (win->symbolic)
column = SYMBOLIC_NAME_COLUMN;
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;
else
column = NAME_COLUMN;
column = ICON_STORE_NAME_COLUMN;
icon_store_set_text_column (ICON_STORE (win->store), column);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (win->list), win->cell, "icon-name", column, NULL);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (win->list), win->text_cell, "text", column, NULL);
@@ -749,17 +760,72 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
gtk_list_box_unselect_all (GTK_LIST_BOX (win->context_list));
}
static void
get_image_data (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection,
guint target_info,
guint time,
gpointer data)
{
GtkWidget *image;
const gchar *name;
gint size;
GdkPixbuf *pixbuf;
image = gtk_bin_get_child (GTK_BIN (widget));
gtk_image_get_icon_name (GTK_IMAGE (image), &name, NULL);
size = gtk_image_get_pixel_size (GTK_IMAGE (image));
pixbuf = get_icon (image, name, size);
gtk_selection_data_set_pixbuf (selection, pixbuf);
g_object_unref (pixbuf);
}
static void
setup_image_dnd (GtkWidget *image)
{
GtkWidget *parent;
parent = gtk_widget_get_parent (image);
gtk_drag_source_set (parent, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (parent);
g_signal_connect (parent, "drag-data-get", G_CALLBACK (get_image_data), NULL);
}
static void
icon_browser_window_init (IconBrowserWindow *win)
{
GtkTargetList *list;
GtkTargetEntry *targets;
gint n_targets;
gtk_widget_init_template (GTK_WIDGET (win));
list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_text_targets (list, 0);
targets = gtk_target_table_new_from_list (list, &n_targets);
gtk_target_list_unref (list);
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (win->list),
GDK_BUTTON1_MASK,
targets, n_targets,
GDK_ACTION_COPY);
gtk_target_table_free (targets, n_targets);
setup_image_dnd (win->image1);
setup_image_dnd (win->image2);
setup_image_dnd (win->image3);
setup_image_dnd (win->image4);
setup_image_dnd (win->image5);
win->contexts = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
gtk_tree_model_filter_set_visible_func (win->filter_model, icon_visible_func, win, NULL);
gtk_window_set_transient_for (GTK_WINDOW (win->details), GTK_WINDOW (win));
g_signal_connect (win->searchbar, "notify::search-mode-enabled",
G_CALLBACK (search_mode_toggled), win);
@@ -771,6 +837,8 @@ icon_browser_window_init (IconBrowserWindow *win)
static void
icon_browser_window_class_init (IconBrowserWindowClass *class)
{
g_type_ensure (ICON_STORE_TYPE);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/iconbrowser/window.ui");
@@ -794,7 +862,6 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, description);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), selection_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), item_activated);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), selected_context_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
+91
View File
@@ -0,0 +1,91 @@
#include "iconstore.h"
#include <gtk/gtk.h>
struct _IconStore
{
GtkListStore parent;
gint text_column;
};
struct _IconStoreClass
{
GtkListStoreClass parent_class;
};
static void icon_store_drag_source_init (GtkTreeDragSourceIface *iface);
G_DEFINE_TYPE_WITH_CODE (IconStore, icon_store, GTK_TYPE_LIST_STORE,
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
icon_store_drag_source_init))
static void
icon_store_init (IconStore *store)
{
GType types[4] = { G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING };
gtk_list_store_set_column_types (GTK_LIST_STORE (store), 4, types);
store->text_column = ICON_STORE_NAME_COLUMN;
}
static void
icon_store_class_init (IconStoreClass *class)
{
}
static gboolean
row_draggable (GtkTreeDragSource *drag_source,
GtkTreePath *path)
{
return TRUE;
}
static gboolean
drag_data_delete (GtkTreeDragSource *drag_source,
GtkTreePath *path)
{
GtkTreeIter iter;
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (drag_source), &iter, path))
return gtk_list_store_remove (GTK_LIST_STORE (drag_source), &iter);
return FALSE;
}
static gboolean
drag_data_get (GtkTreeDragSource *drag_source,
GtkTreePath *path,
GtkSelectionData *selection)
{
GtkTreeIter iter;
gchar *text;
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (drag_source), &iter, path))
return FALSE;
gtk_tree_model_get (GTK_TREE_MODEL (drag_source), &iter,
ICON_STORE (drag_source)->text_column, &text,
-1);
gtk_selection_data_set_text (selection, text, -1);
g_free (text);
return TRUE;
}
static void
icon_store_drag_source_init (GtkTreeDragSourceIface *iface)
{
iface->row_draggable = row_draggable;
iface->drag_data_delete = drag_data_delete;
iface->drag_data_get = drag_data_get;
}
void
icon_store_set_text_column (IconStore *store, gint text_column)
{
store->text_column = text_column;
}
+26
View File
@@ -0,0 +1,26 @@
#ifndef __ICON_STORE_H
#define __ICON_STORE_H
#include <gtk/gtk.h>
#define ICON_STORE_TYPE (icon_store_get_type ())
#define ICON_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_STORE_TYPE, IconStore))
typedef struct _IconStore IconStore;
typedef struct _IconStoreClass IconStoreClass;
enum {
ICON_STORE_NAME_COLUMN,
ICON_STORE_SYMBOLIC_NAME_COLUMN,
ICON_STORE_DESCRIPTION_COLUMN,
ICON_STORE_CONTEXT_COLUMN
};
GType icon_store_get_type (void);
void icon_store_set_text_column (IconStore *store,
gint column);
#endif /* __ICON_STORE_H */
+53 -33
View File
@@ -1,13 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<object class="GtkListStore" id="store">
<columns>
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gchararray"/>
</columns>
<object class="IconStore" id="store">
</object>
<object class="GtkTreeModelFilter" id="filter_model">
<property name="child_model">store</property>
@@ -108,7 +102,8 @@
<object class="GtkIconView" id="list">
<property name="visible">True</property>
<property name="model">filter_model</property>
<signal name="selection_changed" handler="selection_changed"/>
<property name="selection-mode">none</property>
<property name="activate-on-single-click">True</property>
<signal name="item_activated" handler="item_activated"/>
<child>
<object class="GtkCellRendererPixbuf" id="cell">
@@ -156,12 +151,17 @@
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkImage" id="image1">
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
@@ -169,12 +169,17 @@
</packing>
</child>
<child>
<object class="GtkImage" id="image2">
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
@@ -182,12 +187,17 @@
</packing>
</child>
<child>
<object class="GtkImage" id="image3">
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
@@ -195,12 +205,17 @@
</packing>
</child>
<child>
<object class="GtkImage" id="image4">
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">3</property>
@@ -208,12 +223,17 @@
</packing>
</child>
<child>
<object class="GtkImage" id="image5">
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
<child>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="xpad">4</property>
<property name="ypad">4</property>
<property name="halign">center</property>
<property name="valign">end</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">4</property>
+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>
+77 -10
View File
@@ -1060,6 +1060,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkFileChooserButton" id="filechooserbutton1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="local_only">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1570,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>
@@ -2895,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>
@@ -3073,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>
@@ -3621,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">
@@ -3860,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>
@@ -3872,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>
+1
View File
@@ -28,6 +28,7 @@ IGNORE_HFILES= \
gdkprivate.h \
gdk*private.h \
keyname-table.h \
wayland/xdg-shell-client-protocol.h \
win32 \
x11 \
quartz
+157 -24
View File
@@ -19,85 +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 \
@@ -172,6 +304,7 @@ expand_content_files = \
drawing-model.xml \
getting_started.xml \
glossary.xml \
input-handling.xml \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-unique-GtkApplication.xml \
+88 -46
View File
@@ -100,7 +100,7 @@
application. Inside the activate() function we want to construct
our GTK window, so that a window is shown when the application
is launched. The call to gtk_application_window_new() will
createa a new #GtkWindow and store it inside the
create a new #GtkWindow and store it inside the
<varname>window</varname> pointer. The window will have a frame,
a title bar, and window controls depending on the platform.</para>
@@ -165,6 +165,47 @@
</para>
</section>
<para>As seen above, example-1.c builds further upon example-0.c by adding a
button to our window, with the label "Hello World". Two new GtkWidget pointers
are declared to accomplish this, <varname>button</varname> and
<varname>button_box</varname>. The button_box variable is created to store a
#GtkButtonBox which is GTK+'s way of controlling the size and layout of buttons.
The #GtkButtonBox is created and assigned to gtk_button_box_new() which takes a
#GtkOrientation enum as parameter. The buttons which this box will contain can
either be stored horizontally or vertically but this does not matter in this
particular case as we are dealing with only one button. After initializing
button_box with horizontal orientation, the code adds the button_box widget to the
window widget using gtk_container_add().</para>
<para>Next the <varname>button</varname> variable is initialized in similar manner.
gtk_button_new_with_label() is called which returns a GtkButton to be stored inside
<varname>button</varname>. Afterwards <varname>button</varname> is added to
our <varname>button_box</varname>.
Using g_signal_connect the button is connected to a function in our app called
print_hello(), so that when the button is clicked, GTK will call this function.
As the print_hello() function does not use any data as input, NULL is passed
to it. print_hello() calls g_print() with the string "Hello World"
which will print Hello World in a terminal if the GTK application was started
from one.</para>
<para>After connecting print_hello(), another signal is connected to the "clicked" state
of the button using g_signal_connect_swapped(). This functions is similar to
a g_signal_connect() with the difference lying in how the callback function is
treated. g_signal_connect_swapped() allow you to specify what the callback
function should take as parameter by letting you pass it as data. In this case
the function being called back is gtk_widget_destroy() and the <varname>window</varname>
pointer is passed to it. This has the effect that when the button is clicked,
the whole GTK window is destroyed. In contrast if a normal g_signal_connect() were used
to connect the "clicked" signal with gtk_widget_destroy(), then the <varname>button</varname>
itself would have been destroyed, not the window.
More information about creating buttons can be found
<ulink url="https://wiki.gnome.org/HowDoI/Buttons">here</ulink>.
</para>
<para>The rest of the code in example-1.c is identical to example-0.c. Next
section will elaborate further on how to add several GtkWidgets to your GTK
application.</para>
<section>
<title>Packing</title>
@@ -202,51 +243,6 @@
</para>
</section>
<section>
<title>Drawing</title>
<para>Many widgets, like buttons, do all their drawing themselves. You
just tell them the label you want to see, and they figure out what font
to use, draw the button outline and focus rectangle, etc. Sometimes, it
is necessary to do some custom drawing. In that case, a #GtkDrawingArea
might be the right widget to use. It offers a canvas on which you can
draw by connecting to the #GtkWidget::draw signal.
</para>
<para>The contents of a widget often need to be partially or fully redrawn,
e.g. when another window is moved and uncovers part of the widget, or
when tie window containing it is resized. It is also possible to explicitly
cause part or all of the widget to be redrawn, by calling
gtk_widget_queue_draw() or its variants. GTK+ takes care of most of the
details by providing a ready-to-use cairo context to the ::draw signal
handler.</para>
<para>The following example shows a ::draw signal handler. It is a bit
more complicated than the previous examples, since it also demonstrates
input event handling by means of ::button-press and ::motion-notify
handlers.</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="drawing.png" format="PNG"/>
</imageobject>
</mediaobject>
</informalfigure>
<example id="gtk-getting-started-drawing">
<title>Drawing in response to input</title>
<para>Create a new file with the following content named example-3.c.</para>
<programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
<literallayout>
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-3 example-3.c `pkg-config --libs gtk+-3.0`</literal>
</literallayout>
</para>
</section>
<section>
<title>Building user interfaces</title>
@@ -1041,4 +1037,50 @@ example_app_window_init (ExampleAppWindow *win)
here.</para>
</section>
</section>
<section>
<title>Custom Drawing</title>
<para>Many widgets, like buttons, do all their drawing themselves. You
just tell them the label you want to see, and they figure out what font
to use, draw the button outline and focus rectangle, etc. Sometimes, it
is necessary to do some custom drawing. In that case, a #GtkDrawingArea
might be the right widget to use. It offers a canvas on which you can
draw by connecting to the #GtkWidget::draw signal.
</para>
<para>The contents of a widget often need to be partially or fully redrawn,
e.g. when another window is moved and uncovers part of the widget, or
when tie window containing it is resized. It is also possible to explicitly
cause part or all of the widget to be redrawn, by calling
gtk_widget_queue_draw() or its variants. GTK+ takes care of most of the
details by providing a ready-to-use cairo context to the ::draw signal
handler.</para>
<para>The following example shows a ::draw signal handler. It is a bit
more complicated than the previous examples, since it also demonstrates
input event handling by means of ::button-press and ::motion-notify
handlers.</para>
<informalfigure>
<mediaobject>
<imageobject>
<imagedata fileref="drawing.png" format="PNG"/>
</imageobject>
</mediaobject>
</informalfigure>
<example id="gtk-getting-started-drawing">
<title>Drawing in response to input</title>
<para>Create a new file with the following content named example-3.c.</para>
<programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
<literallayout>
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-3 example-3.c `pkg-config --libs gtk+-3.0`</literal>
</literallayout>
</para>
</section>
</chapter>
+1 -1
View File
@@ -25,7 +25,7 @@
<xi:include href="resources.sgml" />
<xi:include href="xml/question_index.sgml" />
<xi:include href="drawing-model.xml" />
<xi:include href="input-handling.xml" />
<xi:include href="xml/input-handling.xml" />
</part>
+131 -7
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>
@@ -557,7 +558,6 @@ gtk_list_box_row_new
gtk_list_box_row_changed
gtk_list_box_row_is_selected
gtk_list_box_row_get_header
gtk_list_box_row_get_type
gtk_list_box_row_set_header
gtk_list_box_row_get_index
gtk_list_box_row_set_activatable
@@ -566,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
@@ -1120,6 +1126,7 @@ gtk_editable_get_type
<FILE>gtkentry</FILE>
<TITLE>GtkEntry</TITLE>
GtkEntry
GtkEntryClass
gtk_entry_new
gtk_entry_new_with_buffer
gtk_entry_get_buffer
@@ -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>
@@ -7966,7 +8059,20 @@ gtk_popover_set_position
gtk_popover_get_position
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>
@@ -7976,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>
@@ -7986,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>
@@ -8005,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
@@ -8222,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>
@@ -8242,10 +8364,9 @@ 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
gtk_gl_area_set_profile
gtk_gl_area_get_profile
<SUBSECTION>
gtk_gl_area_set_has_alpha
gtk_gl_area_get_has_alpha
@@ -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>
+139 -52
View File
@@ -4,21 +4,21 @@
]>
<refentry id="chap-input-handling">
<refmeta>
<refentrytitle>The GTK+ Input Handling Model</refentrytitle>
<refentrytitle>The GTK+ Input and Event Handling Model</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>The GTK+ Input Handling Model</refname>
<refname>The GTK+ Input and Event Handling Model</refname>
<refpurpose>
GTK+ input handling in detail
GTK+ input and event handling in detail
</refpurpose>
</refnamediv>
<refsect1 id="input-overview">
<title>Overview of GTK+ input handling</title>
<title>Overview of GTK+ input and event handling</title>
<para>
This chapter describes in detail how GTK+ handles input. If you are interested
@@ -64,20 +64,20 @@
GDK translates these raw windowing system events into #GdkEvents.
Typical input events are:
<simplelist>
<member>GdkEventButton</member>
<member>GdkEventMotion</member>
<member>GdkEventCrossing</member>
<member>GdkEventKey</member>
<member>GdkEventFocus</member>
<member>GdkEventTouch</member>
<member>#GdkEventButton</member>
<member>#GdkEventMotion</member>
<member>#GdkEventCrossing</member>
<member>#GdkEventKey</member>
<member>#GdkEventFocus</member>
<member>#GdkEventTouch</member>
</simplelist>
</para>
<para>
Additionally, GDK/GTK synthesizes other signals to let know whether
grabs (system-wide or in-app) are taking input away:
<simplelist>
<member>GdkEventGrabBroken</member>
<member>GtkWidget::grab-notify</member>
<member>#GdkEventGrabBroken</member>
<member>#GtkWidget::grab-notify</member>
</simplelist>
</para>
<para>
@@ -87,80 +87,167 @@
</para>
</refsect2>
<refsect2>
<refsect2 id="event-propagation">
<title>Event propagation</title>
<para>
When GTK+ receives an event, it determines the target widget that
it is directed to. Unless grabs are involved, this is done by finding
the widget to which the window of the event belongs.
For widgets which have a #GdkWindow set, events are received from the
windowing system and passed to gtk_main_do_event(). See its documentation
for details of what it does: compression of enter/leave events,
identification of the widget receiving the event, pushing the event onto a
stack for gtk_get_current_event(), and propagating the event to the
widget.
</para>
<para>
The event is then propagated from the toplevel window down to the
target widget. In this phase, which is known as the “capture” phase,
gestures that are attached with GTK_PHASE_CAPTURE get a chance
to react to the event.
When a GDK backend produces an input event, it is tied to a #GdkDevice and
a #GdkWindow, which in turn represents a windowing system surface in the
backend. If a widget has grabbed the current input device, or all input
devices, the event is propagated to that #GtkWidget. Otherwise, it is
propagated to the the #GtkWidget which called gtk_widget_register_window()
on the #GdkWindow receiving the event.
</para>
<para>
Grabs are implemented for each input device, and globally. A grab for a
specific input device (gtk_device_grab_add()), is sent events in
preference to a global grab (gtk_grab_add()). Input grabs only have effect
within the #GtkWindowGroup containing the #GtkWidget which registered the
events #GdkWindow. If this #GtkWidget is a child of the grab widget, the
event is propagated to the child — this is the basis for propagating
events within modal dialogs.
</para>
<para>
An event is propagated to a widget using gtk_propagate_event().
Propagation differs between event types: key events (%GDK_KEY_PRESS,
%GDK_KEY_RELEASE) are delivered to the top-level #GtkWindow; other events
are propagated down and up the widget hierarchy in three phases (see
#GtkPropagationPhase).
</para>
<para>
For key events, the top-level windows default #GtkWindow::key-press-event
and #GtkWindow::key-release-event signal handlers handle mnemonics and
accelerators first. Other key presses are then passed to
gtk_window_propagate_key_event() which propagates the event upwards from
the windows current focus widget (gtk_window_get_focus()) to the
top-level.
</para>
<para>
For other events, in the first phase (the “capture” phase) the event is
delivered to each widget from the top-most (for example, the top-level
#GtkWindow or grab widget) down to the target #GtkWidget.
<link linkend="event-controllers-and-gestures">Gestures</link> that are
attached with %GTK_PHASE_CAPTURE get a chance to react to the event.
</para>
<para>
After the “capture” phase, the widget that was intended to be the
destination of the event will let run gestures attached to it with
GTK_PHASE_TARGET. This is known as the “target” phase, and does only
happen on that widget.
destination of the event will run gestures attached to it with
%GTK_PHASE_TARGET. This is known as the “target” phase, and only
happens on that widget.
</para>
<para>
Next, the appropriate event signal is emitted for the event in question,
e.g. “motion-notify-event”. Handling these signals was the primary
way to handle input in GTK+ widgets before gestures were introduced.
The signals are emitted from the target widget up to the toplevel,
until a signal handler indicates that it has handled the event, by
returning GDK_EVENT_STOP.
Next, the #GtkWidget::event signal is emitted, then the appropriate signal
for the event in question, for example #GtkWidget::motion-notify-event.
Handling these signals was the primary way to handle input in GTK+ widgets
before gestures were introduced. If the widget is realized, the
#GtkWidget::event-after signal is emitted. The signals are emitted from
the target widget up to the top-level, as part of the “bubble” phase.
</para>
<para>
The default handlers for the event signals send the event
to gestures that are attached with GTK_PHASE_BUBBLE. Therefore,
to gestures that are attached with %GTK_PHASE_BUBBLE. Therefore,
gestures in the “bubble” phase are only used if the widget does
not have its own event handlers, or takes care to chain up to the
default GtkWidget handlers.
default #GtkWidget handlers.
</para>
<para>
Anytime during the propagation phase, a widget may indicate that a
Events are not delivered to a widget which is insensitive or unmapped.
</para>
<para>
Any time during the propagation phase, a widget may indicate that a
received event was consumed and propagation should therefore be stopped.
In traditional event handlers, this is hinted by returning GDK_EVENT_STOP,
if gestures are used, this may happen when the widget tells the gesture
In traditional event handlers, this is hinted by returning %GDK_EVENT_STOP.
If gestures are used, this may happen when the widget tells the gesture
to claim the event touch sequence (or the pointer events) for its own. See the
"gesture states" section below to know more of the latter.
</para>
</refsect2>
<refsect2 id="event-masks">
<title>Event masks</title>
<para>
Each widget instance has a basic event mask and another per input device,
which determine the types of input event it receives. Each event mask set
on a widget is added to the corresponding (basic or per-device) event mask
for the widgets #GdkWindow, and all child #GdkWindows.
</para>
<para>
If a widget is windowless (gtk_widget_get_has_window() returns %FALSE) and
an application wants to receive custom events on it, it must be placed
inside a #GtkEventBox to receive the events, and an appropriate event mask
must be set on the box. When implementing a widget, use a %GDK_INPUT_ONLY
#GdkWindow to receive the events instead.
</para>
<para>
Filtering events against event masks happens inside #GdkWindow, which
exposes event masks to the windowing system to reduce the number of events
GDK receives from it. On receiving an event, it is filtered against the
#GdkWindows mask for the input device, if set. Otherwise, it is filtered
against the #GdkWindows basic event mask.
</para>
<para>
This means that widgets must add to the event mask for each event type
they expect to receive, using gtk_widget_set_events() or
gtk_widget_add_events() to preserve the existing mask. Widgets which are
aware of floating devices should use gtk_widget_set_device_events() or
gtk_widget_add_device_events(), and must explicitly enable the device
using gtk_widget_set_device_enabled(). See the #GdkDeviceManager
documentation for more information.
</para>
<para>
All standard widgets set the event mask for all events they expect to
receive, and it is not necessary to modify this. Masks should be set when
implementing a new widget.
</para>
</refsect2>
<refsect2>
<title>Touch events</title>
<para>
Touch events are emitted as events of type GDK_TOUCH_BEGIN, GDK_TOUCH_UPDATE or
GDK_TOUCH_END, those events contain an “event sequence” that univocally identifies
Touch events are emitted as events of type %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE or
%GDK_TOUCH_END, those events contain an “event sequence” that univocally identifies
the physical touch until it is lifted from the device.
</para>
<para>
On some windowing platforms, multitouch devices perform pointer emulation, this works
by granting a “pointer emulating” hint to one of the currently interacting touch
sequences, which will be reported on every GdkEventTouch event from that sequence. By
default, if a widget didn't request touch events by setting GDK_TOUCH_MASK on its
event mask and didn't override GtkWidget::touch-event, GTK+ will transform these
“pointer emulating” events into semantically similar GdkEventButton and GdkEventMotion
events. Depending on GDK_TOUCH_MASK being in the event mask or not, non-pointer-emulating
sequences, which will be reported on every #GdkEventTouch event from that sequence. By
default, if a widget didn't request touch events by setting %GDK_TOUCH_MASK on its
event mask and didn't override #GtkWidget::touch-event, GTK+ will transform these
“pointer emulating” events into semantically similar #GdkEventButton and #GdkEventMotion
events. Depending on %GDK_TOUCH_MASK being in the event mask or not, non-pointer-emulating
sequences could still trigger gestures or just get filtered out, regardless of the widget
not handling those directly.
</para>
<para>
If the widget sets GDK_TOUCH_MASK on its event mask and doesn't chain up on
GtkWidget::touch-event, only touch events will be received, and no pointer emulation
If the widget sets %GDK_TOUCH_MASK on its event mask and doesn't chain up on
#GtkWidget::touch-event, only touch events will be received, and no pointer emulation
will be performed.
</para>
</refsect2>
@@ -171,11 +258,11 @@
<para>
Grabs are a method to claim all input events from a device, they happen
either implicitly on pointer and touch devices, or explicitly. Implicit grabs
happen on user interaction, when a GdkEventButtonPress happens, all events from
then on, until after the corresponding GdkEventButtonRelease, will be reported
happen on user interaction, when a #GdkEventButtonPress happens, all events from
then on, until after the corresponding #GdkEventButtonRelease, will be reported
to the widget that got the first event. Likewise, on touch events, every
GdkEventSequence will deliver only events to the widget that received its
GDK_TOUCH_BEGIN event.
#GdkEventSequence will deliver only events to the widget that received its
%GDK_TOUCH_BEGIN event.
</para>
<para>
@@ -192,8 +279,8 @@
point somewhere else, even while the pointer/touch device is already grabbed.
This makes it necessary for widgets to handle the cancellation of any ongoing
interaction. Depending on whether a GTK or GDK grab is causing this, the
widget will respectively receive a GtkWidget::grab-notify signal, or a
GdkEventGrabBroken event.
widget will respectively receive a #GtkWidget::grab-notify signal, or a
#GdkEventGrabBroken event.
</para>
<para>
@@ -209,12 +296,12 @@
<!-- mnemonics, accelerators, bindings -->
</refsect2>
<refsect2>
<refsect2 id="event-controllers-and-gestures">
<title>Event controllers and gestures</title>
<para>
Event controllers are standalone objects that can perform specific actions
upon received GdkEvents. These are tied to a GtkWidget, and can be told of
upon received #GdkEvents. These are tied to a #GtkWidget, and can be told of
the event propagation phase at which they will manage the events.
</para>
@@ -270,7 +357,7 @@
Alternatively, or at a later point in time, the widget may choose to deny the touch
sequences, thus letting those go through again in event propagation. When this happens
in the capture phase, and if there are no other claiming gestures in the widget,
a GDK_TOUCH_BEGIN/GDK_BUTTON_PRESS event will be emulated and
a %GDK_TOUCH_BEGIN/%GDK_BUTTON_PRESS event will be emulated and
propagated downwards, in order to preserve consistency.
</para>
+1 -1
View File
@@ -83,7 +83,7 @@
widgets have been deprecated. These deprecations are clearly spelled
out in the API reference, with hints about the recommended replacements.
The API reference for GTK+ 2 also includes an
<ulink url="http://developer.gnome.org/gtk/2.24/api-index-deprecated.html">index</ulink> of all deprecated symbols.
<ulink url="https://developer.gnome.org/gtk2/2.24/api-index-deprecated.html">index</ulink> of all deprecated symbols.
</para>
<para>
To verify that your program does not use any deprecated symbols,
+30 -21
View File
@@ -129,17 +129,15 @@ close_window (void)
gtk_main_quit ();
}
int
main (int argc,
char *argv[])
static void
activate (GtkApplication *app,
gpointer user_data)
{
GtkWidget *window;
GtkWidget *frame;
GtkWidget *da;
GtkWidget *drawing_area;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
@@ -150,35 +148,46 @@ main (int argc,
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (window), frame);
da = gtk_drawing_area_new ();
drawing_area = gtk_drawing_area_new ();
/* set a minimum size */
gtk_widget_set_size_request (da, 100, 100);
gtk_widget_set_size_request (drawing_area, 100, 100);
gtk_container_add (GTK_CONTAINER (frame), da);
gtk_container_add (GTK_CONTAINER (frame), drawing_area);
/* Signals used to handle the backing surface */
g_signal_connect (da, "draw",
g_signal_connect (drawing_area, "draw",
G_CALLBACK (draw_cb), NULL);
g_signal_connect (da,"configure-event",
g_signal_connect (drawing_area,"configure-event",
G_CALLBACK (configure_event_cb), NULL);
/* Event signals */
g_signal_connect (da, "motion-notify-event",
g_signal_connect (drawing_area, "motion-notify-event",
G_CALLBACK (motion_notify_event_cb), NULL);
g_signal_connect (da, "button-press-event",
g_signal_connect (drawing_area, "button-press-event",
G_CALLBACK (button_press_event_cb), NULL);
/* Ask to receive events the drawing area doesn't normally
* subscribe to. In particular, we need to ask for the
* button press and motion notify events that want to handle.
*/
gtk_widget_set_events (da, gtk_widget_get_events (da)
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK);
gtk_widget_set_events (drawing_area, gtk_widget_get_events (drawing_area)
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
+27 -85
View File
@@ -1,8 +1,5 @@
#include <gtk/gtk.h>
/* This is a callback function. The data arguments are ignored
* in this example. More on callbacks below.
*/
static void
print_hello (GtkWidget *widget,
gpointer data)
@@ -10,95 +7,40 @@ print_hello (GtkWidget *widget,
g_print ("Hello World\n");
}
static gboolean
on_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer data)
static void
activate (GtkApplication *app,
gpointer user_data)
{
/* If you return FALSE in the "delete_event" signal handler,
* GTK will emit the "destroy" signal. Returning TRUE means
* you don't want the window to be destroyed.
*
* This is useful for popping up 'are you sure you want to quit?'
* type dialogs.
*/
GtkWidget *window;
GtkWidget *button;
GtkWidget *button_box;
g_print ("delete event occurred\n");
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
return TRUE;
button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (window), button_box);
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
gtk_container_add (GTK_CONTAINER (button_box), button);
gtk_widget_show_all (window);
}
int
main (int argc,
char *argv[])
main (int argc,
char **argv)
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkWidget *button;
GtkApplication *app;
int status;
/* This is called in all GTK applications. Arguments are parsed
* from the command line and are returned to the application.
*/
gtk_init (&argc, &argv);
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
/* create a new window, and set its title */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Hello");
/* When the window emits the "delete-event" signal (which is emitted
* by GTK+ in response to an event coming from the window manager,
* usually as a result of clicking the "close" window control), we
* ask it to call the on_delete_event() function as defined above.
*
* The data passed to the callback function is NULL and is ignored
* in the callback function.
*/
g_signal_connect (window, "delete-event", G_CALLBACK (on_delete_event), NULL);
/* Here we connect the "destroy" event to the gtk_main_quit() function.
*
* This signal is emitted when we call gtk_widget_destroy() on the window,
* or if we return FALSE in the "delete_event" callback.
*/
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Creates a new button with the label "Hello World". */
button = gtk_button_new_with_label ("Hello World");
/* When the button receives the "clicked" signal, it will call the
* function print_hello() passing it NULL as its argument.
*
* The print_hello() function is defined above.
*/
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
/* The g_signal_connect_swapped() function will connect the "clicked" signal
* of the button to the gtk_widget_destroy() function; instead of calling it
* using the button as its argument, it will swap it with the user data
* argument. This will cause the window to be destroyed by calling
* gtk_widget_destroy() on the window.
*/
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
/* This packs the button into the window. A GtkWindow inherits from GtkBin,
* which is a special container that can only have one child
*/
gtk_container_add (GTK_CONTAINER (window), button);
/* The final step is to display this newly created widget... */
gtk_widget_show (button);
/* ... and the window */
gtk_widget_show (window);
/* All GTK applications must have a gtk_main(). Control ends here
* and waits for an event to occur (like a key press or a mouse event),
* until gtk_main_quit() is called.
*/
gtk_main ();
return 0;
return status;
}
+3
View File
@@ -185,6 +185,9 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
int n_channels;
int j;
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
return;
/* This function can't just copy any pixbuf to any surface, be
* sure to read the invariants here before calling it */
+10 -7
View File
@@ -492,6 +492,7 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
int major,
int minor)
{
int version;
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
@@ -505,13 +506,15 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
return;
}
priv->major = MAX (major, 3);
/* we only support versions ≥ 3.2 */
if (priv->major == 3)
priv->minor = MAX (minor, 2);
else
priv->minor = minor;
/* Enforce a minimum context version number of 3.2 */
version = (major * 100) + minor;
if (version < 302)
{
g_warning ("gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported.");
version = 302;
}
priv->major = version / 100;
priv->minor = version % 100;
}
/**
+3
View File
@@ -372,6 +372,9 @@ typedef enum
* Most of these masks map onto one or more of the #GdkEventType event types
* above.
*
* See the [input handling overview][chap-input-handling] for details of
* [event masks][event-masks] and [event propagation][event-propagation].
*
* %GDK_POINTER_MOTION_HINT_MASK is deprecated. It is a special mask
* to reduce the number of %GDK_MOTION_NOTIFY events received. When using
* %GDK_POINTER_MOTION_HINT_MASK, fewer %GDK_MOTION_NOTIFY events will
+12 -5
View File
@@ -1110,6 +1110,9 @@ find_native_sibling_above (GdkWindow *parent,
{
GdkWindow *w;
if (!parent)
return NULL;
w = find_native_sibling_above_helper (parent, child);
if (w)
return w;
@@ -3905,10 +3908,10 @@ gdk_window_process_updates (GdkWindow *window,
{
g_return_if_fail (GDK_IS_WINDOW (window));
return gdk_window_process_updates_with_mode (window,
update_children ?
PROCESS_UPDATES_WITH_ALL_CHILDREN :
PROCESS_UPDATES_NO_RECURSE);
gdk_window_process_updates_with_mode (window,
update_children ?
PROCESS_UPDATES_WITH_ALL_CHILDREN :
PROCESS_UPDATES_NO_RECURSE);
}
static void
@@ -5425,6 +5428,8 @@ gdk_window_withdraw (GdkWindow *window)
* including #GDK_BUTTON_PRESS_MASK means the window should report button
* press events. The event mask is the bitwise OR of values from the
* #GdkEventMask enumeration.
*
* See the [input handling overview][event-masks] for details.
**/
void
gdk_window_set_events (GdkWindow *window,
@@ -5495,6 +5500,8 @@ gdk_window_get_events (GdkWindow *window)
* press events. The event mask is the bitwise OR of values from the
* #GdkEventMask enumeration.
*
* See the [input handling overview][event-masks] for details.
*
* Since: 3.0
**/
void
@@ -11123,7 +11130,7 @@ gdk_window_set_opaque_region (GdkWindow *window,
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (impl_class->set_opaque_region)
return impl_class->set_opaque_region (window, region);
impl_class->set_opaque_region (window, region);
}
/**
+4 -3
View File
@@ -818,7 +818,7 @@ _gdk_quartz_display_create_window_impl (GdkDisplay *display,
impl->view = NULL;
switch (attributes->window_type)
switch (window->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP:
@@ -846,8 +846,9 @@ _gdk_quartz_display_create_window_impl (GdkDisplay *display,
window->width,
window->height);
if (attributes->window_type == GDK_WINDOW_TEMP ||
attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
if (window->window_type == GDK_WINDOW_TEMP ||
((attributes_mask & GDK_WA_TYPE_HINT) &&
attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN))
{
style_mask = NSBorderlessWindowMask;
}
+4 -4
View File
@@ -32,15 +32,15 @@
static char *
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
GAppInfo *info,
GList *files)
{
return NULL;
}
static void
gdk_wayland_app_launch_context_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
gdk_wayland_app_launch_context_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
{
}
+71 -16
View File
@@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -59,6 +59,7 @@ struct _GdkWaylandCursor
} surface;
struct wl_cursor *wl_cursor;
int scale;
};
struct _GdkWaylandCursorClass
@@ -83,10 +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)
{
@@ -105,8 +114,7 @@ set_cursor_from_theme (GdkWaylandCursor *cursor, struct wl_cursor_theme *theme)
}
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;
@@ -115,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
@@ -168,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;
@@ -185,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
@@ -216,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)
{
@@ -232,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;
@@ -247,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);
@@ -255,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);
@@ -272,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. */
@@ -286,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,
+195 -98
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
@@ -254,10 +256,14 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
*/
if (!cursor)
{
/* FIXME: Is this the best sensible default ? */
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;
@@ -282,8 +288,10 @@ gdk_wayland_device_warp (GdkDevice *device,
static void
get_coordinates (GdkWaylandDeviceData *data,
double *x, double *y,
double *x_root, double *y_root)
double *x,
double *y,
double *x_root,
double *y_root)
{
int root_x, root_y;
@@ -357,7 +365,6 @@ gdk_wayland_device_grab (GdkDevice *device,
else
{
/* Device is a pointer */
if (wayland_device->pointer_grab_window != NULL &&
time_ != 0 && wayland_device->pointer_grab_time > time_)
{
@@ -482,7 +489,7 @@ gdk_wayland_device_init (GdkWaylandDevice *device_core)
* gdk_wayland_device_get_wl_seat:
* @device: (type GdkWaylandDevice): a #GdkDevice
*
* Returns the Wayland wl_seat of a #GdkDevice
* Returns the Wayland wl_seat of a #GdkDevice.
*
* Returns: (transfer none): a Wayland wl_seat
*
@@ -491,7 +498,7 @@ gdk_wayland_device_init (GdkWaylandDevice *device_core)
struct wl_seat *
gdk_wayland_device_get_wl_seat (GdkDevice *device)
{
g_return_val_if_fail(GDK_IS_WAYLAND_DEVICE (device), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (device), NULL);
return GDK_WAYLAND_DEVICE (device)->device->wl_seat;
}
@@ -500,7 +507,7 @@ gdk_wayland_device_get_wl_seat (GdkDevice *device)
* gdk_wayland_device_get_wl_pointer:
* @device: (type GdkWaylandDevice): a #GdkDevice
*
* Returns the Wayland wl_pointer of a #GdkDevice
* Returns the Wayland wl_pointer of a #GdkDevice.
*
* Returns: (transfer none): a Wayland wl_pointer
*
@@ -509,7 +516,7 @@ gdk_wayland_device_get_wl_seat (GdkDevice *device)
struct wl_pointer *
gdk_wayland_device_get_wl_pointer (GdkDevice *device)
{
g_return_val_if_fail(GDK_IS_WAYLAND_DEVICE (device), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (device), NULL);
return GDK_WAYLAND_DEVICE (device)->device->wl_pointer;
}
@@ -518,7 +525,7 @@ gdk_wayland_device_get_wl_pointer (GdkDevice *device)
* gdk_wayland_device_get_wl_keyboard:
* @device: (type GdkWaylandDevice): a #GdkDevice
*
* Returns the Wayland wl_keyboard of a #GdkDevice
* Returns the Wayland wl_keyboard of a #GdkDevice.
*
* Returns: (transfer none): a Wayland wl_keyboard
*
@@ -527,7 +534,7 @@ gdk_wayland_device_get_wl_pointer (GdkDevice *device)
struct wl_keyboard *
gdk_wayland_device_get_wl_keyboard (GdkDevice *device)
{
g_return_val_if_fail(GDK_IS_WAYLAND_DEVICE (device), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (device), NULL);
return GDK_WAYLAND_DEVICE (device)->device->wl_keyboard;
}
@@ -574,11 +581,15 @@ emit_selection_owner_change_forall (GdkAtom atom)
static void
data_device_data_offer (void *data,
struct wl_data_device *data_device,
struct wl_data_offer *_offer)
struct wl_data_offer *offer)
{
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *)data;
gdk_wayland_selection_set_offer (device->display, _offer);
GDK_NOTE (EVENTS,
g_message ("data device data offer, data device %p, offer %p",
data_device, offer));
gdk_wayland_selection_set_offer (device->display, offer);
emit_selection_owner_change_forall (gdk_atom_intern_static_string ("GdkWaylandSelection"));
}
@@ -599,8 +610,9 @@ data_device_enter (void *data,
if (!GDK_IS_WINDOW (dest_window))
return;
g_debug (G_STRLOC ": %s data_device = %p serial = %u, surface = %p, x = %d y = %d, offer = %p",
G_STRFUNC, data_device, serial, surface, x, y, offer);
GDK_NOTE (EVENTS,
g_message ("data device enter, data device %p serial %u, surface %p, x %d y %d, offer %p",
data_device, serial, surface, x, y, offer));
/* Update pointer state, so device state queries work during DnD */
device->pointer_focus = g_object_ref (dest_window);
@@ -632,8 +644,8 @@ data_device_leave (void *data,
{
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *) data;
g_debug (G_STRLOC ": %s data_device = %p",
G_STRFUNC, data_device);
GDK_NOTE (EVENTS,
g_message ("data device leave, data device %p", data_device));
if (!gdk_drag_context_get_dest_window (device->drop_context))
return;
@@ -680,8 +692,8 @@ data_device_drop (void *data,
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *) data;
GdkWindow *local_dnd_owner;
g_debug (G_STRLOC ": %s data_device = %p",
G_STRFUNC, data_device);
GDK_NOTE (EVENTS,
g_message ("data device drop, data device %p", data_device));
local_dnd_owner = gdk_selection_owner_get_for_display (device->display, gdk_drag_get_selection (device->drop_context));
@@ -704,8 +716,9 @@ data_device_selection (void *data,
{
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *) data;
g_debug (G_STRLOC ": %s wl_data_device = %p wl_data_offer = %p",
G_STRFUNC, wl_data_device, offer);
GDK_NOTE (EVENTS,
g_message ("data device selection, data device %p, data offer %p",
wl_data_device, offer));
gdk_wayland_selection_set_offer (device->display, offer);
emit_selection_owner_change_forall (gdk_atom_intern_static_string ("CLIPBOARD"));
@@ -735,6 +748,7 @@ pointer_handle_enter (void *data,
if (!surface)
return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return;
@@ -781,13 +795,14 @@ pointer_handle_leave (void *data,
{
GdkWaylandDeviceData *device = data;
GdkEvent *event;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return;
if (!device->pointer_focus)
return;
@@ -818,7 +833,7 @@ pointer_handle_leave (void *data,
g_message ("leave, device %p surface %p",
device, device->pointer_focus));
g_object_unref(device->pointer_focus);
g_object_unref (device->pointer_focus);
if (device->cursor)
gdk_wayland_device_stop_window_cursor_animation (device);
@@ -862,8 +877,8 @@ pointer_handle_motion (void *data,
&event->motion.y_root);
GDK_NOTE (EVENTS,
g_message ("motion %d %d, state %d",
sx, sy, event->button.state));
g_message ("motion %d %d, device %p state %d",
sx, sy, device, event->button.state));
_gdk_wayland_display_deliver_event (device->display, event);
}
@@ -881,25 +896,24 @@ pointer_handle_button (void *data,
GdkEvent *event;
uint32_t modifier;
int gdk_button;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
if (!device->pointer_focus)
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_display_update_serial (display, serial);
switch (button) {
case 273:
gdk_button = 3;
break;
case 274:
gdk_button = 2;
break;
default:
gdk_button = button - 271;
break;
}
switch (button)
{
case 273:
gdk_button = 3;
break;
case 274:
gdk_button = 2;
break;
default:
gdk_button = button - 271;
break;
}
device->time = time;
if (state)
@@ -928,9 +942,11 @@ pointer_handle_button (void *data,
device->modifiers &= ~modifier;
GDK_NOTE (EVENTS,
g_message ("button %d %s, state %d",
g_message ("button %d %s, device %p state %d",
event->button.button,
state ? "press" : "release", event->button.state));
state ? "press" : "release",
device,
event->button.state));
_gdk_wayland_display_deliver_event (device->display, event);
}
@@ -951,18 +967,19 @@ pointer_handle_axis (void *data,
return;
/* get the delta and convert it into the expected range */
switch (axis) {
case WL_POINTER_AXIS_VERTICAL_SCROLL:
delta_x = 0;
delta_y = wl_fixed_to_double (value) / 10.0;
break;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
delta_x = wl_fixed_to_double (value) / 10.0;
delta_y = 0;
break;
default:
g_return_if_reached ();
}
switch (axis)
{
case WL_POINTER_AXIS_VERTICAL_SCROLL:
delta_x = 0;
delta_y = wl_fixed_to_double (value) / 10.0;
break;
case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
delta_x = wl_fixed_to_double (value) / 10.0;
delta_y = 0;
break;
default:
g_return_if_reached ();
}
device->time = time;
event = gdk_event_new (GDK_SCROLL);
@@ -983,8 +1000,8 @@ pointer_handle_axis (void *data,
&event->scroll.y_root);
GDK_NOTE (EVENTS,
g_message ("scroll %f %f",
event->scroll.delta_x, event->scroll.delta_y));
g_message ("scroll %f %f, device %p",
event->scroll.delta_x, event->scroll.delta_y, device));
_gdk_wayland_display_deliver_event (device->display, event);
}
@@ -1014,18 +1031,18 @@ keyboard_handle_enter (void *data,
{
GdkWaylandDeviceData *device = data;
GdkEvent *event;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_display_update_serial (display, serial);
device->keyboard_focus = wl_surface_get_user_data(surface);
g_object_ref(device->keyboard_focus);
device->keyboard_focus = wl_surface_get_user_data (surface);
g_object_ref (device->keyboard_focus);
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (device->keyboard_focus);
@@ -1035,7 +1052,7 @@ keyboard_handle_enter (void *data,
gdk_event_set_source_device (event, device->keyboard);
GDK_NOTE (EVENTS,
g_message ("focus int, device %p surface %p",
g_message ("focus in, device %p surface %p",
device, device->keyboard_focus));
_gdk_wayland_display_deliver_event (device->display, event);
@@ -1049,17 +1066,18 @@ keyboard_handle_leave (void *data,
{
GdkWaylandDeviceData *device = data;
GdkEvent *event;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
if (!surface)
return;
if (!GDK_IS_WINDOW (wl_surface_get_user_data (surface)))
return;
if (!device->keyboard_focus)
return;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_display_update_serial (display, serial);
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (device->keyboard_focus);
@@ -1068,7 +1086,7 @@ keyboard_handle_leave (void *data,
gdk_event_set_device (event, device->master_keyboard);
gdk_event_set_source_device (event, device->keyboard);
g_object_unref(device->keyboard_focus);
g_object_unref (device->keyboard_focus);
device->keyboard_focus = NULL;
GDK_NOTE (EVENTS,
@@ -1078,8 +1096,7 @@ keyboard_handle_leave (void *data,
_gdk_wayland_display_deliver_event (device->display, event);
}
static gboolean
keyboard_repeat (gpointer data);
static gboolean keyboard_repeat (gpointer data);
static void
translate_keyboard_string (GdkEventKey *event)
@@ -1100,11 +1117,11 @@ translate_keyboard_string (GdkEventKey *event)
gsize bytes_written;
gint len;
/* Apply the control key - Taken from Xlib
*/
/* Apply the control key - Taken from Xlib */
if (event->state & GDK_CONTROL_MASK)
{
if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
if ((c >= '@' && c < '\177') || c == ' ')
c &= 0x1F;
else if (c == '2')
{
event->string = g_memdup ("\0\0", 2);
@@ -1112,9 +1129,12 @@ translate_keyboard_string (GdkEventKey *event)
buf[0] = '\0';
return;
}
else if (c >= '3' && c <= '7') c -= ('3' - '\033');
else if (c == '8') c = '\177';
else if (c == '/') c = '_' & 0x1F;
else if (c >= '3' && c <= '7')
c -= ('3' - '\033');
else if (c == '8')
c = '\177';
else if (c == '/')
c = '_' & 0x1F;
}
len = g_unichar_to_utf8 (c, buf);
@@ -1277,7 +1297,6 @@ deliver_key_event (GdkWaylandDeviceData *device,
g_source_remove (device->repeat_timer);
device->repeat_timer = 0;
}
device->repeat_timer =
gdk_threads_add_timeout (delay, keyboard_repeat, device);
g_source_set_name_by_id (device->repeat_timer, "[gtk+] keyboard_repeat");
@@ -1310,14 +1329,13 @@ keyboard_handle_key (void *data,
uint32_t state_w)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
if (!device->keyboard_focus)
return;
device->repeat_count = 0;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_display_update_serial (display, serial);
deliver_key_event (data, time, key + 8, state_w);
}
@@ -1439,12 +1457,11 @@ touch_handle_down (void *data,
wl_fixed_t y)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandTouchData *touch;
GdkEvent *event;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_device_add_touch (device, id, wl_surface);
touch->x = wl_fixed_to_double (x);
@@ -1467,12 +1484,11 @@ touch_handle_up (void *data,
int32_t id)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (device->display);
GdkWaylandTouchData *touch;
GdkEvent *event;
_gdk_wayland_display_update_serial (wayland_display, serial);
_gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_device_get_touch (device, id);
event = _create_touch_event (device, touch, GDK_TOUCH_END, time);
@@ -1568,8 +1584,13 @@ seat_handle_capabilities (void *data,
enum wl_seat_capability caps)
{
GdkWaylandDeviceData *device = data;
GdkWaylandDeviceManager *device_manager =
GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
GDK_NOTE (MISC,
g_message ("seat %p with %s%s%s", seat,
(caps & WL_SEAT_CAPABILITY_POINTER) ? " pointer, " : "",
(caps & WL_SEAT_CAPABILITY_KEYBOARD) ? " keyboard, " : "",
(caps & WL_SEAT_CAPABILITY_TOUCH) ? " touch" : ""));
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !device->wl_pointer)
{
@@ -1689,11 +1710,13 @@ seat_handle_capabilities (void *data,
}
static void
seat_handle_name (void *data,
struct wl_seat *seat,
const char *name)
seat_handle_name (void *data,
struct wl_seat *seat,
const char *name)
{
/* We don't care about the name. */
GDK_NOTE (MISC,
g_message ("seat %p name %s", seat, name));
}
static const struct wl_seat_listener seat_listener = {
@@ -1704,8 +1727,7 @@ static const struct wl_seat_listener seat_listener = {
static void
init_devices (GdkWaylandDeviceData *device)
{
GdkWaylandDeviceManager *device_manager =
GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (device->device_manager);
/* pointer */
device->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
@@ -1744,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,
@@ -1774,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);
}
@@ -1832,7 +1930,7 @@ gdk_wayland_device_manager_list_devices (GdkDeviceManager *device_manager,
GdkWaylandDeviceManager *wayland_device_manager;
GList *devices = NULL, *l;
wayland_device_manager = (GdkWaylandDeviceManager *) device_manager;
wayland_device_manager = GDK_WAYLAND_DEVICE_MANAGER (device_manager);
for (l = wayland_device_manager->devices; l; l = l->next)
{
@@ -1849,7 +1947,7 @@ gdk_wayland_device_manager_get_client_pointer (GdkDeviceManager *device_manager)
GdkWaylandDeviceManager *wayland_device_manager;
GList *l;
wayland_device_manager = (GdkWaylandDeviceManager *) device_manager;
wayland_device_manager = GDK_WAYLAND_DEVICE_MANAGER (device_manager);
/* Find the first master pointer device */
for (l = wayland_device_manager->devices; l != NULL; l = l->next)
@@ -1943,6 +2041,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
GdkWaylandDeviceData *device;
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
device = GDK_WAYLAND_DEVICE (gdk_device)->device;
gdk_wayland_device_remove_touch (device, GDK_EVENT_SEQUENCE_TO_SLOT (sequence));
@@ -1953,12 +2052,9 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
struct wl_data_device *
gdk_wayland_device_get_data_device (GdkDevice *gdk_device)
{
GdkWaylandDeviceData *device;
g_return_val_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device), NULL);
device = GDK_WAYLAND_DEVICE (gdk_device)->device;
return device->data_device;
return GDK_WAYLAND_DEVICE (gdk_device)->device->data_device;
}
void
@@ -1969,6 +2065,7 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
GdkWaylandDisplay *display_wayland;
g_return_if_fail (GDK_IS_WAYLAND_DEVICE (gdk_device));
device = GDK_WAYLAND_DEVICE (gdk_device)->device;
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (gdk_device));
+143 -72
View File
@@ -132,6 +132,9 @@ xdg_shell_ping (void *data,
_gdk_wayland_display_update_serial (wayland_display, serial);
GDK_NOTE (EVENTS,
g_message ("ping, shell %p, serial %u\n", xdg_shell, serial));
xdg_shell_pong (xdg_shell, serial);
}
@@ -140,59 +143,83 @@ static const struct xdg_shell_listener xdg_shell_listener = {
};
static void
gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
gdk_registry_handle_global (void *data,
struct wl_registry *registry,
uint32_t id,
const char *interface,
uint32_t version)
{
GdkWaylandDisplay *display_wayland = data;
GdkDisplay *gdk_display = GDK_DISPLAY_OBJECT (data);
struct wl_seat *seat;
struct wl_output *output;
if (strcmp(interface, "wl_compositor") == 0) {
display_wayland->compositor =
wl_registry_bind(display_wayland->wl_registry, id, &wl_compositor_interface, MIN (version, 3));
display_wayland->compositor_version = MIN (version, 3);
} else if (strcmp(interface, "wl_shm") == 0) {
display_wayland->shm =
wl_registry_bind(display_wayland->wl_registry, id, &wl_shm_interface, 1);
GDK_NOTE (MISC,
g_message ("add global %u, interface %s, version %u", id, interface, version));
/* SHM interface is prerequisite */
_gdk_wayland_display_load_cursor_theme(display_wayland);
} else if (strcmp(interface, "xdg_shell") == 0) {
display_wayland->xdg_shell =
wl_registry_bind(display_wayland->wl_registry, id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version(display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT);
xdg_shell_add_listener(display_wayland->xdg_shell, &xdg_shell_listener, display_wayland);
} else if (strcmp(interface, "gtk_shell") == 0) {
display_wayland->gtk_shell =
wl_registry_bind(display_wayland->wl_registry, id, &gtk_shell_interface, 1);
_gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
} else if (strcmp(interface, "wl_output") == 0) {
output =
wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2));
_gdk_wayland_screen_add_output(display_wayland->screen, id, output, MIN (version, 2));
} else if (strcmp(interface, "wl_seat") == 0) {
seat = wl_registry_bind(display_wayland->wl_registry, id, &wl_seat_interface, MIN (version, 4));
_gdk_wayland_device_manager_add_seat (gdk_display->device_manager, id, seat);
} else if (strcmp(interface, "wl_data_device_manager") == 0) {
if (strcmp (interface, "wl_compositor") == 0)
{
display_wayland->compositor =
wl_registry_bind (display_wayland->wl_registry, id, &wl_compositor_interface, MIN (version, 3));
display_wayland->compositor_version = MIN (version, 3);
}
else if (strcmp (interface, "wl_shm") == 0)
{
display_wayland->shm =
wl_registry_bind (display_wayland->wl_registry, id, &wl_shm_interface, 1);
/* SHM interface is prerequisite */
_gdk_wayland_display_load_cursor_theme (display_wayland);
}
else if (strcmp (interface, "xdg_shell") == 0)
{
display_wayland->xdg_shell =
wl_registry_bind (display_wayland->wl_registry, id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version (display_wayland->xdg_shell, XDG_SHELL_VERSION_CURRENT);
xdg_shell_add_listener (display_wayland->xdg_shell, &xdg_shell_listener, display_wayland);
}
else if (strcmp (interface, "gtk_shell") == 0)
{
if (version == SUPPORTED_GTK_SHELL_VERSION)
{
display_wayland->gtk_shell =
wl_registry_bind(display_wayland->wl_registry, id,
&gtk_shell_interface, SUPPORTED_GTK_SHELL_VERSION);
_gdk_wayland_screen_set_has_gtk_shell (display_wayland->screen);
}
}
else if (strcmp (interface, "wl_output") == 0)
{
output =
wl_registry_bind (display_wayland->wl_registry, id, &wl_output_interface, MIN (version, 2));
_gdk_wayland_screen_add_output (display_wayland->screen, id, output, MIN (version, 2));
}
else if (strcmp (interface, "wl_seat") == 0)
{
seat = wl_registry_bind (display_wayland->wl_registry, id, &wl_seat_interface, MIN (version, 4));
_gdk_wayland_device_manager_add_seat (gdk_display->device_manager, id, seat);
}
else if (strcmp (interface, "wl_data_device_manager") == 0)
{
display_wayland->data_device_manager =
wl_registry_bind(display_wayland->wl_registry, id,
&wl_data_device_manager_interface, 1);
} else if (strcmp (interface, "wl_subcompositor") == 0) {
display_wayland->subcompositor =
wl_registry_bind (display_wayland->wl_registry, id,
&wl_subcompositor_interface, 1);
}
wl_registry_bind (display_wayland->wl_registry, id, &wl_data_device_manager_interface, 1);
}
else if (strcmp (interface, "wl_subcompositor") == 0)
{
display_wayland->subcompositor =
wl_registry_bind (display_wayland->wl_registry, id, &wl_subcompositor_interface, 1);
}
}
static void
gdk_registry_handle_global_remove(void *data,
struct wl_registry *registry,
uint32_t id)
gdk_registry_handle_global_remove (void *data,
struct wl_registry *registry,
uint32_t id)
{
GdkWaylandDisplay *display_wayland = data;
GdkDisplay *display = GDK_DISPLAY (display_wayland);
GDK_NOTE (MISC, g_message ("remove global %u", id));
_gdk_wayland_device_manager_remove_seat (display->device_manager, id);
_gdk_wayland_screen_remove_output (display_wayland->screen, id);
@@ -205,7 +232,7 @@ static const struct wl_registry_listener registry_listener = {
};
static void
log_handler(const char *format, va_list args)
log_handler (const char *format, va_list args)
{
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
}
@@ -217,6 +244,8 @@ _gdk_wayland_display_open (const gchar *display_name)
GdkDisplay *display;
GdkWaylandDisplay *display_wayland;
GDK_NOTE (MISC, g_message ("opening display %s", display_name ? display_name : ""));
/* If this variable is unset then wayland initialisation will surely
* fail, logging a fatal error in the process. Save ourselves from
* that.
@@ -224,9 +253,9 @@ _gdk_wayland_display_open (const gchar *display_name)
if (g_getenv ("XDG_RUNTIME_DIR") == NULL)
return NULL;
wl_log_set_handler_client(log_handler);
wl_log_set_handler_client (log_handler);
wl_display = wl_display_connect(display_name);
wl_display = wl_display_connect (display_name);
if (!wl_display)
return NULL;
@@ -239,8 +268,8 @@ _gdk_wayland_display_open (const gchar *display_name)
display_wayland->event_source = _gdk_wayland_display_event_source_new (display);
_gdk_wayland_display_init_cursors (display_wayland);
display_wayland->wl_registry = wl_display_get_registry(display_wayland->wl_display);
wl_registry_add_listener(display_wayland->wl_registry, &registry_listener, display_wayland);
display_wayland->wl_registry = wl_display_get_registry (display_wayland->wl_display);
wl_registry_add_listener (display_wayland->wl_registry, &registry_listener, display_wayland);
/* Wait until the dust has settled during init... */
wl_display_roundtrip (display_wayland->wl_display);
@@ -326,7 +355,7 @@ gdk_wayland_display_sync (GdkDisplay *display)
display_wayland = GDK_WAYLAND_DISPLAY (display);
wl_display_roundtrip(display_wayland->wl_display);
wl_display_roundtrip (display_wayland->wl_display);
}
static void
@@ -335,7 +364,7 @@ gdk_wayland_display_flush (GdkDisplay *display)
g_return_if_fail (GDK_IS_DISPLAY (display));
if (!display->closed)
wl_display_flush(GDK_WAYLAND_DISPLAY (display)->wl_display);
wl_display_flush (GDK_WAYLAND_DISPLAY (display)->wl_display);
}
static gboolean
@@ -485,7 +514,7 @@ gdk_wayland_display_pop_error_trap (GdkDisplay *display,
}
static void
gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
@@ -550,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)
{
@@ -561,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
@@ -591,8 +663,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display)
else
name = "default";
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (wayland_display),
name, size);
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (wayland_display), name, size);
g_value_unset (&v);
}
@@ -610,30 +681,28 @@ _gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display,
}
/**
* gdk_wayland_display_get_wl_display
* gdk_wayland_display_get_wl_display:
* @display: (type GdkWaylandDisplay): a #GdkDisplay
*
* Returns the Wayland wl_display of a #GdkDisplay
* Returns the Wayland wl_display of a #GdkDisplay.
*
* Returns: (transfer none): a Wayland wl_display
*
* Since: 3.8
*/
struct wl_display *
gdk_wayland_display_get_wl_display(GdkDisplay *display)
gdk_wayland_display_get_wl_display (GdkDisplay *display)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL);
return wayland_display->wl_display;
return GDK_WAYLAND_DISPLAY (display)->wl_display;
}
/**
* gdk_wayland_display_get_wl_compositor
* gdk_wayland_display_get_wl_compositor:
* @display: (type GdkWaylandDisplay): a #GdkDisplay
*
* Returns the Wayland global singleton compositor of a #GdkDisplay
* Returns the Wayland global singleton compositor of a #GdkDisplay.
*
* Returns: (transfer none): a Wayland wl_compositor
*
@@ -642,18 +711,16 @@ gdk_wayland_display_get_wl_display(GdkDisplay *display)
struct wl_compositor *
gdk_wayland_display_get_wl_compositor (GdkDisplay *display)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL);
return wayland_display->compositor;
return GDK_WAYLAND_DISPLAY (display)->compositor;
}
/**
* gdk_wayland_display_get_xdg_shell
* gdk_wayland_display_get_xdg_shell:
* @display: (type GdkWaylandDisplay): a #GdkDisplay
*
* Returns the Wayland global singleton shell of a #GdkDisplay
* Returns the Wayland global singleton shell of a #GdkDisplay.
*
* Returns: (transfer none): a Wayland xdg_shell
*
@@ -662,11 +729,9 @@ gdk_wayland_display_get_wl_compositor (GdkDisplay *display)
struct xdg_shell *
gdk_wayland_display_get_xdg_shell (GdkDisplay *display)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY(display), NULL);
return wayland_display->xdg_shell;
return GDK_WAYLAND_DISPLAY (display)->xdg_shell;
}
static const cairo_user_data_key_t gdk_wayland_cairo_key;
@@ -737,7 +802,7 @@ create_shm_pool (struct wl_shm *shm,
return NULL;
}
pool = wl_shm_create_pool(shm, fd, size);
pool = wl_shm_create_pool (shm, fd, size);
close (fd);
@@ -834,6 +899,12 @@ _gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface)
return data->busy;
}
gboolean
_gdk_wayland_is_shm_surface (cairo_surface_t *surface)
{
return cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key) != NULL;
}
GdkWaylandSelection *
gdk_wayland_display_get_selection (GdkDisplay *display)
{
+9 -4
View File
@@ -1,7 +1,7 @@
/*
* gdkdisplay-wayland.h
*
* Copyright 2001 Sun Microsystems Inc.
*
* Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede <erwann.chenede@sun.com>
*
@@ -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;
@@ -99,4 +104,4 @@ struct _GdkWaylandDisplayClass
G_END_DECLS
#endif /* __GDK_WAYLAND_DISPLAY__ */
#endif /* __GDK_WAYLAND_DISPLAY__ */
+5 -1
View File
@@ -382,7 +382,11 @@ _gdk_wayland_drop_context_new (GdkDevice *device,
void
gdk_wayland_drop_context_update_targets (GdkDragContext *context)
{
GdkDisplay *display = gdk_window_get_display (context->source_window);
GdkDisplay *display;
GdkDevice *device;
device = gdk_drag_context_get_device (context);
display = gdk_device_get_display (device);
g_list_free (context->targets);
context->targets = g_list_copy (gdk_wayland_selection_get_targets (display));
}
+18 -9
View File
@@ -20,6 +20,7 @@
#include "gdkinternals.h"
#include "gdkprivate-wayland.h"
#include <stdlib.h>
#include <errno.h>
typedef struct _GdkWaylandEventSource {
@@ -32,7 +33,8 @@ typedef struct _GdkWaylandEventSource {
static GList *event_sources = NULL;
static gboolean
gdk_event_source_prepare(GSource *base, gint *timeout)
gdk_event_source_prepare (GSource *base,
gint *timeout)
{
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
GdkWaylandDisplay *display = (GdkWaylandDisplay *) source->display;
@@ -59,7 +61,7 @@ gdk_event_source_prepare(GSource *base, gint *timeout)
}
static gboolean
gdk_event_source_check(GSource *base)
gdk_event_source_check (GSource *base)
{
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
@@ -71,9 +73,9 @@ gdk_event_source_check(GSource *base)
}
static gboolean
gdk_event_source_dispatch(GSource *base,
GSourceFunc callback,
gpointer data)
gdk_event_source_dispatch (GSource *base,
GSourceFunc callback,
gpointer data)
{
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
GdkDisplay *display = source->display;
@@ -109,7 +111,8 @@ static GSourceFuncs wl_glib_source_funcs = {
};
void
_gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event)
_gdk_wayland_display_deliver_event (GdkDisplay *display,
GdkEvent *event)
{
GList *node;
@@ -160,11 +163,17 @@ _gdk_wayland_display_queue_events (GdkDisplay *display)
if (source->pfd.revents & G_IO_IN)
{
if (wl_display_dispatch (display_wayland->wl_display) < 0)
g_error ("Error dispatching display: %s", g_strerror (errno));
{
g_warning ("Error %d (%s) dispatching to Wayland display.",
errno, g_strerror (errno));
exit (1);
}
}
if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
g_error ("Lost connection to wayland compositor");
{
g_warning ("Lost connection to Wayland compositor.");
exit (1);
}
source->pfd.revents = 0;
}
+4 -3
View File
@@ -95,7 +95,8 @@ gdk_wayland_window_invalidate_for_new_frame (GdkWindow *window,
window_rect.height = gdk_window_get_height (window);
/* If nothing else is known, repaint everything so that the back
buffer is fully up-to-date for the swapbuffer */
* buffer is fully up-to-date for the swapbuffer
*/
cairo_region_union_rectangle (update_area, &window_rect);
}
}
@@ -165,7 +166,7 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
}
static void
gdk_wayland_gl_context_end_frame (GdkGLContext *context,
gdk_wayland_gl_context_end_frame (GdkGLContext *context,
cairo_region_t *painted,
cairo_region_t *damage)
{
@@ -180,7 +181,7 @@ gdk_wayland_gl_context_end_frame (GdkGLContext *context,
egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window,
context_wayland->egl_config);
// TODO: Use eglSwapBuffersWithDamageEXT if available
/* TODO: Use eglSwapBuffersWithDamageEXT if available */
if (display_wayland->have_egl_swap_buffers_with_damage)
{
int i, j, n_rects = cairo_region_num_rectangles (damage);
+9 -7
View File
@@ -250,7 +250,7 @@ get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
if (state & GDK_MOD1_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
if (state & GDK_MOD2_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2");
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_NUM);
if (state & GDK_MOD3_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3");
if (state & GDK_MOD4_MASK)
@@ -275,7 +275,7 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
state |= GDK_CONTROL_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
state |= GDK_MOD1_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2")))
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_NUM)))
state |= GDK_MOD2_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3")))
state |= GDK_MOD3_MASK;
@@ -457,7 +457,7 @@ update_direction (GdkWaylandKeymap *keymap)
}
GdkKeymap *
_gdk_wayland_keymap_new ()
_gdk_wayland_keymap_new (void)
{
GdkWaylandKeymap *keymap;
struct xkb_context *context;
@@ -494,12 +494,12 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
context = xkb_context_new (0);
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
map_str = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED)
{
close(fd);
return;
}
}
xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0);
munmap (map_str, size);
@@ -523,12 +523,14 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
update_direction (keymap_wayland);
}
struct xkb_keymap *_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap)
struct xkb_keymap *
_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap)
{
return GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
}
struct xkb_state *_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap)
struct xkb_state *
_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap)
{
return GDK_WAYLAND_KEYMAP (keymap)->xkb_state;
}
+17 -4
View File
@@ -19,11 +19,11 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
/*
* Private uninstalled header defining things local to X windowing code
* Private uninstalled header defining things local to the Wayland backend
*/
#ifndef __GDK_PRIVATE_WAYLAND_H__
@@ -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);
@@ -219,6 +231,7 @@ cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *di
struct wl_buffer *_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface);
void _gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface);
gboolean _gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface);
gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface);
GdkWaylandSelection * gdk_wayland_display_get_selection (GdkDisplay *display);
GdkWaylandSelection * gdk_wayland_selection_new (void);
+55 -41
View File
@@ -223,7 +223,9 @@ gdk_wayland_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num);
GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return monitor->width_mm;
}
@@ -233,7 +235,9 @@ gdk_wayland_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num);
GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return monitor->height_mm;
}
@@ -243,7 +247,9 @@ gdk_wayland_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num);
GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return g_strdup (monitor->output_name);
}
@@ -254,7 +260,9 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
GdkRectangle *dest)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num);
GdkWaylandMonitor *monitor;
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
if (dest)
*dest = monitor->geometry;
@@ -267,10 +275,7 @@ gdk_wayland_screen_get_monitor_scale_factor (GdkScreen *screen,
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor;
if (monitor_num >= screen_wayland->monitors->len)
return 1;
monitor = g_ptr_array_index(screen_wayland->monitors, monitor_num);
monitor = g_ptr_array_index (screen_wayland->monitors, monitor_num);
return monitor->scale;
}
@@ -358,17 +363,17 @@ typedef enum
static gdouble
get_dpi_from_gsettings (GdkWaylandScreen *screen_wayland)
{
GSettings *interface_settings;
gdouble factor;
GSettings *settings;
gdouble factor;
interface_settings = g_hash_table_lookup (screen_wayland->settings,
"org.gnome.desktop.interface");
if (interface_settings != NULL)
factor = g_settings_get_double (interface_settings, "text-scaling-factor");
else
factor = 1.0;
settings = g_hash_table_lookup (screen_wayland->settings,
"org.gnome.desktop.interface");
if (settings != NULL)
factor = g_settings_get_double (settings, "text-scaling-factor");
else
factor = 1.0;
return 96.0 * factor;
return 96.0 * factor;
}
static void
@@ -547,7 +552,8 @@ static TranslationEntry translations[] = {
};
static TranslationEntry *
find_translation_entry_by_key (GSettings *settings, const gchar *key)
find_translation_entry_by_key (GSettings *settings,
const gchar *key)
{
guint i;
gchar *schema;
@@ -750,8 +756,8 @@ set_decoration_layout_from_entry (GdkScreen *screen,
static gboolean
set_capability_setting (GdkScreen *screen,
GValue *value,
enum gtk_shell_capability test)
GValue *value,
enum gtk_shell_capability test)
{
GdkWaylandScreen *wayland_screen = GDK_WAYLAND_SCREEN (screen);
@@ -762,8 +768,8 @@ set_capability_setting (GdkScreen *screen,
static gboolean
gdk_wayland_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value)
const gchar *name,
GValue *value)
{
TranslationEntry *entry;
@@ -1017,11 +1023,16 @@ update_screen_size (GdkWaylandScreen *screen_wayland)
}
static void
output_handle_geometry(void *data,
struct wl_output *wl_output,
int x, int y, int physical_width, int physical_height,
int subpixel, const char *make, const char *model,
int32_t transform)
output_handle_geometry (void *data,
struct wl_output *wl_output,
int x,
int y,
int physical_width,
int physical_height,
int subpixel,
const char *make,
const char *model,
int32_t transform)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@@ -1042,8 +1053,8 @@ output_handle_geometry(void *data,
}
static void
output_handle_done(void *data,
struct wl_output *wl_output)
output_handle_done (void *data,
struct wl_output *wl_output)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@@ -1052,9 +1063,9 @@ output_handle_done(void *data,
}
static void
output_handle_scale(void *data,
struct wl_output *wl_output,
int32_t factor)
output_handle_scale (void *data,
struct wl_output *wl_output,
int32_t factor)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@@ -1063,12 +1074,12 @@ output_handle_scale(void *data,
}
static void
output_handle_mode(void *data,
struct wl_output *wl_output,
uint32_t flags,
int width,
int height,
int refresh)
output_handle_mode (void *data,
struct wl_output *wl_output,
uint32_t flags,
int width,
int height,
int refresh)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
@@ -1101,16 +1112,19 @@ _gdk_wayland_screen_add_output (GdkScreen *screen,
guint32 version)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_new0(GdkWaylandMonitor, 1);
GdkWaylandMonitor *monitor;
monitor = g_new0 (GdkWaylandMonitor, 1);
monitor->id = id;
monitor->output = output;
monitor->version = version;
monitor->screen = screen_wayland;
monitor->scale = 1;
g_ptr_array_add(screen_wayland->monitors, monitor);
wl_output_add_listener(output, &output_listener, monitor);
g_ptr_array_add (screen_wayland->monitors, monitor);
wl_output_add_listener (output, &output_listener, monitor);
}
void
+54 -44
View File
@@ -64,7 +64,8 @@ struct _DataSourceData
GdkAtom selection;
};
struct _AsyncWriteData {
struct _AsyncWriteData
{
GOutputStream *stream;
GdkWaylandSelection *selection;
gsize index;
@@ -268,8 +269,9 @@ gdk_wayland_selection_new (void)
atoms[ATOM_DND] = gdk_atom_intern_static_string ("GdkWaylandSelection");
selection = g_new0 (GdkWaylandSelection, 1);
selection->selection_buffers = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) selection_buffer_cancel_and_unref);
selection->selection_buffers =
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) selection_buffer_cancel_and_unref);
return selection;
}
@@ -414,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;
}
@@ -556,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)
@@ -666,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 = {
@@ -742,7 +749,8 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner,
}
void
gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection)
gdk_wayland_selection_unset_data_source (GdkDisplay *display,
GdkAtom selection)
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
@@ -772,7 +780,7 @@ gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection)
GdkWindow *
_gdk_wayland_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection)
GdkAtom selection)
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
@@ -786,10 +794,10 @@ _gdk_wayland_display_get_selection_owner (GdkDisplay *display,
gboolean
_gdk_wayland_display_set_selection_owner (GdkDisplay *display,
GdkWindow *owner,
GdkAtom selection,
guint32 time,
gboolean send_event)
GdkWindow *owner,
GdkAtom selection,
guint32 time,
gboolean send_event)
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
@@ -809,20 +817,20 @@ _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
void
_gdk_wayland_display_send_selection_notify (GdkDisplay *dispay,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
{
}
gint
_gdk_wayland_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format)
{
SelectionBuffer *buffer_data;
gsize len;
@@ -864,10 +872,10 @@ _gdk_wayland_display_get_selection_property (GdkDisplay *display,
void
_gdk_wayland_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time)
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time)
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
SelectionBuffer *buffer_data;
@@ -890,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);
@@ -950,11 +959,11 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
gint
_gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,
gint format,
const guchar *text,
gint length,
gchar ***list)
GdkAtom encoding,
gint format,
const guchar *text,
gint length,
gchar ***list)
{
GPtrArray *array;
const gchar *ptr;
@@ -991,7 +1000,7 @@ _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
gchar *
_gdk_wayland_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str)
const gchar *str)
{
return NULL;
}
@@ -1029,7 +1038,8 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
}
void
gdk_wayland_selection_clear_targets (GdkDisplay *display, GdkAtom selection)
gdk_wayland_selection_clear_targets (GdkDisplay *display,
GdkAtom selection)
{
gdk_wayland_selection_unset_data_source (display, selection);
}
+1 -1
View File
@@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WAYLAND_H__
+1 -1
View File
@@ -19,7 +19,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WAYLAND_SELECTION_H__
+162 -126
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)
@@ -51,11 +49,13 @@
typedef struct _GdkWaylandWindow GdkWaylandWindow;
typedef struct _GdkWaylandWindowClass GdkWaylandWindowClass;
struct _GdkWaylandWindow {
struct _GdkWaylandWindow
{
GdkWindow parent;
};
struct _GdkWaylandWindowClass {
struct _GdkWaylandWindowClass
{
GdkWindowClass parent_class;
};
@@ -107,6 +107,7 @@ struct _GdkWindowImplWayland
unsigned int mapped : 1;
unsigned int use_custom_surface : 1;
unsigned int pending_commit : 1;
unsigned int awaiting_frame : 1;
GdkWindowTypeHint hint;
GdkWindow *transient_for;
@@ -140,7 +141,8 @@ struct _GdkWindowImplWaylandClass
static void gdk_wayland_window_configure (GdkWindow *window,
int width,
int height);
int height,
int scale);
GType _gdk_window_impl_wayland_get_type (void);
@@ -162,7 +164,8 @@ _gdk_window_impl_wayland_init (GdkWindowImplWayland *impl)
static void
gdk_wayland_window_update_size (GdkWindow *window,
int32_t width,
int32_t height)
int32_t height,
int scale)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkRectangle area;
@@ -176,9 +179,16 @@ gdk_wayland_window_update_size (GdkWindow *window,
window->width = width;
window->height = height;
impl->scale = scale;
if (impl->egl_window)
wl_egl_window_resize (impl->egl_window, width, height, 0, 0);
{
wl_egl_window_resize (impl->egl_window,
width * scale,
height * scale,
0, 0);
wl_surface_set_buffer_scale (impl->surface, scale);
}
area.x = 0;
area.y = 0;
@@ -195,10 +205,12 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
int width,
int height)
{
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (gdk_screen_get_display (screen));
GdkWindow *window;
GdkWindowImplWayland *impl;
window = _gdk_display_create_window (gdk_screen_get_display (screen));
window = _gdk_display_create_window (GDK_DISPLAY (wayland_display));
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL);
window->impl_window = window;
window->visual = gdk_screen_get_system_visual (screen);
@@ -206,16 +218,14 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->wrapper = GDK_WINDOW (window);
if (gdk_screen_get_n_monitors(screen) > 0)
if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_screen_get_n_monitors (screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
else
impl->scale = 1;
/* logical 1x1 fake buffer */
impl->cairo_surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
impl->scale);
impl->cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
impl->scale);
cairo_surface_set_device_scale (impl->cairo_surface, impl->scale, impl->scale);
@@ -305,11 +315,18 @@ frame_callback (void *data,
GdkFrameClock *clock = gdk_window_get_frame_clock (window);
GdkFrameTimings *timings;
GDK_NOTE (EVENTS,
g_message ("frame %p", window));
wl_callback_destroy (callback);
if (GDK_WINDOW_DESTROYED (window))
return;
if (!impl->awaiting_frame)
return;
impl->awaiting_frame = FALSE;
_gdk_frame_clock_thaw (clock);
timings = gdk_frame_clock_get_timings (clock, impl->pending_frame_counter);
@@ -383,8 +400,11 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
if (!impl->pending_commit)
return;
g_assert (_gdk_wayland_is_shm_surface (impl->cairo_surface));
impl->pending_commit = FALSE;
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock);
impl->awaiting_frame = TRUE;
callback = wl_surface_frame (impl->surface);
wl_callback_add_listener (callback, &frame_listener, window);
@@ -405,7 +425,6 @@ window_update_scale (GdkWindow *window)
if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE)
{
/* We can't set the scale on this surface */
impl->scale = 1;
return;
}
@@ -413,18 +432,12 @@ window_update_scale (GdkWindow *window)
for (l = impl->outputs; l != NULL; l = l->next)
{
guint32 output_scale =
_gdk_wayland_screen_get_output_scale (wayland_display->screen,
l->data);
_gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data);
scale = MAX (scale, output_scale);
}
if (scale != impl->scale)
{
impl->scale = scale;
/* Notify app that scale changed */
gdk_wayland_window_configure (window, window->width, window->height);
}
/* Notify app that scale changed */
gdk_wayland_window_configure (window, window->width, window->height, scale);
}
static void
@@ -446,6 +459,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
GdkWindowAttr *attributes,
gint attributes_mask)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
GdkWindowImplWayland *impl;
GdkFrameClock *frame_clock;
const char *title;
@@ -454,21 +468,22 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
window->impl = GDK_WINDOW_IMPL (impl);
impl->wrapper = GDK_WINDOW (window);
if (window->width > 65535 ||
window->height > 65535)
if (window->width > 65535)
{
g_warning ("Native Windows wider or taller than 65535 pixels are not supported");
if (window->width > 65535)
window->width = 65535;
if (window->height > 65535)
window->height = 65535;
g_warning ("Native Windows wider than 65535 pixels are not supported");
window->width = 65535;
}
if (window->height > 65535)
{
g_warning ("Native Windows taller than 65535 pixels are not supported");
window->height = 65535;
}
g_object_ref (window);
/* More likely to be right than just assuming 1 */
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
if (wayland_display->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
impl->title = NULL;
@@ -514,6 +529,8 @@ gdk_wayland_window_attach_image (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return;
g_assert (_gdk_wayland_is_shm_surface (impl->cairo_surface));
/* Attach this new buffer to the surface */
wl_surface_attach (impl->surface,
_gdk_wayland_shm_surface_get_wl_buffer (impl->cairo_surface),
@@ -531,7 +548,21 @@ static void
gdk_wayland_window_ensure_cairo_surface (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->cairo_surface)
/* If we are drawing using OpenGL then we only need a logical 1x1 surface. */
if (impl->egl_window)
{
if (impl->cairo_surface &&
_gdk_wayland_is_shm_surface (impl->cairo_surface))
cairo_surface_destroy (impl->cairo_surface);
impl->cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
impl->scale);
cairo_surface_set_device_scale (impl->cairo_surface,
impl->scale, impl->scale);
}
else if (!impl->cairo_surface)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (impl->wrapper));
@@ -573,8 +604,13 @@ static gboolean
gdk_window_impl_wayland_begin_paint (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
gdk_wayland_window_ensure_cairo_surface (window);
return _gdk_wayland_shm_surface_get_busy (impl->cairo_surface);
if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
return _gdk_wayland_shm_surface_get_busy (impl->cairo_surface);
else
return FALSE;
}
static void
@@ -592,8 +628,7 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
for (i = 0; i < n; i++)
{
cairo_region_get_rectangle (window->current_paint.region, i, &rect);
wl_surface_damage (impl->surface,
rect.x, rect.y, rect.width, rect.height);
wl_surface_damage (impl->surface, rect.x, rect.y, rect.width, rect.height);
impl->pending_commit = TRUE;
}
}
@@ -619,12 +654,16 @@ gdk_window_impl_wayland_finalize (GObject *object)
static void
gdk_wayland_window_configure (GdkWindow *window,
int width,
int height)
int height,
int scale)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkDisplay *display;
GdkEvent *event;
if (window->width == width && window->height == height)
if (window->width == width &&
window->height == height &&
impl->scale == scale)
return;
event = gdk_event_new (GDK_CONFIGURE);
@@ -633,7 +672,7 @@ gdk_wayland_window_configure (GdkWindow *window,
event->configure.width = width;
event->configure.height = height;
gdk_wayland_window_update_size (window, width, height);
gdk_wayland_window_update_size (window, width, height, scale);
_gdk_window_update_size (window);
display = gdk_window_get_display (window);
@@ -764,6 +803,9 @@ surface_enter (void *data,
GdkWindow *window = GDK_WINDOW (data);
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GDK_NOTE (EVENTS,
g_message ("surface enter, window %p output %p", window, output));
impl->outputs = g_slist_prepend (impl->outputs, output);
window_update_scale (window);
@@ -777,6 +819,9 @@ surface_leave (void *data,
GdkWindow *window = GDK_WINDOW (data);
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GDK_NOTE (EVENTS,
g_message ("surface leave, window %p output %p", window, output));
impl->outputs = g_slist_remove (impl->outputs, output);
window_update_scale (window);
@@ -825,14 +870,10 @@ 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);
gdk_wayland_window_sync_input_region (window);
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_SUBSURFACE)
gdk_wayland_window_create_subsurface (window);
}
static void
@@ -857,10 +898,10 @@ xdg_surface_configure (void *data,
&width,
&height);
gdk_wayland_window_configure (window, width, height);
gdk_wayland_window_configure (window, width, height, impl->scale);
}
wl_array_for_each(p, states)
wl_array_for_each (p, states)
{
uint32_t state = *p;
switch (state)
@@ -882,19 +923,29 @@ xdg_surface_configure (void *data,
}
}
GDK_NOTE (EVENTS,
g_message ("configure, window %p %dx%d,%s%s%s",
window, width, height,
(new_state & GDK_WINDOW_STATE_FULLSCREEN) ? " fullscreen" : "",
(new_state & GDK_WINDOW_STATE_MAXIMIZED) ? " maximized" : "",
(new_state & GDK_WINDOW_STATE_FOCUSED) ? " focused" : ""));
_gdk_set_window_state (window, new_state);
gdk_wayland_window_sync_margin (window);
xdg_surface_ack_configure (xdg_surface, serial);
}
static void
xdg_surface_close (void *data,
xdg_surface_close (void *data,
struct xdg_surface *xdg_surface)
{
GdkWindow *window = GDK_WINDOW (data);
GdkDisplay *display;
GdkEvent *event;
GDK_NOTE (EVENTS,
g_message ("close %p", window));
event = gdk_event_new (GDK_DELETE);
event->any.window = g_object_ref (window);
event->any.send_event = TRUE;
@@ -920,6 +971,12 @@ gdk_wayland_window_create_xdg_surface (GdkWindow *window)
gdk_wayland_window_sync_parent (window);
gdk_wayland_window_sync_title (window);
gdk_wayland_window_sync_margin (window);
if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
xdg_surface_set_maximized (impl->xdg_surface);
if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
xdg_surface_set_app_id (impl->xdg_surface, gdk_get_program_class ());
}
@@ -929,6 +986,9 @@ xdg_popup_done (void *data,
{
GdkWindow *window = GDK_WINDOW (data);
GDK_NOTE (EVENTS,
g_message ("done %p", window));
gdk_window_hide (window);
}
@@ -992,11 +1052,11 @@ gdk_wayland_window_get_fake_root_coords (GdkWindow *window,
}
static void
gdk_wayland_window_create_xdg_popup (GdkWindow *window,
GdkWindow *parent,
struct wl_seat *seat)
gdk_wayland_window_create_xdg_popup (GdkWindow *window,
GdkWindow *parent,
struct wl_seat *seat)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent_impl = GDK_WINDOW_IMPL_WAYLAND (parent->impl);
GdkDeviceManager *device_manager;
@@ -1010,7 +1070,7 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
if (!parent_impl->surface)
return;
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (display_wayland));
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (display));
device = GDK_WAYLAND_DEVICE (gdk_device_manager_get_client_pointer (device_manager));
gdk_wayland_window_get_fake_root_coords (parent, &parent_x, &parent_y);
@@ -1024,7 +1084,7 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
y -= parent_impl->margin_top;
}
impl->xdg_popup = xdg_shell_get_xdg_popup (display_wayland->xdg_shell,
impl->xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
impl->surface,
parent_impl->surface,
seat,
@@ -1148,6 +1208,9 @@ gdk_wayland_window_show (GdkWindow *window,
if (!impl->surface)
gdk_wayland_window_create_surface (window);
if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_SUBSURFACE)
gdk_wayland_window_create_subsurface (window);
gdk_wayland_window_map (window);
_gdk_make_event (window, GDK_MAP, NULL, FALSE);
@@ -1205,6 +1268,12 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->subsurface = NULL;
}
if (impl->awaiting_frame)
{
impl->awaiting_frame = FALSE;
_gdk_frame_clock_thaw (gdk_window_get_frame_clock (window));
}
wl_surface_destroy (impl->surface);
impl->surface = NULL;
@@ -1310,12 +1379,10 @@ gdk_window_wayland_move_resize (GdkWindow *window,
gint width,
gint height)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (with_move)
{
GdkWindowImplWayland *impl;
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
/* Each toplevel has in its own "root" coordinate system */
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_TOPLEVEL)
{
@@ -1334,7 +1401,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
* just move the window - don't update its size
*/
if (width > 0 && height > 0)
gdk_wayland_window_configure (window, width, height);
gdk_wayland_window_configure (window, width, height, impl->scale);
}
static void
@@ -1570,18 +1637,6 @@ gdk_wayland_window_set_geometry_hints (GdkWindow *window,
impl->geometry_hints = *geometry;
impl->geometry_mask = geom_mask;
/*
* GDK_HINT_POS
* GDK_HINT_USER_POS
* GDK_HINT_USER_SIZE
* GDK_HINT_MIN_SIZE
* GDK_HINT_MAX_SIZE
* GDK_HINT_BASE_SIZE
* GDK_HINT_RESIZE_INC
* GDK_HINT_ASPECT
* GDK_HINT_WIN_GRAVITY
*/
}
static void
@@ -1633,7 +1688,7 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
impl->subsurface = NULL;
}
if (parent)
if (parent && gdk_window_is_visible (window))
gdk_wayland_window_create_subsurface (window);
}
}
@@ -1711,15 +1766,11 @@ gdk_wayland_window_deiconify (GdkWindow *window)
static void
gdk_wayland_window_stick (GdkWindow *window)
{
if (GDK_WINDOW_DESTROYED (window))
return;
}
static void
gdk_wayland_window_unstick (GdkWindow *window)
{
if (GDK_WINDOW_DESTROYED (window))
return;
}
static void
@@ -1730,10 +1781,10 @@ gdk_wayland_window_maximize (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return;
if (!impl->xdg_surface)
return;
xdg_surface_set_maximized (impl->xdg_surface);
if (impl->xdg_surface)
xdg_surface_set_maximized (impl->xdg_surface);
else
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED);
}
static void
@@ -1744,10 +1795,10 @@ gdk_wayland_window_unmaximize (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return;
if (!impl->xdg_surface)
return;
xdg_surface_unset_maximized (impl->xdg_surface);
if (impl->xdg_surface)
xdg_surface_unset_maximized (impl->xdg_surface);
else
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0);
}
static void
@@ -1758,10 +1809,10 @@ gdk_wayland_window_fullscreen (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return;
if (!impl->xdg_surface)
return;
xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
if (impl->xdg_surface)
xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
else
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
}
static void
@@ -1772,10 +1823,10 @@ gdk_wayland_window_unfullscreen (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return;
if (!impl->xdg_surface)
return;
xdg_surface_unset_fullscreen (impl->xdg_surface);
if (impl->xdg_surface)
xdg_surface_unset_fullscreen (impl->xdg_surface);
else
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
}
static void
@@ -1791,10 +1842,6 @@ gdk_wayland_window_set_keep_below (GdkWindow *window, gboolean setting)
static GdkWindow *
gdk_wayland_window_get_group (GdkWindow *window)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return NULL;
return NULL;
}
@@ -1802,9 +1849,6 @@ static void
gdk_wayland_window_set_group (GdkWindow *window,
GdkWindow *leader)
{
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader));
}
static void
@@ -2072,7 +2116,7 @@ gdk_wayland_window_set_shadow_width (GdkWindow *window,
(impl->margin_left + impl->margin_right) + (left + right);
new_height = window->height -
(impl->margin_top + impl->margin_bottom) + (top + bottom);
gdk_wayland_window_configure (window, new_width, new_height);
gdk_wayland_window_configure (window, new_width, new_height, impl->scale);
impl->margin_left = left;
impl->margin_right = right;
@@ -2224,10 +2268,10 @@ _gdk_wayland_window_set_device_grabbed (GdkWindow *window,
}
/**
* gdk_wayland_window_get_wl_surface
* gdk_wayland_window_get_wl_surface:
* @window: (type GdkWaylandWindow): a #GdkWindow
*
* Returns the Wayland surface of a #GdkWindow
* Returns the Wayland surface of a #GdkWindow.
*
* Returns: (transfer none): a Wayland wl_surface
*
@@ -2236,30 +2280,23 @@ _gdk_wayland_window_set_device_grabbed (GdkWindow *window,
struct wl_surface *
gdk_wayland_window_get_wl_surface (GdkWindow *window)
{
GdkWindowImplWayland *impl;
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
return impl->surface;
return GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface;
}
static struct wl_egl_window *
gdk_wayland_window_get_wl_egl_window (GdkWindow *window)
{
GdkWindowImplWayland *impl;
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->egl_window == NULL)
{
impl->egl_window =
wl_egl_window_create(impl->surface,
impl->wrapper->width,
impl->wrapper->height);
wl_egl_window_create (impl->surface,
impl->wrapper->width * impl->scale,
impl->wrapper->height * impl->scale);
wl_surface_set_buffer_scale (impl->surface, impl->scale);
}
return impl->egl_window;
@@ -2267,9 +2304,9 @@ gdk_wayland_window_get_wl_egl_window (GdkWindow *window)
EGLSurface
gdk_wayland_window_get_egl_surface (GdkWindow *window,
EGLConfig config)
EGLConfig config)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl;
struct wl_egl_window *egl_window;
@@ -2282,8 +2319,7 @@ gdk_wayland_window_get_egl_surface (GdkWindow *window,
egl_window = gdk_wayland_window_get_wl_egl_window (window);
impl->egl_surface =
eglCreateWindowSurface (display_wayland->egl_display,
config, egl_window, NULL);
eglCreateWindowSurface (display->egl_display, config, egl_window, NULL);
}
return impl->egl_surface;
@@ -2291,9 +2327,9 @@ gdk_wayland_window_get_egl_surface (GdkWindow *window,
EGLSurface
gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
EGLConfig config)
EGLConfig config)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl;
g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
@@ -2306,8 +2342,7 @@ gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
wl_egl_window_create (impl->surface, 1, 1);
impl->dummy_egl_surface =
eglCreateWindowSurface (display_wayland->egl_display,
config, impl->dummy_egl_window, NULL);
eglCreateWindowSurface (display->egl_display, config, impl->dummy_egl_window, NULL);
}
return impl->dummy_egl_surface;
@@ -2382,7 +2417,7 @@ gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window,
const char *application_object_path,
const char *unique_bus_name)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindowImplWayland *impl;
g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
@@ -2393,10 +2428,11 @@ gdk_wayland_window_set_dbus_properties_libgtk_only (GdkWindow *window,
{
if (impl->xdg_surface == NULL)
return;
if (display_wayland->gtk_shell == NULL)
if (display->gtk_shell == NULL)
return;
impl->gtk_surface = gtk_shell_get_gtk_surface (display_wayland->gtk_shell, impl->surface);
impl->gtk_surface = gtk_shell_get_gtk_surface (display->gtk_shell, impl->surface);
}
gtk_surface_set_dbus_properties (impl->gtk_surface,
+9 -1
View File
@@ -1,12 +1,20 @@
<protocol name="gtk">
<interface name="gtk_shell" version="1">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it. It is not backward compatible, and a client must
always only bind to the specific version it implements. If a client binds
to a version different from the version the server provides, an error will
be raised.
</description>
<enum name="capability">
<entry name="global_app_menu" value="1"/>
<entry name="global_menu_bar" value="2"/>
<entry name="desktop_icons" value="3"/>
</enum>
<event name="capabilities">
<arg name="capabilities" type="uint"/>
</event>
+6 -1
View File
@@ -355,7 +355,12 @@ inner_clipboard_window_procedure (HWND hwnd,
GdkWindow *owner;
success = OpenClipboard (hwnd);
g_return_val_if_fail (success, 0);
if (!success)
{
g_warning ("Failed to OpenClipboard on window handle %p", hwnd);
return 0;
}
hwndOwner = GetClipboardOwner ();
owner = gdk_win32_window_lookup_for_display (_gdk_display, hwndOwner);
if (owner == NULL)
+1 -10
View File
@@ -116,8 +116,6 @@ _gdk_win32_gl_context_end_frame (GdkGLContext *context,
if (context_win32->do_frame_sync)
{
guint32 end_frame_counter = 0;
if (context_win32->do_frame_sync)
{
glFinish ();
@@ -156,7 +154,6 @@ _gdk_win32_window_invalidate_for_new_frame (GdkWindow *window,
cairo_region_t *update_area)
{
cairo_rectangle_int_t window_rect;
unsigned int buffer_age;
gboolean invalidate_all = FALSE;
GdkWin32GLContext *context_win32;
cairo_rectangle_int_t whole_window = { 0, 0, gdk_window_get_width (window), gdk_window_get_height (window) };
@@ -231,7 +228,6 @@ static void
_get_dummy_window_hwnd (GdkWGLDummy *dummy)
{
WNDCLASSEX dummy_wc;
HWND dummy_hwnd;
memset (&dummy_wc, 0, sizeof (WNDCLASSEX));
@@ -270,10 +266,7 @@ _get_wgl_pfd (HDC hdc,
const gboolean need_alpha_bits,
PIXELFORMATDESCRIPTOR *pfd)
{
gint configs;
gint i;
gint best_pf = 0;
gboolean alpha_check;
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
pfd->nVersion = 1;
@@ -338,8 +331,6 @@ _gdk_win32_display_init_gl (GdkDisplay *display,
const gboolean need_alpha_bits)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
gint glMajMinVersion;
GdkWindowImplWin32 *impl;
gint best_idx = 0;
GdkWGLDummy dummy;
@@ -485,7 +476,7 @@ _gdk_win32_gl_context_realize (GdkGLContext *context,
GDK_NOTE (OPENGL,
g_print ("Creating core WGL context (version:%d.%d, debug:%s, forward:%s)\n",
major, minor,
glver_major, glver_minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no"));
+28
View File
@@ -51,6 +51,7 @@ struct _GdkX11DeviceXI2
gint device_id;
GArray *scroll_valuators;
gdouble *last_axes;
};
struct _GdkX11DeviceXI2Class
@@ -157,6 +158,7 @@ gdk_x11_device_xi2_finalize (GObject *object)
GdkX11DeviceXI2 *device = GDK_X11_DEVICE_XI2 (object);
g_array_free (device->scroll_valuators, TRUE);
g_free (device->last_axes);
G_OBJECT_CLASS (gdk_x11_device_xi2_parent_class)->finalize (object);
}
@@ -891,3 +893,29 @@ _gdk_x11_device_xi2_get_id (GdkX11DeviceXI2 *device)
return device->device_id;
}
gdouble
gdk_x11_device_xi2_get_last_axis_value (GdkX11DeviceXI2 *device,
gint n_axis)
{
if (n_axis >= gdk_device_get_n_axes (GDK_DEVICE (device)))
return 0;
if (!device->last_axes)
return 0;
return device->last_axes[n_axis];
}
void
gdk_x11_device_xi2_store_axes (GdkX11DeviceXI2 *device,
gdouble *axes,
gint n_axes)
{
g_free (device->last_axes);
if (axes && n_axes)
device->last_axes = g_memdup (axes, sizeof (gdouble) * n_axes);
else
device->last_axes = NULL;
}
+8 -2
View File
@@ -837,6 +837,7 @@ handle_device_changed (GdkX11DeviceManagerXI2 *device_manager,
{
_gdk_device_reset_axes (device);
_gdk_device_xi2_unset_scroll_valuators ((GdkX11DeviceXI2 *) device);
gdk_x11_device_xi2_store_axes (GDK_X11_DEVICE_XI2 (device), NULL, 0);
translate_device_classes (display, device, ev->classes, ev->num_classes);
g_signal_emit_by_name (G_OBJECT (device), "changed");
@@ -939,13 +940,16 @@ translate_axes (GdkDevice *device,
axes = g_new0 (gdouble, n_axes);
vals = valuators->values;
for (i = 0; i < valuators->mask_len * 8; i++)
for (i = 0; i < MIN (valuators->mask_len * 8, n_axes); i++)
{
GdkAxisUse use;
gdouble val;
if (!XIMaskIsSet (valuators->mask, i))
continue;
{
axes[i] = gdk_x11_device_xi2_get_last_axis_value (GDK_X11_DEVICE_XI2 (device), i);
continue;
}
use = gdk_device_get_axis_use (device, i);
val = *vals++;
@@ -970,6 +974,8 @@ translate_axes (GdkDevice *device,
}
}
gdk_x11_device_xi2_store_axes (GDK_X11_DEVICE_XI2 (device), axes, n_axes);
return axes;
}
+2
View File
@@ -1499,8 +1499,10 @@ gdk_x11_keymap_map_virtual_modifiers (GdkKeymap *keymap,
int i, j;
gboolean retval;
#ifdef HAVE_XKB
if (KEYMAP_USE_XKB (keymap))
get_xkb (keymap_x11);
#endif
retval = TRUE;
+6
View File
@@ -247,6 +247,12 @@ gboolean _gdk_x11_device_xi2_get_scroll_delta (GdkX11DeviceXI2 *device,
gdouble *delta_ret);
void _gdk_device_xi2_reset_scroll_valuators (GdkX11DeviceXI2 *device);
gdouble gdk_x11_device_xi2_get_last_axis_value (GdkX11DeviceXI2 *device,
gint n_axis);
void gdk_x11_device_xi2_store_axes (GdkX11DeviceXI2 *device,
gdouble *axes,
gint n_axes);
#endif
void _gdk_x11_event_translate_keyboard_string (GdkEventKey *event);
+16 -12
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 \
@@ -1078,12 +1089,6 @@ templates = \
ui/gtkstatusbar.ui \
ui/gtkvolumebutton.ui
template_headers = $(templates:.ui=.ui.h)
%.ui.h: %.ui
$(AM_V_GEN) mkdir -p $(dir $@) \
&& $(top_builddir)/util/extract-strings$(EXEEXT) $< > $@
#
# rules to generate built sources
#
@@ -1127,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'>" >> $@; \
@@ -1158,10 +1163,10 @@ gtk.gresource.xml: Makefile.am
n=`basename $$f`; \
echo " <file compressed='true'>ui/$$n</file>" >> $@; \
done; \
shopt -s nullglob; \
for s in 16x16 22x22 24x24 32x32 48x48; do \
for c in actions status; do \
for f in $(srcdir)/icons/$$s/$$c/*.png; do \
test "$$f" = "$(srcdir)/icons/$$s/$$c/*.png" && continue; \
n=`basename $$f`; \
echo " <file>icons/$$s/$$c/$$n</file>" >> $@; \
done; \
@@ -1210,7 +1215,7 @@ resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --gener
gtkresources.h: gtk.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< \
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-header --manual-register
gtkresources.c: gtk.gresource.xml $(resource_files) $(template_headers)
gtkresources.c: gtk.gresource.xml $(resource_files)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< \
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-source --manual-register
@@ -1336,7 +1341,7 @@ distclean-local:
if HAVE_INTROSPECTION
introspection_files = \
$(filter-out %private.h gtktextdisplay.h gtktextlayout.h gtkx.h, $(gtkinclude_HEADERS) $(a11yinclude_HEADERS) $(deprecatedinclude_HEADERS)) \
$(gtk_base_c_sources) \
$(filter-out %win32.c %quartz.c, $(gtk_base_c_sources)) \
gtkprintoperation-unix.c \
gtktypebuiltins.h \
gtktypebuiltins.c
@@ -1470,7 +1475,6 @@ EXTRA_DIST += \
$(resource_files) \
$(theme_sources) \
$(gsettings_SCHEMAS) \
$(template_headers) \
a11y/Makefile.inc \
deprecated/Makefile.inc \
inspector/Makefile.inc \
+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;
+6 -3
View File
@@ -97,11 +97,14 @@ gtk_text_view_accessible_ref_state_set (AtkObject *accessible)
AtkStateSet *state_set;
GtkWidget *widget;
state_set = ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->ref_state_set (accessible);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
if (widget == NULL)
return NULL;
state_set = ATK_OBJECT_CLASS (gtk_text_view_accessible_parent_class)->ref_state_set (accessible);
{
atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
return state_set;
}
if (gtk_text_view_get_editable (GTK_TEXT_VIEW (widget)))
atk_state_set_add_state (state_set, ATK_STATE_EDITABLE);
+1 -10
View File
@@ -90,25 +90,16 @@ gtk_window_accessible_initialize (AtkObject *obj,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET (data);
const gchar *name;
ATK_OBJECT_CLASS (gtk_window_accessible_parent_class)->initialize (obj, data);
g_signal_connect (data, "window-state-event", G_CALLBACK (window_state_event_cb), NULL);
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_WINDOW);
name = gtk_widget_get_name (widget);
if (!g_strcmp0 (name, "gtk-tooltip"))
obj->role = ATK_ROLE_TOOL_TIP;
else if (gtk_window_get_window_type (GTK_WINDOW (widget)) == GTK_WINDOW_POPUP)
if (gtk_window_get_window_type (GTK_WINDOW (widget)) == GTK_WINDOW_POPUP)
obj->role = ATK_ROLE_WINDOW;
else
obj->role = ATK_ROLE_FRAME;
/* Notify that tooltip is showing */
if (obj->role == ATK_ROLE_TOOL_TIP && gtk_widget_get_mapped (widget))
atk_object_notify_state_change (obj, ATK_STATE_SHOWING, 1);
}
static GtkWidget *
+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,
+1 -1
View File
@@ -219,7 +219,7 @@ gtk_misc_get_property (GObject *object,
*
* Sets the alignment of the widget.
*
* Deprecated: 3.14: Use #GtkWidget alignment and margin properties.
* Deprecated: 3.14: Use #GtkWidget's alignment (#GtkWidget:halign and #GtkWidget:valign) and margin properties or #GtkLabel's #GtkLabel:xalign and #GtkLabel:yalign properties.
*/
void
gtk_misc_set_alignment (GtkMisc *misc,
+22 -4
View File
@@ -693,6 +693,24 @@ button_callback (gpointer data)
static UINT taskbar_created_msg = 0;
static GSList *status_icons = NULL;
static UINT status_icon_id = 0;
static GtkStatusIcon *
find_status_icon (UINT id)
{
GSList *rover;
for (rover = status_icons; rover != NULL; rover = rover->next)
{
GtkStatusIcon *status_icon = GTK_STATUS_ICON (rover->data);
GtkStatusIconPrivate *priv = status_icon->priv;
if (priv->nid.uID == id)
return status_icon;
}
return NULL;
}
static LRESULT CALLBACK
wndproc (HWND hwnd,
@@ -710,7 +728,7 @@ wndproc (HWND hwnd,
GtkStatusIconPrivate *priv = status_icon->priv;
priv->nid.hWnd = hwnd;
priv->nid.uID = GPOINTER_TO_UINT (status_icon);
priv->nid.uID = status_icon_id++;
priv->nid.uCallbackMessage = WM_GTK_TRAY_NOTIFICATION;
priv->nid.uFlags = NIF_MESSAGE;
@@ -754,7 +772,7 @@ wndproc (HWND hwnd,
buttondown0:
bc = g_new (ButtonCallbackData, 1);
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_PRESS);
bc->status_icon = GTK_STATUS_ICON (wparam);
bc->status_icon = find_status_icon (wparam);
build_button_event (bc->status_icon->priv, bc->event, button);
g_idle_add (button_callback, bc);
break;
@@ -780,7 +798,7 @@ wndproc (HWND hwnd,
buttonup0:
bc = g_new (ButtonCallbackData, 1);
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_RELEASE);
bc->status_icon = GTK_STATUS_ICON (wparam);
bc->status_icon = find_status_icon (wparam);
build_button_event (bc->status_icon->priv, bc->event, button);
g_idle_add (button_callback, bc);
break;
@@ -927,7 +945,7 @@ gtk_status_icon_init (GtkStatusIcon *status_icon)
memset (&priv->nid, 0, sizeof (priv->nid));
priv->nid.hWnd = create_tray_observer ();
priv->nid.uID = GPOINTER_TO_UINT (status_icon);
priv->nid.uID = status_icon_id++;
priv->nid.uCallbackMessage = WM_GTK_TRAY_NOTIFICATION;
priv->nid.uFlags = NIF_MESSAGE;
+2 -2
View File
@@ -250,7 +250,7 @@ typedef char * GtkStock;
*
* The Delete item and icon.
*
* Deprecated: 3.10: Use the named icon &quot;edit-cut&quot; or the label &quot;_Delete&quot;.
* Deprecated: 3.10: Use the named icon &quot;edit-delete&quot; or the label &quot;_Delete&quot;.
*/
#define GTK_STOCK_DELETE ((GtkStock)"gtk-delete")
@@ -824,7 +824,7 @@ typedef char * GtkStock;
*
* The Paste item and icon.
*
* Deprecated: 3.10: Do not use an icon. Use label &quot;_Paste&quot;.
* Deprecated: 3.10: Use named icon &quot;edit-paste&quot; or the label &quot;_Paste&quot;.
*/
#define GTK_STOCK_PASTE ((GtkStock)"gtk-paste")
-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)
+4 -3
View File
@@ -207,7 +207,7 @@ _gtk_allocated_bitmask_subtract (GtkBitmask *mask,
const GtkBitmask *other)
{
GtkBitmask other_allocated;
guint i;
guint i, len;
g_return_val_if_fail (mask != NULL, NULL);
g_return_val_if_fail (other != NULL, NULL);
@@ -215,9 +215,10 @@ _gtk_allocated_bitmask_subtract (GtkBitmask *mask,
mask = gtk_bitmask_ensure_allocated (mask);
ENSURE_ALLOCATED (other, other_allocated);
for (i = 0; i < other->len; i++)
len = MIN (mask->len, other->len);
for (i = 0; i < len; i++)
{
mask->data[i] |= ~other->data[i];
mask->data[i] &= ~other->data[i];
}
return gtk_allocated_bitmask_shrink (mask);
+11 -1
View File
@@ -57,6 +57,7 @@
#include "gtkheaderbar.h"
#include "gtkdialogprivate.h"
#include "gtksearchbar.h"
#include "gtksizegroup.h"
#include <string.h>
#include <glib/gi18n-lib.h>
@@ -80,6 +81,8 @@ struct _GtkAppChooserDialogPrivate {
GtkWidget *show_more_button;
GtkWidget *software_button;
GtkSizeGroup *buttons;
gboolean show_more_clicked;
gboolean dismissed;
};
@@ -460,10 +463,15 @@ software_button_clicked_cb (GtkButton *button,
static void
ensure_software_button (GtkAppChooserDialog *self)
{
if (g_find_program_in_path ("gnome-software"))
gchar *path;
path = g_find_program_in_path ("gnome-software");
if (path != NULL)
gtk_widget_show (self->priv->software_button);
else
gtk_widget_hide (self->priv->software_button);
g_free (path);
}
static void
@@ -489,6 +497,7 @@ setup_search (GtkAppChooserDialog *self)
header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
gtk_size_group_add_widget (self->priv->buttons, button);
g_object_bind_property (button, "active",
self->priv->search_bar, "search-mode-enabled",
@@ -691,6 +700,7 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, inner_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, search_bar);
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, buttons);
gtk_widget_class_bind_template_callback (widget_class, show_more_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, software_button_clicked_cb);
}
+2 -2
View File
@@ -38,7 +38,7 @@ static inline void
_gtk_bitmask_free (GtkBitmask *mask)
{
if (_gtk_bitmask_is_allocated (mask))
return _gtk_allocated_bitmask_free (mask);
_gtk_allocated_bitmask_free (mask);
}
static inline char *
@@ -55,7 +55,7 @@ static inline void
_gtk_bitmask_print (const GtkBitmask *mask,
GString *string)
{
return _gtk_allocated_bitmask_print (mask, string);
_gtk_allocated_bitmask_print (mask, string);
}
static inline GtkBitmask *
+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
+11
View File
@@ -147,6 +147,8 @@ static void gtk_button_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gtk_button_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_button_do_release (GtkButton *button,
gboolean emit_clicked);
static void gtk_button_actionable_iface_init (GtkActionableInterface *iface);
static void gtk_button_activatable_interface_init(GtkActivatableIface *iface);
@@ -644,6 +646,14 @@ multipress_gesture_update_cb (GtkGesture *gesture,
}
}
static void
multipress_gesture_cancel_cb (GtkGesture *gesture,
GdkEventSequence *sequence,
GtkButton *button)
{
gtk_button_do_release (button, FALSE);
}
static void
gtk_button_init (GtkButton *button)
{
@@ -683,6 +693,7 @@ gtk_button_init (GtkButton *button)
g_signal_connect (priv->gesture, "pressed", G_CALLBACK (multipress_pressed_cb), button);
g_signal_connect (priv->gesture, "released", G_CALLBACK (multipress_released_cb), button);
g_signal_connect (priv->gesture, "update", G_CALLBACK (multipress_gesture_update_cb), button);
g_signal_connect (priv->gesture, "cancel", G_CALLBACK (multipress_gesture_cancel_cb), button);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->gesture), GTK_PHASE_BUBBLE);
}
+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 -1
View File
@@ -286,7 +286,7 @@ gtk_clipboard_finalize (GObject *object)
if (clipboard->store_timeout != 0)
g_source_remove (clipboard->store_timeout);
if (clipboard->notify_signal_id != 0)
if (clipboard_widget != NULL && clipboard->notify_signal_id != 0)
g_signal_handler_disconnect (clipboard_widget, clipboard->notify_signal_id);
g_free (clipboard->storable_targets);
+1 -1
View File
@@ -309,7 +309,7 @@ scale_set_type (GtkColorScale *scale,
atk_object_set_name (atk_obj, C_("Color channel", "Hue"));
else if (type == GTK_COLOR_SCALE_ALPHA)
atk_object_set_name (atk_obj, C_("Color channel", "Alpha"));
atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (scale)), ATK_ROLE_COLOR_CHOOSER);
atk_object_set_role (atk_obj, ATK_ROLE_COLOR_CHOOSER);
}
}
+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);
}
+74 -9
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
@@ -368,15 +364,81 @@ _gtk_css_font_variant_value_get (const GtkCssValue *value)
/* PangoWeight */
#define BOLDER -1
#define LIGHTER -2
static GtkCssValue *
gtk_css_value_font_weight_compute (GtkCssValue *value,
guint property_id,
GtkStyleProviderPrivate *provider,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
PangoWeight new_weight;
int parent_value;
if (value->value >= 0)
return _gtk_css_value_ref (value);
if (parent_style)
parent_value = gtk_css_style_get_value (parent_style, property_id)->value;
else
parent_value = 400;
if (value->value == BOLDER)
{
if (parent_value < 400)
new_weight = PANGO_WEIGHT_NORMAL;
else if (parent_value < 600)
new_weight = PANGO_WEIGHT_BOLD;
else
new_weight = PANGO_WEIGHT_HEAVY;
}
else if (value->value == LIGHTER)
{
if (parent_value > 700)
new_weight = PANGO_WEIGHT_BOLD;
else if (parent_value > 500)
new_weight = PANGO_WEIGHT_NORMAL;
else
new_weight = PANGO_WEIGHT_THIN;
}
else
{
g_assert_not_reached ();
new_weight = PANGO_WEIGHT_NORMAL;
}
return _gtk_css_font_weight_value_new (new_weight);
}
static GtkCssValue *
gtk_css_value_font_weight_transition (GtkCssValue *start,
GtkCssValue *end,
guint property_id,
double progress)
{
PangoWeight new_weight;
if (start->value < 0 || end->value < 0)
return NULL;
new_weight = (start->value + end->value + 50) / 200 * 100;
return _gtk_css_font_weight_value_new (new_weight);
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
gtk_css_value_enum_free,
gtk_css_value_enum_compute,
gtk_css_value_font_weight_compute,
gtk_css_value_enum_equal,
gtk_css_value_enum_transition,
gtk_css_value_font_weight_transition,
gtk_css_value_enum_print
};
static GtkCssValue font_weight_values[] = {
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, BOLDER, "bolder" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, LIGHTER, "lighter" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, PANGO_WEIGHT_THIN, "100" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, PANGO_WEIGHT_ULTRALIGHT, "200" },
{ &GTK_CSS_VALUE_FONT_WEIGHT, 1, PANGO_WEIGHT_LIGHT, "300" },
@@ -396,7 +458,7 @@ _gtk_css_font_weight_value_new (PangoWeight font_weight)
w = ((font_weight + 50) / 100) * 100;
for (i = 0; i < G_N_ELEMENTS (font_weight_values); i++)
for (i = 2; i < G_N_ELEMENTS (font_weight_values); i++)
{
if (font_weight_values[i].value == w)
return _gtk_css_value_ref (&font_weight_values[i]);
@@ -434,6 +496,9 @@ _gtk_css_font_weight_value_get (const GtkCssValue *value)
return value->value;
}
#undef BOLDER
#undef LIGHTER
/* PangoStretch */
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STRETCH = {
+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,

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