Commit Graph

123 Commits

Author SHA1 Message Date
Timm Bäder
2f6d60d6af stack: Fix node position during crossfade 2017-01-30 18:11:15 +01:00
Benjamin Otte
b58de2d16c snapshot: Redo pop() API
gtk_snapshot_pop() => removed
gtk_snapshot_pop_and_append() => gtk_snapshot_pop()

So now there is no way to get a rendernode out of the snapshotting API
until you gtk_snapshot_finish().
2017-01-13 03:38:36 +01:00
Benjamin Otte
4668e6dc63 stack: Build stored render node with custom Snapshot object
This is in preparation for API changes in GtkSnapshot.
2017-01-13 03:38:36 +01:00
Benjamin Otte
d9b0685b49 Add gtk_snapshot_push_cross_fade()
... and use it.

The function is a bit awkward because it requires 2 calls to
gtk_snapshot_pop(), but once you accept that, it's very convenient to
use, as can be seen by the 2 implementations.
2017-01-13 03:38:36 +01:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Alexander Larsson
65ad2541d7 Snapshot: Only record names if inspector is recording
Otherwise we do a lot of allocations and vprintf calls which are
not used.
2017-01-11 10:22:40 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
30438c6e8b gsk: Add cross-fade node
And implement stack crossfades with it.
2016-12-20 18:01:11 +01:00
Benjamin Otte
b0175421f2 stack: Implement snapshot()
This uses the new push()/pop() mechanism to its fullest extent when
implementing transitions. It's fun to inspect the results in the
inspector.

Crossfades don't work yet, they continue using a Cairo fallback.

A side effect of the stack conversion is that widget-factory now uses
snapshots for a lot more things.
2016-12-20 18:01:10 +01:00
Benjamin Otte
68a54ae81f stack: Don't draw an extra background
The gadget draws a background for us, we don't need another one.
2016-12-20 18:01:10 +01:00
Debarshi Ray
faf2295440 GtkStack: Remove redundant code
Commit 7ce96cb6ac avoids notifications
during destruction by using gtk_widget_in_destruction. Therefore this
code is no longer needed.

This reverts commit 39e7afecb1

https://bugzilla.gnome.org/show_bug.cgi?id=749012
2016-12-20 00:32:15 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Olivier Fourdan
03b8a8a880 gtkstack: reorder size_allocate and move_window
Unlike other container widgets, GtkStack would allocate its children
prior to moving its windows, which might prevent further valid size
allocation signals to be emitted.

Re-order the size allocation of child widgets to be performed after
moving the GtkStack windows.

Thanks to Owen for spotting the real issue here.

https://bugzilla.gnome.org/show_bug.cgi?id=767713
2016-11-14 12:24:18 +01:00
Timm Bäder
0d88fe65ba stack: Use gtk_widget_measure 2016-11-12 20:37:22 +01:00
Benjamin Otte
32a5729d18 gtk: Chain up in realize()
... instead of copy/paste from gtk_widget_real_realize.
2016-11-02 07:16:08 +01:00
Timm Bäder
ee4ba18d5e stack: Don't underallocate child in interpolate-size case
In that case, we can't just rely on the stack allocation being big
enough. Especially, the child can actually be bigger than the current
stack allocation, so take that into account when positioning it.
2016-10-31 19:29:36 +01:00
Timm Bäder
8dce94c47a stack: Redraw last_visible_surface if child allocation changes
So the widget is properly aligned.
2016-10-31 19:29:36 +01:00
Timm Bäder
acbdd5c8f2 Fix clip position of windowed widgets 2016-10-28 17:56:51 +02:00
Timm Bäder
82d38e35f8 stack: Use measure() to measure child widget
Simpler code this way \o/
2016-10-28 16:33:02 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Benjamin Otte
edc9a08b7c stack: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Timm Bäder
0b0d4765a0 Add GtkStackAccessible
Show only the currently visible child to a11y.
2016-05-30 19:12:52 +02:00
Florian Müllner
57efcabfd6 stack: Only map children when necessary
gtk_widget_set_parent() will map the widget if the parent is mapped
and the widget is both visible and child-visible. As we currently
only set the child visibility after adding the child, we immediately
map all children that are added to a mapped stack, even when they
are not actually shown. Avoid this by setting the child visibility
before adding the child, so widgets are only mapped when shown.

https://bugzilla.gnome.org/show_bug.cgi?id=766737
2016-05-21 00:56:34 +02:00
Matt Watson
175cf7e32d stack: always update window position at transition start
Sometimes on wayland we're seeing a frame draw before the first tick
callback, where the window position has not yet been updated.

With this change, the window is properly positioned as soon as
gtk_stack_start_transition returns.

