[anjuta-extras] bgo #351214 - Anjuta doesn't respect Gnome blinking cursor preference



commit 1978cf503d60e368dd24f3fa076c1a253e8f2083
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sat Mar 10 21:00:16 2012 +0100

    bgo #351214 - Anjuta doesn't respect Gnome blinking cursor preference

 plugins/scintilla/aneditor.cxx                 |   16 +++++++++++++++-
 plugins/scintilla/properties/anjuta.properties |    4 ++--
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/plugins/scintilla/aneditor.cxx b/plugins/scintilla/aneditor.cxx
index 5e0f8aa..7bfd393 100644
--- a/plugins/scintilla/aneditor.cxx
+++ b/plugins/scintilla/aneditor.cxx
@@ -2491,6 +2491,8 @@ SString AnEditor::FindLanguageProperty(const char *pattern, const char *defaultV
 
 void AnEditor::ReadProperties(const char *fileForExt, char **typedef_hl) {
 	//DWORD dwStart = timeGetTime();
+	int blink_time = 500;
+
 	if (fileForExt)
 		strcpy (fileName, fileForExt);
 	else
@@ -2602,8 +2604,20 @@ void AnEditor::ReadProperties(const char *fileForExt, char **typedef_hl) {
 
 	SString caretPeriod = props->Get("caret.period");
 	if (caretPeriod.length()) {
-		SendEditor(SCI_SETCARETPERIOD, caretPeriod.value());
+		blink_time = caretPeriod.value();
+	}
+	else {
+		GtkSettings *settings = gtk_settings_get_default();
+		gboolean blink;
+
+        g_object_get(G_OBJECT (settings),
+                     "gtk-cursor-blink", &blink,
+                     "gtk-cursor-blink-time", &blink_time,
+                     NULL);
+		blink_time /= 2;
+		if (!blink) blink_time = 0;
 	}
+	SendEditor(SCI_SETCARETPERIOD, blink_time);
 
 	int caretSlop = props->GetInt("caret.policy.xslop", 1) ? CARET_SLOP : 0;
 	int caretZone = props->GetInt("caret.policy.width", 50);
diff --git a/plugins/scintilla/properties/anjuta.properties b/plugins/scintilla/properties/anjuta.properties
index c0938b9..195da7b 100644
--- a/plugins/scintilla/properties/anjuta.properties
+++ b/plugins/scintilla/properties/anjuta.properties
@@ -208,8 +208,8 @@ tab.indents=0
 # Pressing backspace means unindent
 backspace.unindents=0
 
-# Caret Blink period in msec
-caret.period=350
+# Caret Blink period in msec (else use GTK value)
+#caret.period=350
 
 # Caret width in pixels
 caret.width=1



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