]> git.lyx.org Git - features.git/commitdiff
Additional fixes related to disentangling the blinking cursor signal from other signa...
authorRichard Heck <rgheck@comcast.net>
Tue, 5 Feb 2008 00:37:30 +0000 (00:37 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 5 Feb 2008 00:37:30 +0000 (00:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22779 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 5c5b21abdd9439ef7b43e5e133b231b0872b1e58..0f2c0114db68a80b17ac5d9f52c9fc73ef4525b8 100644 (file)
@@ -211,7 +211,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
        general_timer_.setInterval(500);
        connect(&general_timer_, SIGNAL(timeout()),
                this, SLOT(handleRegularEvents()));
-       general_timer_.start();
+       startGeneralTimer();
 
        screen_ = QPixmap(viewport()->width(), viewport()->height());
        cursor_ = new frontend::CursorWidget();
@@ -333,11 +333,16 @@ void GuiWorkArea::redraw()
 void GuiWorkArea::processKeySym(KeySymbol const & key, KeyModifier mod)
 {
        // In order to avoid bad surprise in the middle of an operation,
-       // we better stop the blinking cursor.
+       // we better stop the blinking cursor...
        stopBlinkingCursor();
+       // ...and the general timer.
+       stopGeneralTimer();
 
        theLyXFunc().setLyXView(lyx_view_);
        theLyXFunc().processKeySym(key, mod);
+       
+       // the cursor gets restarted in GuiView::restartCursor()
+       startGeneralTimer();
 }
 
 
@@ -364,11 +369,15 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
        else
                cmd = cmd0;
 
+       bool const notJustMovingTheMouse = 
+               cmd.action != LFUN_MOUSE_MOTION || cmd.button() != mouse_button::none;
+       
        // In order to avoid bad surprise in the middle of an operation, we better stop
-       // the blinking cursor.
-       if (!(cmd.action == LFUN_MOUSE_MOTION
-               && cmd.button() == mouse_button::none))
+       // the blinking cursor and the general timer
+       if (notJustMovingTheMouse) {
                stopBlinkingCursor();
+               stopGeneralTimer();
+       }
 
        buffer_view_->mouseEventDispatch(cmd);
 
@@ -379,15 +388,15 @@ void GuiWorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
        }
 
        // GUI tweaks except with mouse motion with no button pressed.
-       if (!(cmd.action == LFUN_MOUSE_MOTION
-               && cmd.button() == mouse_button::none)) {
+       if (notJustMovingTheMouse) {
                // Slight hack: this is only called currently when we
                // clicked somewhere, so we force through the display
                // of the new status here.
                lyx_view_->clearMessage();
 
-               // Show the cursor immediately after any operation.
+               // Show the cursor immediately after any operation
                startBlinkingCursor();
+               startGeneralTimer();
        }
 }
 
index ed54cb87a65296c8a0e7a14c41fa1a1d7b43ac09..d1a65e3f061b9e8440d33d5a5b3a0c27727e1331 100644 (file)
@@ -121,6 +121,10 @@ public:
        void stopBlinkingCursor();
        ///
        void startBlinkingCursor();
+       /// 
+       void startGeneralTimer() { general_timer_.start(); }
+       ///
+       void stopGeneralTimer() { general_timer_.stop(); }
        /// Process Key pressed event.
        /// This needs to be public because it is accessed externally by GuiView.
        void processKeySym(KeySymbol const & key, KeyModifier mod);