[gtk/placeholder-visibility] text: Update placeholder visibility more often
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/placeholder-visibility] text: Update placeholder visibility more often
- Date: Sun, 4 Jul 2021 02:17:10 +0000 (UTC)
commit c79f289d67e101a5539fcf05123a2c3589bb3345
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 3 22:15:38 2021 -0400
text: Update placeholder visibility more often
We need to update the visibility of the placeholder
label when we create it, otherwise we can end up
with placeholder text on top of entry content.
Fixes: #4066
gtk/gtktext.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 2416e980f9..f3c23c3365 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3580,7 +3580,8 @@ update_placeholder_visibility (GtkText *self)
if (priv->placeholder)
gtk_widget_set_child_visible (priv->placeholder,
priv->preedit_length == 0 &&
- gtk_entry_buffer_get_length (priv->buffer) == 0);
+ (priv->buffer == NULL ||
+ gtk_entry_buffer_get_length (priv->buffer) == 0));
}
/* GtkEntryBuffer signal handlers
@@ -6652,6 +6653,8 @@ gtk_text_set_placeholder_text (GtkText *self,
gtk_label_set_text (GTK_LABEL (priv->placeholder), text);
}
+ update_placeholder_visibility (self);
+
g_object_notify_by_pspec (G_OBJECT (self), text_props[PROP_PLACEHOLDER_TEXT]);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]