From b4c37e82c1180dfc9556b935d605e817b05f17cd Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 5 Feb 2008 00:37:30 +0000 Subject: [PATCH] Additional fixes related to disentangling the blinking cursor signal from other signals. Thanks to Abdel for pointing out the need for this. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22779 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiWorkArea.cpp | 25 +++++++++++++++++-------- src/frontends/qt4/GuiWorkArea.h | 4 ++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 5c5b21abdd..0f2c0114db 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -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(); } } diff --git a/src/frontends/qt4/GuiWorkArea.h b/src/frontends/qt4/GuiWorkArea.h index ed54cb87a6..d1a65e3f06 100644 --- a/src/frontends/qt4/GuiWorkArea.h +++ b/src/frontends/qt4/GuiWorkArea.h @@ -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);