[gnome-shell] st/entry: Show hint actor while entry is focused



commit 88ac339774e54d8bdeed2259511f5c376a07124c
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Jan 22 20:53:34 2020 +0100

    st/entry: Show hint actor while entry is focused
    
    Also show the hint actor of an StEntry while the entry is focused but
    has no text inside it. This is part of the new dialog and lock-screen
    design where there are no labels before entries anymore and labels are
    instead shown as a hint-text of the entry.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/944

 src/st/st-entry.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index feb90647bc..741ba90ff8 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -232,8 +232,7 @@ st_entry_update_hint_visibility (StEntry *self)
   StEntryPrivate *priv = ST_ENTRY_PRIV (self);
   gboolean hint_visible =
     priv->hint_actor != NULL &&
-    strcmp (clutter_text_get_text (CLUTTER_TEXT (priv->entry)), "") == 0 &&
-    !HAS_FOCUS (priv->entry);
+    strcmp (clutter_text_get_text (CLUTTER_TEXT (priv->entry)), "") == 0;
 
   if (priv->hint_actor)
     g_object_set (priv->hint_actor, "visible", hint_visible, NULL);
@@ -519,10 +518,6 @@ static void
 clutter_text_focus_in_cb (ClutterText  *text,
                           ClutterActor *actor)
 {
-  StEntry *entry = ST_ENTRY (actor);
-
-  st_entry_update_hint_visibility (entry);
-
   st_widget_add_style_pseudo_class (ST_WIDGET (actor), "focus");
   clutter_text_set_cursor_visible (text, TRUE);
 }
@@ -531,12 +526,7 @@ static void
 clutter_text_focus_out_cb (ClutterText  *text,
                            ClutterActor *actor)
 {
-  StEntry *entry = ST_ENTRY (actor);
-
   st_widget_remove_style_pseudo_class (ST_WIDGET (actor), "focus");
-
-  st_entry_update_hint_visibility (entry);
-
   clutter_text_set_cursor_visible (text, FALSE);
 }
 
@@ -548,6 +538,8 @@ clutter_text_changed_cb (GObject    *object,
   StEntry *entry = ST_ENTRY (user_data);
   StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
 
+  st_entry_update_hint_visibility (entry);
+
   /* Since the text changed, force a regen of the shadow texture */
   cogl_clear_object (&priv->text_shadow_material);
 }
@@ -1039,10 +1031,8 @@ st_entry_get_text (StEntry *entry)
   g_return_val_if_fail (ST_IS_ENTRY (entry), NULL);
 
   priv = st_entry_get_instance_private (entry);
-  if (priv->hint_actor != NULL && clutter_actor_is_visible (priv->hint_actor))
-    return "";
-  else
-    return clutter_text_get_text (CLUTTER_TEXT (priv->entry));
+
+  return clutter_text_get_text (CLUTTER_TEXT (priv->entry));
 }
 
 /**
@@ -1064,8 +1054,6 @@ st_entry_set_text (StEntry     *entry,
 
   clutter_text_set_text (CLUTTER_TEXT (priv->entry), text);
 
-  st_entry_update_hint_visibility (entry);
-
   g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_TEXT]);
 }
 


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