https://bugzilla.gnome.org/show_bug.cgi?id=766405
2016-05-16 13:53:26 -07:00
Timm Bäder
0d8993fb24 stack: Don't underallocate the last_child 2016-05-12 20:40:06 +02:00
Timm Bäder
292e0c2663 stack: Remove some code duplication 2016-05-12 20:40:00 +02:00
Matthias Clasen
df72478375 stack: Use getter for gtk-enable-animations 2016-05-01 00:39:55 -04:00
Matt Watson
62b224a8df stack: skip first frame for animations
Not the ideal solution for this problem, but in practice leads to
much better performance on lower end hardware.

Stack does a double draw on the first frame of its animation, of
both the old contents (into a cairo surface) and the new contents.
Homogeneous stacks only need to reallocate contents on the first
frame.

On lower powered hardware where our frames will be a good deal
slower than the refresh rate anyway, we can assure a smother
experience by waiting a frame to start tweening where frame duration
will be more consistent.
2016-04-08 16:09:30 -07:00
Matt Watson
3909f818c4 stack: port to progress tracker 2016-04-08 16:09:30 -07:00
Christian Hergert
ca63330b19 stack: query preferred size for last_visible_child
When animating, we might be changing the size allocation of the previous
stack child. However, we were not querying the size in the process
meaning you would often see warnings about allocating the size without
knowing what it should be.

This simply adds an innocuous size request, since responding to last_child
sizing requests is not all that critical in the transition.

https://bugzilla.gnome.org/show_bug.cgi?id=763900
2016-03-21 11:50:27 -04:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Timm Bäder
c5369356e8 Various documentation fixes
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Benjamin Otte
2c350f4469 stack: realize windows in correct position 2016-01-26 16:40:27 +01:00
Benjamin Otte
9d0e8401ca stack: Turn into no-window widget
Having priv->view_window be the same as widget->window does not make
sense.

And because we need to clip the content area, we need the view window.
2016-01-26 15:53:56 +01:00
Benjamin Otte
6bb8da5564 stack: Clip animation drawing
We use cairo_paint() when doing that and we don't want to overdraw the
content area.
2016-01-22 13:46:01 +01:00
Marek Černocký
f64bb38aa7 Fixed typo childen->children 2016-01-19 12:52:58 +01:00
Matthias Clasen
246fcd6563 Complete docs for gtk_stack_get_interpolate_size 2015-12-15 09:48:16 -05:00
Matthias Clasen
9c63170e70 stack: Convert to gadgets 2015-12-15 08:41:16 -05:00
Matt Watson
ae487840f0 gtkstack: remove needless queue_resize
In gtk_stack_set_transition_position we should only need to
queue_resize if we are non-homogeneous, which is already done
earlier in the function.
2015-12-10 16:51:29 -08:00
Matthias Clasen
373ce9f652 stack: Update windows before allocating children
Doing things the other way around seems to cause problems in
some cases where children want to do different things depending
on the window position.

https://bugzilla.gnome.org/show_bug.cgi?id=758563
2015-11-30 10:41:13 -05:00
Timm Bäder
f154875e08 GtkStack: Add some missing nullable annotations 2015-11-24 11:16:51 +01:00
Carlos Soriano
9f3839066e gtkstack: allow templates to override all properties
Currently GtkStack has some G_PARAM_CONSTRUCT properties. That means,
the properties are set with its default value after the initializacion
of the object.
When using GtkBuilder to build objects, GtkBuilder creates them and
after that sets the properties found on the xml definition.
However, this is not true for templates because the template is initialized
in the init() function of the actual object, and after that, the construct
properties will be set.

This is a problem when someone wants to use templates with GtkStack and
set those properties, since they will be set on the tempalt initialization
and set again to its default values afterwards.

To fix this, make those properties not G_PARAM_CONSTRUCT.

https://bugzilla.gnome.org/show_bug.cgi?id=758086
2015-11-19 14:50:09 -05:00
Matthias Clasen
14f4b7ead2 Avoid excessive property notification for GtkStack::interpolate-size
make check checks this for writable properties, and fails now that
we've made this property writable.
2015-11-09 14:53:25 -05:00
Benjamin Otte
c7491fa144 stack: Store actual widget size, not preferred size
This is just a cleanup commit, no actual bug.
2015-11-05 15:23:12 +01:00
Benjamin Otte
b6b00c31d7 stack: Queue a resize/allocate when switching children
We only allocate a size to the currently visible child, so we obviously
need to rerun allocation when the visible child changes.

In the case where the stack is not homogenous, we also need to queue a
resize because our size request just changed.
2015-11-04 19:39:29 +01:00
Matthias Clasen
910f4f72ba stack: Set an element name
And it is...stack.
2015-11-03 23:20:24 -05:00