[gnome-builder] layout: prenotify the destination stack of new colors



commit ef765da7ea5d70f80b9e764c60200024f54823e1
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jul 5 19:14:18 2017 -0700

    layout: prenotify the destination stack of new colors
    
    This adjust the colors of the target stack sooner so that we
    can begin updating CSS sooner.
    
    We still need some more tricks to make the CSS invalidations
    fast while transitioning, but this is strictly better than what
    we had previously.

 libide/layout/ide-layout-stack.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/libide/layout/ide-layout-stack.c b/libide/layout/ide-layout-stack.c
index 647f87a..8761b3a 100644
--- a/libide/layout/ide-layout-stack.c
+++ b/libide/layout/ide-layout-stack.c
@@ -843,6 +843,8 @@ _ide_layout_stack_transfer (IdeLayoutStack *self,
 {
   IdeLayoutStackPrivate *priv = ide_layout_stack_get_instance_private (self);
   IdeLayoutStackPrivate *dest_priv = ide_layout_stack_get_instance_private (dest);
+  const GdkRGBA *fg;
+  const GdkRGBA *bg;
 
   g_return_if_fail (IDE_IS_LAYOUT_STACK (self));
   g_return_if_fail (IDE_IS_LAYOUT_STACK (dest));
@@ -850,6 +852,18 @@ _ide_layout_stack_transfer (IdeLayoutStack *self,
   g_return_if_fail (GTK_WIDGET (priv->stack) == gtk_widget_get_parent (GTK_WIDGET (view)));
 
   /*
+   * Inform the destination stack about our new primary colors so that it can
+   * begin a transition to the new colors. We also want to do this upfront so
+   * that we can reduce the amount of style invalidation caused during the
+   * transitions.
+   */
+
+  fg = ide_layout_view_get_primary_color_fg (view);
+  bg = ide_layout_view_get_primary_color_bg (view);
+  _ide_layout_stack_header_set_foreground_rgba (dest_priv->header, fg);
+  _ide_layout_stack_header_set_background_rgba (dest_priv->header, bg);
+
+  /*
    * If both the old and the new stacks are mapped, we can animate
    * between them using a snapshot of the view. Well, we also need
    * to be sure they have a valid allocation, but that check is done


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]