[gtk/placeholder-alignment] text: Propagate xalign to the placeholder




commit 9f93883dc9a93785e77a7f16501c41270ef9018e
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 27 06:57:23 2021 -0400

    text: Propagate xalign to the placeholder
    
    This is what we were doing in GTK 3, and there's
    no reason not to continue.
    
    Fixes: #3979

 gtk/gtktext.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index bf9d8e2c84..2416e980f9 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -5914,6 +5914,9 @@ gtk_text_set_alignment (GtkText *self,
     {
       priv->xalign = xalign;
       gtk_text_recompute (self);
+      if (priv->placeholder)
+        gtk_label_set_xalign (GTK_LABEL (priv->placeholder), xalign);
+
       g_object_notify (G_OBJECT (self), "xalign");
     }
 }
@@ -6638,7 +6641,7 @@ gtk_text_set_placeholder_text (GtkText    *self,
       priv->placeholder = g_object_new (GTK_TYPE_LABEL,
                                         "label", text,
                                         "css-name", "placeholder",
-                                        "xalign", 0.0f,
+                                        "xalign", priv->xalign,
                                         "ellipsize", PANGO_ELLIPSIZE_END,
                                         NULL);
       gtk_label_set_attributes (GTK_LABEL (priv->placeholder), priv->attrs);


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