better selection and scrolling behaviour

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5769 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-12-03 18:28:17 +00:00
parent 2068180f37
commit c5058bffd8
4 changed files with 31 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2002-12-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* screen.C (fitCursor): remove usleep thingie
(fitManualCursor): ditto
2002-12-03 Lars Gullik Bjønnes <larsbj@gullik.net>
* screen.C (fitManualCursor): add delay if we have a selection

View File

@ -169,10 +169,6 @@ bool LyXScreen::fitManualCursor(BufferView * bv, LyXText * text,
if (newtop != text->first_y) {
draw(text, bv, newtop);
text->first_y = newtop;
// Make the screen not scroll too fast when
// we have a selection.
if (text->selection.set())
usleep(200000);
return true;
}
@ -237,10 +233,6 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
bool const result = (newtop != text->first_y);
if (result) {
draw(text, bv, newtop);
// Make the screen not scroll too fast when
// we have a selection.
if (text->selection.set())
usleep(200000);
}
return result;

View File

@ -1,3 +1,8 @@
2002-12-03 Lars Gullik Bjønnes <larsbj@birdstep.com>
* XWorkArea.C (work_area_handler): send fewer motion events if the
mouse is outside the workarea.
2002-12-02 Angus Leeming <leeming@lyx.org>
* FormIndex.C (update): if the contents aren't empty, then activate the

View File

@ -21,6 +21,7 @@
#include "XLyXKeySym.h"
#include "ColorHandler.h"
#include "funcrequest.h"
#include "Timeout.h"
#if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
#include "lyxlookup.h"
@ -319,6 +320,8 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
static int x_old = -1;
static int y_old = -1;
static double scrollbar_value_old = -1.0;
static int const motion_interval = 200;
static Timeout timdel(motion_interval);
XEvent * ev = static_cast<XEvent*>(xev);
XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
@ -358,6 +361,21 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
#else
case FL_DRAG:
#endif
{
int const drag_y = ev->xmotion.y;
int const area_y = ob->y;
int const area_h = ob->h;
// Check if the mouse is above or below the workarea
if (drag_y >= area_y + area_h || drag_y <= area_y) {
// we are outside, then we must not give too many
// motion events.
if (timdel.running())
break;
else
timdel.start();
}
if (!ev || !area->scrollbar)
break;
if (ev->xmotion.x != x_old ||
@ -389,6 +407,8 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
}
break;
}
#if FL_VERSION < 1 && FL_REVISION < 89
case FL_KEYBOARD:
#else