From c5058bffd88b5eb000ffd11d5729fbec0f34fb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 3 Dec 2002 18:28:17 +0000 Subject: [PATCH] better selection and scrolling behaviour git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5769 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/ChangeLog | 7 ++++++- src/frontends/screen.C | 8 -------- src/frontends/xforms/ChangeLog | 5 +++++ src/frontends/xforms/XWorkArea.C | 20 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index c9d31306c0..6f7b75f445 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,7 +1,12 @@ +2002-12-03 Lars Gullik Bjønnes + + * screen.C (fitCursor): remove usleep thingie + (fitManualCursor): ditto + 2002-12-03 Lars Gullik Bjønnes * screen.C (fitManualCursor): add delay if we have a selection - going + going (fitCursor): ditto 2002-12-01 Lars Gullik Bjønnes diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 403647da4d..2e65048011 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -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; diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index c001cf950c..72184112a8 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2002-12-03 Lars Gullik Bjønnes + + * XWorkArea.C (work_area_handler): send fewer motion events if the + mouse is outside the workarea. + 2002-12-02 Angus Leeming * FormIndex.C (update): if the contents aren't empty, then activate the diff --git a/src/frontends/xforms/XWorkArea.C b/src/frontends/xforms/XWorkArea.C index fcbcb84488..99474466a7 100644 --- a/src/frontends/xforms/XWorkArea.C +++ b/src/frontends/xforms/XWorkArea.C @@ -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(xev); XWorkArea * area = static_cast(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