Ignore the previous one. I overlooked something Abdel said, namely, that we "do other things" on cursor blinks. This patch undoes that connection, so that the cursor can blink (or not) independently of other things. I've also made another change, to reflect JMarc's observation that "we aren't supposed to cache this value".

By the by, it's NOT possible to set 0ms for blink in Qt4Config (on Linux anyway), though you can do this directly in .config/Trolltech.conf, as Mark mentioned...though, if you modify it in Qt4Config, it'll be picked up right away, whereas if you modify it in the file, you seem to have to shut down and restart LyX to see the change.

As before...Jurgen, should this go in branch?

rh

Index: frontends/qt4/GuiWorkArea.cpp
===================================================================
--- frontends/qt4/GuiWorkArea.cpp	(revision 22743)
+++ frontends/qt4/GuiWorkArea.cpp	(working copy)
@@ -197,11 +197,20 @@
 {
 	buffer.workAreaManager().add(this);
 	// Setup the signals
-	cursor_timeout_.setInterval(400);
 	connect(&cursor_timeout_, SIGNAL(timeout()),
 		this, SLOT(toggleCursor()));
+	
+	int const time = QApplication::cursorFlashTime() / 2;
+	if (time > 0) {
+		cursor_timeout_.setInterval(time);
+		cursor_timeout_.start();
+	} else
+		// let's initialize this just to be safe
+		cursor_timeout_.setInterval(500);
 
-	cursor_timeout_.start();
+	general_timer_.setInterval(500);
+	connect(&general_timer_, SIGNAL(timeout()),
+		this, SLOT(handleRegularEvents()));
 
 	screen_ = QPixmap(viewport()->width(), viewport()->height());
 	cursor_ = new frontend::CursorWidget();
@@ -276,6 +285,11 @@
 void GuiWorkArea::startBlinkingCursor()
 {
 	showCursor();
+	//we're not supposed to cache this value.
+	int const time = QApplication::cursorFlashTime() / 2;
+	if (time <= 0)
+		return;
+	cursor_timeout_.setInterval(time);
 	cursor_timeout_.start();
 }
 
@@ -446,10 +460,11 @@
 		hideCursor();
 	else
 		showCursor();
+}
 
-	// Use this opportunity to deal with any child processes that
-	// have finished but are waiting to communicate this fact
-	// to the rest of LyX.
+
+void GuiWorkArea::handleRegularEvents()
+{
 	ForkedCallsController::handleCompletedProcesses();
 }
 
Index: frontends/qt4/GuiWorkArea.h
===================================================================
--- frontends/qt4/GuiWorkArea.h	(revision 22743)
+++ frontends/qt4/GuiWorkArea.h	(working copy)
@@ -142,7 +142,8 @@
 	void doubleClickTimeout();
 	/// toggle the cursor's visibility
 	void toggleCursor();
-
+	/// events to be triggered by general_timer_ should go here
+	void handleRegularEvents();
 	/// close this work area.
 	/// Slot for Buffer::closing signal.
 	void close();
@@ -213,6 +214,10 @@
 
 	///
 	QTimer cursor_timeout_;
+	/// this timer is used for any regular events one wants to
+	/// perform. at present it is used to check if forked processes
+	/// are done.
+	QTimer general_timer_;
 	///
 	SyntheticMouseEvent synthetic_mouse_event_;
 	///

Reply via email to