Fix bug 5065: DEPM fails with "cursor follows scrollbar"

http://bugzilla.lyx.org/show_bug.cgi?id=5065

	* BufferView.cpp (setCursorFromScrollbar): makes sure that the mouse is 	set using mouseSetCursor (so that dEPM can trigger). 



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26158 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-08-14 09:59:04 +00:00
parent 1b2c73c555
commit aa67d5eb64

View File

@ -606,31 +606,28 @@ void BufferView::setCursorFromScrollbar()
int const height = 2 * defaultRowHeight();
int const first = height;
int const last = height_ - height;
Cursor & cur = d->cursor_;
int newy = 0;
Cursor const & oldcur = d->cursor_;
switch (cursorStatus(cur)) {
switch (cursorStatus(oldcur)) {
case CUR_ABOVE:
// We reset the cursor because cursorStatus() does not
// work when the cursor is within mathed.
cur.reset(buffer_.inset());
tm.setCursorFromCoordinates(cur, 0, first);
cur.clearSelection();
newy = first;
break;
case CUR_BELOW:
// We reset the cursor because cursorStatus() does not
// work when the cursor is within mathed.
cur.reset(buffer_.inset());
tm.setCursorFromCoordinates(cur, 0, last);
cur.clearSelection();
newy = last;
break;
case CUR_INSIDE:
int const y = getPos(cur, cur.boundary()).y_;
int const newy = min(last, max(y, first));
if (y != newy) {
cur.reset(buffer_.inset());
tm.setCursorFromCoordinates(cur, 0, newy);
}
int const y = getPos(oldcur, oldcur.boundary()).y_;
newy = min(last, max(y, first));
if (y == newy)
return;
}
// We reset the cursor because cursorStatus() does not
// work when the cursor is within mathed.
Cursor cur(*this);
cur.reset(buffer_.inset());
tm.setCursorFromCoordinates(cur, 0, newy);
mouseSetCursor(cur);
}