]> git.lyx.org Git - features.git/commitdiff
Let the cursor blink frequency depend on qt settings.
authorPavel Sanda <sanda@lyx.org>
Sat, 2 Feb 2008 03:05:54 +0000 (03:05 +0000)
committerPavel Sanda <sanda@lyx.org>
Sat, 2 Feb 2008 03:05:54 +0000 (03:05 +0000)
Move checking of forked processes into independent timer.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22749 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiWorkArea.cpp
src/frontends/qt4/GuiWorkArea.h

index e31d15a55a38ca2e7912ac66de8ef22c0f26fb73..524494788c9e89e0cfb13038488f48c581c05945 100644 (file)
@@ -197,11 +197,20 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
 {
        buffer.workAreaManager().add(this);
        // Setup the signals
-       cursor_timeout_.setInterval(400);
        connect(&cursor_timeout_, SIGNAL(timeout()),
                this, SLOT(toggleCursor()));
-
-       cursor_timeout_.start();
+       
+       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);
+
+       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::stopBlinkingCursor()
 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 @@ void GuiWorkArea::toggleCursor()
                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 313e5fbc87fa0bbb78d56990da3f3adf8c9a2d20..ed54cb87a65296c8a0e7a14c41fa1a1d7b43ac09 100644 (file)
@@ -142,7 +142,8 @@ private Q_SLOTS:
        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 @@ private:
 
        ///
        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_;
        ///