[gtk+/wip/baedert/drawing: 20/73] revealer: Request child size for NONE transition type
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 20/73] revealer: Request child size for NONE transition type
- Date: Thu, 22 Jun 2017 08:07:00 +0000 (UTC)
commit b8cdfa84d705af4ebb8b8372adec7a85a5c3fe3d
Author: Timm Bäder <mail baedert org>
Date: Sun Jun 4 18:33:08 2017 +0200
revealer: Request child size for NONE transition type
Previously, we would request a size of 0×0 when the transition type was
NONE and the child un-revealed, making the revealer in this case a
gtk_widget_set_visible replacement. Instead, to the exact same thing we
do in the CROSSFADE case and request the child size instead. This also
keeps the revealer from under allocating the child when the transition
type is set to NONE.
gtk/gtkrevealer.c | 17 +++++++++++------
testsuite/gtk/revealer-size.c | 4 ++--
2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 32b87cd..2dbe9c4 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -385,10 +385,17 @@ gtk_revealer_set_position (GtkRevealer *revealer,
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child != NULL &&
new_visible != gtk_widget_get_child_visible (child))
- gtk_widget_set_child_visible (child, new_visible);
+ {
+ gtk_widget_set_child_visible (child, new_visible);
+ gtk_widget_queue_resize (GTK_WIDGET (revealer));
+ }
transition = effective_transition (revealer);
- if (transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE)
+ if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE)
+ {
+ gtk_widget_queue_draw (GTK_WIDGET (revealer));
+ }
+ else if (transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE)
{
gtk_widget_set_opacity (GTK_WIDGET (revealer), priv->current_pos);
gtk_widget_queue_draw (GTK_WIDGET (revealer));
@@ -550,8 +557,7 @@ set_height (GtkRevealer *revealer,
GtkRevealerTransitionType transition;
transition = effective_transition (revealer);
- if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
- transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
+ if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP ||
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN)
{
*minimum_height = round (*minimum_height * priv->current_pos);
@@ -568,8 +574,7 @@ set_width (GtkRevealer *revealer,
GtkRevealerTransitionType transition;
transition = effective_transition (revealer);
- if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
- transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
+ if (transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT ||
transition == GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT)
{
*minimum_width = round (*minimum_width * priv->current_pos);
diff --git a/testsuite/gtk/revealer-size.c b/testsuite/gtk/revealer-size.c
index fefae48..4fbea9c 100644
--- a/testsuite/gtk/revealer-size.c
+++ b/testsuite/gtk/revealer-size.c
@@ -85,13 +85,13 @@ slide_left_no_animations ()
static void
none_animations ()
{
- keep_size (0, GTK_REVEALER_TRANSITION_TYPE_NONE, TRUE);
+ keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, TRUE);
}
static void
none_no_animations ()
{
- keep_size (0, GTK_REVEALER_TRANSITION_TYPE_NONE, FALSE);
+ keep_size (KEEP_WIDTH | KEEP_HEIGHT, GTK_REVEALER_TRANSITION_TYPE_NONE, FALSE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]