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.
This commit is contained in:
Matthias Clasen 2020-01-23 15:12:38 -05:00
parent e13692c52f
commit f9e613f8fd

View File

@ -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 */