After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694769 - Add support for slide transitions to GdStack
Add support for slide transitions to GdStack
Status: RESOLVED FIXED
Product: libgd
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: libgd maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-02-26 22:28 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2013-03-19 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gd-stack: Remove last_visible_pattern_width/height (2.84 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
gd-stack: Remove some initializations (1.01 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
gd-stack: Disable transitions when we have gtk-enable-animations disabled (1010 bytes, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
gd-stack: Split crossfade-y parts into other functions (6.91 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
gd-stack: Move transition implementations into vfuncs (7.00 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
gd-stack: Don't make calls to transition vfuncs when not transitioning (1.68 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
gd-stack: Put transition-specific data in its own structure (4.43 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
gd-stack: Split out size_allocate as well (2.79 KB, patch)
2013-02-26 22:28 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
gd-stack: Add a tick handler (2.25 KB, patch)
2013-02-26 22:29 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
gd-stack: Add some slide transitions (4.22 KB, patch)
2013-02-26 22:29 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
gd-stack: Put transition-specific data in its own structure (4.47 KB, patch)
2013-02-26 23:23 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
gd-stack: Put transition-specific data in its own structure (4.39 KB, patch)
2013-02-27 06:19 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
GdStack: Add windows (5.50 KB, patch)
2013-02-27 12:02 UTC, Alexander Larsson
committed Details | Review
GdStack: Add sliding transitions (7.66 KB, patch)
2013-02-27 12:02 UTC, Alexander Larsson
committed Details | Review
test-stack: Add tests for all transition types (2.47 KB, patch)
2013-02-27 12:02 UTC, Alexander Larsson
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:37 UTC
See patch set. I'm not entirely happy with the approach, but I think
it's fairly clean.
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:39 UTC
Created attachment 237477 [details] [review]
gd-stack: Remove last_visible_pattern_width/height

Since stacks are homogenous, we should never have to track this
in order to do a cross-fade.
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:42 UTC
Created attachment 237478 [details] [review]
gd-stack: Remove some initializations

As the properties that govern these are CONSTRUCT properties,
gobject will set the defaults for us.
Comment 3 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:45 UTC
Created attachment 237479 [details] [review]
gd-stack: Disable transitions when we have gtk-enable-animations disabled
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:48 UTC
Created attachment 237480 [details] [review]
gd-stack: Split crossfade-y parts into other functions
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:50 UTC
Created attachment 237481 [details] [review]
gd-stack: Move transition implementations into vfuncs

This will make it easier to add more transitions in the future without
making the system too flexible.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:53 UTC
Created attachment 237482 [details] [review]
gd-stack: Don't make calls to transition vfuncs when not transitioning

This prevents extra waste, and will prevent against extra checks when
making more attempts to split the transition infrastructure out.
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:56 UTC
Created attachment 237483 [details] [review]
gd-stack: Put transition-specific data in its own structure

As we want to add more transitions, this keeps it out of the
main structure.
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:28:59 UTC
Created attachment 237484 [details] [review]
gd-stack: Split out size_allocate as well

Sliding transitions will require a different size_allocate, so
let's clean up this for now.
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:29:02 UTC
Created attachment 237485 [details] [review]
gd-stack: Add a tick handler

The cross-fade will queue a redraw from here, and the slide
will queue a relayout.
Comment 10 Jasper St. Pierre (not reading bugmail) 2013-02-26 22:29:05 UTC
Created attachment 237486 [details] [review]
gd-stack: Add some slide transitions

This allows people to slide pages left or right instead of
cross-fading, which would be useful in an assistant scenario.
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-02-26 23:23:34 UTC
Created attachment 237487 [details] [review]
gd-stack: Put transition-specific data in its own structure

As we want to add more transitions, this keeps it out of the
main structure.



Fix a crash that can happen if you add a bunch of widgets to the
stack while using the CROSSFADE transition style.
Comment 12 Cosimo Cecchi 2013-02-27 05:46:18 UTC
Review of attachment 237477 [details] [review]:

Are animations guaranteed to be turned off when homogeneous is FALSE? If so, this looks good.
Comment 13 Cosimo Cecchi 2013-02-27 05:46:31 UTC
Review of attachment 237478 [details] [review]:

OK
Comment 14 Cosimo Cecchi 2013-02-27 05:46:40 UTC
Review of attachment 237479 [details] [review]:

Nice
Comment 15 Cosimo Cecchi 2013-02-27 05:46:54 UTC
Review of attachment 237480 [details] [review]:

Nice cleanup - can you explain this change though?

::: libgd/gd-stack.c
@@ +445,3 @@
   done = pos >= 1.0;
 
+  if (done)

I wonder if removing the (priv->last_visible_pattern != NULL) here changes any semantic for the following set_child_visible call.
Comment 16 Cosimo Cecchi 2013-02-27 05:47:03 UTC
Review of attachment 237481 [details] [review]:

Looks good
Comment 17 Cosimo Cecchi 2013-02-27 05:47:14 UTC
Review of attachment 237482 [details] [review]:

Shouldn't the existing transition_pos < 1 have the same effect?
Comment 18 Cosimo Cecchi 2013-02-27 05:47:26 UTC
Review of attachment 237487 [details] [review]:

::: libgd/gd-stack.c
@@ +1103,3 @@
+  cairo_pattern_t *last_visible_pattern;
+  int last_visible_pattern_width;
+  int last_visible_pattern_height;

These are back?
Comment 19 Cosimo Cecchi 2013-02-27 05:47:36 UTC
Review of attachment 237484 [details] [review]:

OK
Comment 20 Cosimo Cecchi 2013-02-27 05:47:44 UTC
Review of attachment 237485 [details] [review]:

OK
Comment 21 Cosimo Cecchi 2013-02-27 05:47:52 UTC
Review of attachment 237486 [details] [review]:

Cool!
Comment 22 Jasper St. Pierre (not reading bugmail) 2013-02-27 06:19:11 UTC
Created attachment 237495 [details] [review]
gd-stack: Put transition-specific data in its own structure

As we want to add more transitions, this keeps it out of the
main structure.



Hm, the "don't make calls" was originally much larger, but it seems that
was trimmed down over time.

I removed the extra two fields that came back (yay bad rebases) -- now
we're allocating a pointer-sized structure -- if you want me to take the
intermediate structure out, I can do that.
Comment 23 Alexander Larsson 2013-02-27 07:55:27 UTC
Review of attachment 237477 [details] [review]:

I added this because we now do crossfade on non-homogenous stacks too
Comment 24 Alexander Larsson 2013-02-27 08:04:37 UTC
Review of attachment 237480 [details] [review]:

::: libgd/gd-stack.c
@@ +445,3 @@
   done = pos >= 1.0;
 
+  if (done)

Yeah, this seems wrong. We want to hide the last visible child as soon as we have a snapshot of it. This will keep the child visible and any windows of it mapped, which will let the user modify state and interact with those widgets.

@@ +455,1 @@
+      gd_stack_transition_done_crossfade (stack);

I don't think last_visible_pattern is really crossfade specific. We want to use it for all animations, so that we can show the last state in the old widget for the animation, rather than keep showing any changes in state in the old widget during the animation.

@@ +525,3 @@
+      switch (priv->transition_type) {
+      case GD_STACK_TRANSITION_TYPE_CROSSFADE:
+        gtk_widget_set_opacity (widget, 0.999);

We need this for other transition types too, if we want to take a snapshot.
Comment 25 Alexander Larsson 2013-02-27 08:15:16 UTC
Review of attachment 237486 [details] [review]:

I don't think this is right at all.
There are several issues.
First of all you're continually redrawing the "old" widget, rather than working with a snapshot of it. I don't think its right to show any kind of state changes in the old widget as we move to the new one. Its commonly gonna be the case that you e.g. reset the state of the old widget in some ways (loses focus, clear data from entries, etc) which should not be seen during the transition. Furthermore, you also allow events to the old widget meaning the user will be able to interact with it, which is pretty bad.

Secondly, you can't just size allocate the children so that they are outside the stack allocation. That will be completely broken for any windows in the child widgets, as GdStack as-is is a non-window widget, and will not clip such child windows.
Comment 26 Alexander Larsson 2013-02-27 08:17:49 UTC
I basically disagree with most of this series. I'll try to come up with an alternative version.
Comment 27 Alexander Larsson 2013-02-27 08:20:12 UTC
Attachment 237478 [details] pushed as 83d366e - gd-stack: Remove some initializations
Attachment 237479 [details] pushed as 8a3d891 - gd-stack: Disable transitions when we have gtk-enable-animations disabled
Comment 28 Alexander Larsson 2013-02-27 12:02:21 UTC
Created attachment 237514 [details] [review]
GdStack: Add windows

This adds a base window which is needed for clipping child windows when we
start sliding them. It also adds a bin window that makes it more efficient
to slide child widgets/windows.
Comment 29 Alexander Larsson 2013-02-27 12:02:24 UTC
Created attachment 237515 [details] [review]
GdStack: Add sliding transitions

Note: This requires the latest gtk+ version as there was
a bug in the opacity group support.
Comment 30 Alexander Larsson 2013-02-27 12:02:27 UTC
Created attachment 237516 [details] [review]
test-stack: Add tests for all transition types
Comment 31 Alexander Larsson 2013-02-27 12:04:05 UTC
Here is my approach. It correctly clips child windows, it doesn't relayout during animation, it scrolls via xcopyarea and it doesn't update the old widget due to state changes after the initial expose (nor does it allow interaction with it).
Comment 32 Cosimo Cecchi 2013-02-27 15:51:00 UTC
Review of attachment 237514 [details] [review]:

Looks good otherwise - I think Alex's approoach is indeed much cleaner.

::: libgd/gd-stack.c
@@ +273,3 @@
+    }
+
+  attributes.event_mask =

Copy/paste leftover?
Comment 33 Cosimo Cecchi 2013-02-27 15:51:21 UTC
Review of attachment 237515 [details] [review]:

OK
Comment 34 Cosimo Cecchi 2013-02-27 15:51:30 UTC
Review of attachment 237516 [details] [review]:

Sure
Comment 35 Jasper St. Pierre (not reading bugmail) 2013-02-27 16:58:55 UTC
Note that your stack doesn't apply an ease to the slide. You should probably add that.
Comment 36 Alexander Larsson 2013-02-28 09:12:28 UTC
Attachment 237514 [details] pushed as deb4a9a - GdStack: Add windows
Attachment 237515 [details] pushed as d1f34e1 - GdStack: Add sliding transitions
Attachment 237516 [details] pushed as 3432e75 - test-stack: Add tests for all transition types
Comment 37 Alexander Larsson 2013-02-28 09:14:28 UTC
Pushed this with fixes to the comments and ease-out.

Jasper had another comment about how my patch handles the "interrupted slide" case. My code doesn't do this very nicely. But, what is the right behaviour here? Should we just keep the partially slid in "old new" widget in there and start sliding in the new one directly? Do we queue them up?
Comment 38 Jasper St. Pierre (not reading bugmail) 2013-02-28 14:55:21 UTC
(In reply to comment #37)
> Pushed this with fixes to the comments and ease-out.
> 
> Jasper had another comment about how my patch handles the "interrupted slide"
> case. My code doesn't do this very nicely. But, what is the right behaviour
> here? Should we just keep the partially slid in "old new" widget in there and
> start sliding in the new one directly? Do we queue them up?

I think it would be nice to imagine the stack as one giant thing, and that the slide is just a pan over it, so if you can, doing the tricky thing of showing both widgets you're skipping over in the animation would be nice.
Comment 39 Alexander Larsson 2013-03-01 15:06:34 UTC
I pushed some stuff preparing for a nicer panning. Also fixes some gtk issues that made things not work with complex stack children (added to testcase).
Comment 40 Debarshi Ray 2013-03-19 15:06:18 UTC
The following commit breaks the panels in gnome-control-center. Try Backgrounds or Users for an example.

commit deb4a9af27524fd11c1e67d28dbc47c1a4536186
Author: Alexander Larsson <alexl@redhat.com>
Date:   Wed Feb 27 10:35:06 2013 +0100

    GdStack: Add windows
    
    This adds a base window which is needed for clipping child windows when we
    start sliding them. It also adds a bin window that makes it more efficient
    to slide child widgets/windows.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694769
Comment 41 Cosimo Cecchi 2013-03-19 23:48:29 UTC
That has been fixed now in libgd master.
Since the topic of this bug is fully implemented, I'm going to close this as FIXED.