text view: Respect caret-animation CSS property
When deciding whether to blink the caret in an entry, consult the caret-animation property.
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include "gtktoolbar.h"
|
||||
#include "gtkpixelcacheprivate.h"
|
||||
#include "gtkmagnifierprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
|
||||
#include "a11y/gtktextviewaccessibleprivate.h"
|
||||
|
||||
@@ -6094,8 +6095,10 @@ gtk_text_view_forall (GtkContainer *container,
|
||||
static gboolean
|
||||
cursor_blinks (GtkTextView *text_view)
|
||||
{
|
||||
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
|
||||
gboolean blink;
|
||||
GtkStyleContext *context;
|
||||
GtkCssValue *value;
|
||||
GtkCssCaretAnimation anim;
|
||||
|
||||
#ifdef DEBUG_VALIDATION_AND_SCROLLING
|
||||
return FALSE;
|
||||
@@ -6105,7 +6108,21 @@ cursor_blinks (GtkTextView *text_view)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
|
||||
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 (text_view));
|
||||
g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
|
||||
}
|
||||
else if (anim == GTK_CSS_CARET_ANIMATION_BLINK)
|
||||
blink = TRUE;
|
||||
else
|
||||
blink = FALSE;
|
||||
|
||||
if (!blink)
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user