diff options
author | Ernestas Kulik <ernestask@gnome.org> | 2018-08-22 12:23:50 +0300 |
---|---|---|
committer | Ernestas Kulik <ernestask@gnome.org> | 2018-08-22 12:23:50 +0300 |
commit | c7a4e7edba6114658d3b11d382f5f3423df637a5 (patch) | |
tree | 36b7c7e32cdb870eae74ea211e1926de3e7673f2 | |
parent | 9e0f43e8cba45015487c692058c002f56087b9b8 (diff) | |
download | gtk+-revealer-clipping.tar.gz |
revealer: Only clip child when animatingrevealer-clipping
Currently, GtkRevealer clips the child if the transition type is
sliding, regardless of whether the animation had already ended. An
example where that is a problem would be in Nautilus: the file
operations popover button is animated on reveal to draw attention, but,
given that the button is in turn stashed inside a revealer with a
sliding animation, things suddenly fall apart.
-rw-r--r-- | gtk/gtkrevealer.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index 49aa81458e..7e3950aff7 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -617,30 +617,32 @@ gtk_revealer_snapshot (GtkWidget *widget, GtkSnapshot *snapshot) { GtkRevealer *revealer = GTK_REVEALER (widget); + GtkRevealerPrivate *priv; GtkRevealerTransitionType transition; GtkWidget *child; + gboolean clip_child; + priv = gtk_revealer_get_instance_private (revealer); child = gtk_bin_get_child (GTK_BIN (revealer)); if (child == NULL || !gtk_widget_get_mapped (child)) return; transition = effective_transition (revealer); - if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE || - transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE) - { - gtk_widget_snapshot_child (widget, child, snapshot); - } - else - { - gtk_snapshot_push_clip (snapshot, - &GRAPHENE_RECT_INIT( - 0, 0, - gtk_widget_get_width (widget), - gtk_widget_get_height (widget) - )); - gtk_widget_snapshot_child (widget, child, snapshot); - gtk_snapshot_pop (snapshot); - } + clip_child = transition != GTK_REVEALER_TRANSITION_TYPE_NONE && + transition != GTK_REVEALER_TRANSITION_TYPE_CROSSFADE && + gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER; + if (clip_child) + gtk_snapshot_push_clip (snapshot, + &GRAPHENE_RECT_INIT( + 0, 0, + gtk_widget_get_width (widget), + gtk_widget_get_height (widget) + )); + + gtk_widget_snapshot_child (widget, child, snapshot); + + if (clip_child) + gtk_snapshot_pop (snapshot); } /** |