[gtk/matthiasc/for-master: 7/7] text: Don't compute invisible char in init



commit f9e613f8fda4cf835e7273e1bb4edbcce1776b26
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 23 15:12:38 2020 -0500

    text: Don't compute invisible char in init
    
    This causes us to create a pango layout and
    validate the css style, a high-overhead
    operation. Just do it when the entry is set
    to be invisible.

 gtk/gtktext.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 45b9b3c82c..4227578b43 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1726,6 +1726,7 @@ gtk_text_init (GtkText *self)
   priv->xalign = 0.0;
   priv->insert_pos = -1;
   priv->cursor_alpha = 1.0;
+  priv->invisible_char = 0;
   priv->history = gtk_text_history_new (&history_funcs, self);
 
   gtk_text_history_set_max_undo_levels (priv->history, DEFAULT_MAX_UNDO);
@@ -1756,8 +1757,6 @@ gtk_text_init (GtkText *self)
   g_signal_connect (priv->im_context, "delete-surrounding",
                     G_CALLBACK (gtk_text_delete_surrounding_cb), self);
 
-  gtk_text_update_cached_style_values (self);
-
   priv->drag_gesture = gtk_gesture_drag_new ();
   g_signal_connect (priv->drag_gesture, "drag-update",
                     G_CALLBACK (gtk_text_drag_gesture_update), self);
@@ -5425,6 +5424,7 @@ gtk_text_set_visibility (GtkText  *self,
       priv->visible = visible;
 
       g_object_notify (G_OBJECT (self), "visibility");
+      gtk_text_update_cached_style_values (self);
       gtk_text_recompute (self);
 
       /* disable undo when invisible text is used */


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