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
This commit is contained in:
Richard Heck 2008-02-05 00:37:30 +00:00
parent 087dbc1a2d
commit b4c37e82c1
2 changed files with 21 additions and 8 deletions

View File

@ -211,7 +211,7 @@ GuiWorkArea::GuiWorkArea(Buffer & buffer, GuiView & lv)
general_timer_.setInterval(500); general_timer_.setInterval(500);
connect(&general_timer_, SIGNAL(timeout()), connect(&general_timer_, SIGNAL(timeout()),
this, SLOT(handleRegularEvents())); this, SLOT(handleRegularEvents()));
general_timer_.start(); startGeneralTimer();
screen_ = QPixmap(viewport()->width(), viewport()->height()); screen_ = QPixmap(viewport()->width(), viewport()->height());
cursor_ = new frontend::CursorWidget(); cursor_ = new frontend::CursorWidget();
@ -333,11 +333,16 @@ void GuiWorkArea::redraw()
void GuiWorkArea::processKeySym(KeySymbol const & key, KeyModifier mod) void GuiWorkArea::processKeySym(KeySymbol const & key, KeyModifier mod)
{ {
// In order to avoid bad surprise in the middle of an operation, // 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(); stopBlinkingCursor();
// ...and the general timer.
stopGeneralTimer();
theLyXFunc().setLyXView(lyx_view_); theLyXFunc().setLyXView(lyx_view_);
theLyXFunc().processKeySym(key, mod); 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 else
cmd = cmd0; 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 // In order to avoid bad surprise in the middle of an operation, we better stop
// the blinking cursor. // the blinking cursor and the general timer
if (!(cmd.action == LFUN_MOUSE_MOTION if (notJustMovingTheMouse) {
&& cmd.button() == mouse_button::none))
stopBlinkingCursor(); stopBlinkingCursor();
stopGeneralTimer();
}
buffer_view_->mouseEventDispatch(cmd); 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. // GUI tweaks except with mouse motion with no button pressed.
if (!(cmd.action == LFUN_MOUSE_MOTION if (notJustMovingTheMouse) {
&& cmd.button() == mouse_button::none)) {
// Slight hack: this is only called currently when we // Slight hack: this is only called currently when we
// clicked somewhere, so we force through the display // clicked somewhere, so we force through the display
// of the new status here. // of the new status here.
lyx_view_->clearMessage(); lyx_view_->clearMessage();
// Show the cursor immediately after any operation. // Show the cursor immediately after any operation
startBlinkingCursor(); startBlinkingCursor();
startGeneralTimer();
} }
} }

View File

@ -121,6 +121,10 @@ public:
void stopBlinkingCursor(); void stopBlinkingCursor();
/// ///
void startBlinkingCursor(); void startBlinkingCursor();
///
void startGeneralTimer() { general_timer_.start(); }
///
void stopGeneralTimer() { general_timer_.stop(); }
/// Process Key pressed event. /// Process Key pressed event.
/// This needs to be public because it is accessed externally by GuiView. /// This needs to be public because it is accessed externally by GuiView.
void processKeySym(KeySymbol const & key, KeyModifier mod); void processKeySym(KeySymbol const & key, KeyModifier mod);