From 9beb07356baaaa8e538d0c78b482ab11cf264927 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Sat, 26 Nov 2005 20:28:38 +0000 Subject: [PATCH] Fig bug 1966: uncontrollable scrolling git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10623 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 5 +++++ src/frontends/qt2/QContentPane.C | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 80cce4cd5f..b0eebda0cf 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,8 @@ + +2005-10-07 Martin Vermeer + + * QContentPane.C: Fix bug 1966: uncontrollable scrolling + 2005-10-19 Angus Leeming * lyx_gui.C (LApplication d-tor): remove code to unlock diff --git a/src/frontends/qt2/QContentPane.C b/src/frontends/qt2/QContentPane.C index 526c62599f..685dfc5079 100644 --- a/src/frontends/qt2/QContentPane.C +++ b/src/frontends/qt2/QContentPane.C @@ -75,6 +75,8 @@ mouse_button::state q_motion_state(Qt::ButtonState state) } // namespace anon +// This is a 'heartbeat' generating synthetic mouse move events when the +// cursor is at the top or bottom edge of the viewport. One scroll per 0.2 s SyntheticMouseEvent::SyntheticMouseEvent() : timeout(200), restart_timeout(true), x_old(-1), y_old(-1), scrollbar_value_old(-1.0) @@ -195,11 +197,18 @@ void QContentPane::mouseReleaseEvent(QMouseEvent * e) void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest const cmd(LFUN_MOUSE_MOTION, e->x(), e->y(), + FuncRequest cmd(LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state())); // If we're above or below the work area... - if (e->y() <= 0 || e->y() >= height()) { + if (e->y() <= 20 || e->y() >= height() - 20) { + // Make sure only a synthetic event can cause a page scroll, + // so they come at a steady rate: + if (e->y() <= 20) + // _Force_ a scroll up: + cmd.y = -40; + else + cmd.y = height(); // Store the event, to be handled when the timeout expires. synthetic_mouse_event_.cmd = cmd;