Jürgen Spitzmüller wrote:
rgheck wrote:
Jurgen??

I do not fully follow this discussion,
It all started because someone made the reasonable request to be able to stop the cursor blinking. (This is an accessibility issue.) This can be configured through Qt4 config, so the right way to do it is to read the Qt4 value. That's simple enough, but getting the patch to work involves unraveling a few things.

but the patch itself looks sensible to me. If it is thoroughly tested, it can 
go in.

Thoroughly? Hard to know. Perhaps we should wait a bit and see if we get any problems in trunk. I'll patch it into my local 1.5.4svn tree, which is what I used for actual work, and see if I run into anything bad. Others should do so, too, please. I guess the main thing for someone to test here is that forked calls still work right. I don't use any graphics and such so I'm not sure how to test it.

This is a bit different in branch. The attached patch is what we need here. I don't know if people will think this is OK: I'm checking QApplication::cursorFlashTime() in frontends::WorkArea. In principle, I guess that's a no-no, since we're not in frontends/qt4, but it doesn't really matter, since there isn't any other frontend and, in trunk, everything is changed, anyway.

rh

Index: src/frontends/WorkArea.h
===================================================================
--- src/frontends/WorkArea.h	(revision 22750)
+++ src/frontends/WorkArea.h	(working copy)
@@ -130,6 +130,8 @@
 	int id_;
 	///
 	void displayMessage(docstring const &);
+	/// events to be triggered by general_timer_ should go here
+	void handleRegularEvents();
 	/// buffer messages signal connection
 	boost::signals::connection message_connection_;
 
@@ -138,6 +140,10 @@
 
 	///
 	Timeout 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.
+	Timeout general_timer_;
 };
 
 } // namespace frontend
Index: src/frontends/WorkArea.cpp
===================================================================
--- src/frontends/WorkArea.cpp	(revision 22750)
+++ src/frontends/WorkArea.cpp	(working copy)
@@ -42,6 +42,8 @@
 #include <boost/bind.hpp>
 #include <boost/current_function.hpp>
 
+#include <QtGui/QApplication>
+
 using lyx::support::ForkedcallsController;
 
 using std::endl;
@@ -57,7 +59,8 @@
 // to these connections we avoid a segfault upon startup, and also at exit.
 // (Lgb)
 
-boost::signals::connection timecon;
+//not currently used
+//boost::signals::connection timecon;
 
 } // anon namespace
 
@@ -66,18 +69,21 @@
 
 WorkArea::WorkArea(int id, LyXView & lyx_view)
 	: buffer_view_(0), lyx_view_(lyx_view), greyed_out_(true),
-	  id_(id), cursor_visible_(false), cursor_timeout_(400)
+	  id_(id), cursor_visible_(false), cursor_timeout_(500),
+	  general_timer_(500)
 {
 	// Start loading the pixmap as soon as possible
 	//if (lyxrc.show_banner) {
 	//	showBanner();
 	//}
-
-	// Setup the signals
-	timecon = cursor_timeout_.timeout
-		.connect(boost::bind(&WorkArea::toggleCursor, this));
-
-	cursor_timeout_.start();
+	
+	cursor_timeout_.timeout.connect(boost::bind(&WorkArea::toggleCursor, this));
+	general_timer_.timeout.connect(boost::bind(&WorkArea::handleRegularEvents, this));
+	int const time = QApplication::cursorFlashTime() / 2;
+	if (time > 0) {
+		cursor_timeout_.setTimeout(time);
+		cursor_timeout_.start();
+	}
 }
 
 
@@ -333,23 +339,26 @@
 void WorkArea::toggleCursor()
 {
 	if (buffer_view_->buffer()) {
-
 		if (cursor_visible_)
 			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.
-		ForkedcallsController & fcc = ForkedcallsController::get();
-		fcc.handleCompletedProcesses();
 	}
+	//we're not supposed to cache this value.
+	int const time = QApplication::cursorFlashTime() / 2;
+	if (time <= 0)
+		return;
+	cursor_timeout_.setTimeout(time);
+	cursor_timeout_.start();
+}
 
-	cursor_timeout_.restart();
+
+void WorkArea::handleRegularEvents() 
+{
+	ForkedcallsController & fcc = ForkedcallsController::get();
+	fcc.handleCompletedProcesses();
 }
 
-
 void WorkArea::displayMessage(lyx::docstring const & message)
 {
 	lyx_view_.message(message);

Reply via email to