[gtk+/wip/matthiasc/caret: 4/8] entry: Respect caret-animation CSS	property
- From: Matthias Clasen <matthiasc src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gtk+/wip/matthiasc/caret: 4/8] entry: Respect caret-animation CSS	property
 
- Date: Mon, 11 Jan 2016 05:10:57 +0000 (UTC)
 
commit 6c97f4385826892e6e5fa32091839289e3cdc7c5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 10 19:01:33 2016 -0500
    entry: Respect caret-animation CSS property
    
    When deciding whether to blink the caret in an entry, consult
    the caret-animation property.
 gtk/gtkentry.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 8af9479..e983a3e 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -10345,11 +10345,25 @@ cursor_blinks (GtkEntry *entry)
       priv->editable &&
       priv->selection_bound == priv->current_pos)
     {
-      GtkSettings *settings;
       gboolean blink;
+      GtkStyleContext *context;
+      GtkCssValue *value;
+      GtkCssCaretAnimation anim;
 
-      settings = gtk_widget_get_settings (GTK_WIDGET (entry));
-      g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
+      context = gtk_widget_get_style_context (GTK_WIDGET (entry));
+      value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_CARET_ANIMATION);
+      anim = _gtk_css_caret_animation_value_get (value);
+      if (anim == GTK_CSS_CARET_ANIMATION_AUTO)
+        {
+          GtkSettings *settings;
+
+          settings = gtk_widget_get_settings (GTK_WIDGET (entry));
+          g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
+        }
+      else if (anim == GTK_CSS_CARET_ANIMATION_BLINK)
+        blink = TRUE;
+      else
+        blink = FALSE;
 
       return blink;
     }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]