Re: [patch] Qt scrolling
On Mon, Dec 01, 2003 at 09:50:17PM +, Angus Leeming wrote: + [...] 'psuedo' [...] The truoble with that langauge of yuors is that their is no ricognizible pattern in the youse of vowils. Andre'
Re: [patch] Qt scrolling
Andre Poenitz wrote: On Mon, Dec 01, 2003 at 09:50:17PM +, Angus Leeming wrote: + [...] 'psuedo' [...] The truoble with that langauge of yuors is that their is no ricognizible pattern in the youse of vowils. And the azamnig tnhig aobut Egnlsih is taht tehre dosen't need to be to mkae snese of it so lnog as I get the frsit and lsat ltetres rhgit. But, granted, I'll fix it up. -- Angus
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 09:22:03AM +, Angus Leeming wrote: Andre Poenitz wrote: On Mon, Dec 01, 2003 at 09:50:17PM +, Angus Leeming wrote: + [...] 'psuedo' [...] The truoble with that langauge of yuors is that their is no ricognizible pattern in the youse of vowils. And the azamnig tnhig aobut Egnlsih is taht tehre dosen't need to be to mkae snese of it so lnog as I get the frsit and lsat ltetres rhgit. Srue. Wrkos eevn in Grmaen. The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' Andre'
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 00:11, Angus Leeming wrote: Try 3, Kornel. This one should feel much smoother when you move the mouse back into the work area. In fact, I thnk that this is ready to go into the sources (and, indeed, be ported to 1.3.x) but I'd value it if you road-tested it for me one more time. Actually, try this. Factually the same but the debug output is gone, the comments reflect reality and it'll actually apply against current cvs ;-) Sorry for the late reply .. I had to support a customer .. Yes, selecting above and/or below the workarea is smoother. This I like. But, may it be possible to disable the timer while selecting inside the workarea? It is a little annoying to have to wait for the selection, even if you are selecting only some few characters. But even so, this is far better then before, so I vote for apply it. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xf4bewfbDGmeqhAQF2/AP+PnfF/cYWByQxlqnVNI3t3Bd07Xbd24ZH fX0RxFi8k9R0Bza4Sd9DI/0OUnVr0ZlmcXBwDB6agEeDgOHJDxJw3l0a+RRgMUNU xgEnkBH9cmTPHVGEEncJJMOfSLbAMCkfh+ANVrSn5f/PjfFa9arMPmu6GhOiLmiP wSrz6dVmmg8= =LmbA -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Andre Poenitz wrote: Srue. Wrkos eevn in Grmaen. The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' ...which goes to prove something or other ;-) Incidentally, how long did it take you to rearrange the letters in alphabetical order? -- Angus
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 10:55, Angus Leeming wrote: Andre Poenitz wrote: Srue. Wrkos eevn in Grmaen. The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' ...which goes to prove something or other ;-) Incidentally, how long did it take you to rearrange the letters in alphabetical order? Not long, about 10 seconds. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xjILewfbDGmeqhAQGp8wP/RbdlRm6ksRuwqqAjjGvoIFxY1UGM0E/M 7zgm/0U4jWBHb27wzoilCLBhBY9e7acmeIguAcerkoyHf7ZkrsGViF+iZdxD9lWI Fs7ihXheWurXmOMitvyHiiSuFhsAzuI9HlzNnMffQieVj8nL93cMtSINPG8LesI9 gKSkpP5QgtY= =qgE/ -END PGP SIGNATURE-
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 09:55:23AM +, Angus Leeming wrote: Andre Poenitz wrote: Srue. Wrkos eevn in Grmaen. The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' ...which goes to prove something or other ;-) Incidentally, how long did it take you to rearrange the letters in alphabetical order? Less than a minute I suppose. echo D o n | tr ' ' '\n' | sort | tr -d '\n' Andre'
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 11:02:08AM +0100, Kornel Benko wrote: The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' ...which goes to prove something or other ;-) Incidentally, how long did it take you to rearrange the letters in alphabetical order? Not long, about 10 seconds. That's not bad. How did you do that? Andre'
Re: [patch] Qt scrolling
Kornel Benko wrote: Sorry for the late reply .. I had to support a customer .. ;-) Yes, selecting above and/or below the workarea is smoother. This I like. But, may it be possible to disable the timer while selecting inside the workarea? It is a little annoying to have to wait for the selection, even if you are selecting only some few characters. The timeout _is_ disabled when selecting inside the work area. Only when you return from outside is there a delay (of duration one timeout (400ms)). This delay is a feature rather than a bug; it gives us the smooth feel when returning from outside rather than the really jumpy feel we had before as we handled (say) 10 QmouseMove events. But even so, this is far better then before, so I vote for apply it. Nonetheless, I have reduced the timeout to 200ms (same as that in the xforms frontend). Personally I think that this gives us both smooth, controllable scrolling and instant response. I've committed the patch to cvs. See what you think; we can always return to 400ms if you find that you prefer the current feel. Once the feel has stabilized, I'll prepare a patch for 1.3.x. -- Angus
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 11:09, Andre Poenitz wrote: Not long, about 10 seconds. That's not bad. How did you do that? It was a very long word. There are not too many long-word-examples. Some of them are starting with Donau ... One of them ends with kajüte ... So not too difficult to compare the rest. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xlhLewfbDGmeqhAQE2GwP+Ncy4VtXFkwdZXCzYSFQWl0LgDuUCrXXJ sc6Pn5GlCnvd5UxCdEoX9Z/D6BmCsvnCA6Msnh8urXUggD7L+j7Q2sgdKdc2d7UC obbId0ScFhBuJagQ6YOuabP+f4e8WTAqYjBKvxDXxmQ1ghQr+Y1qljlC2zyHqaLV 6hyuKMY8dzo= =MhaV -END PGP SIGNATURE-
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 11:12:20AM +0100, Kornel Benko wrote: -BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 11:09, Andre Poenitz wrote: Not long, about 10 seconds. That's not bad. How did you do that? It was a very long word. There are not too many long-word-examples. Some of them are starting with Donau ... One of them ends with kajüte ... So not too difficult to compare the rest. Ahm... I thought Angus was asking how to create the example, not how to recreate the original word... Andre'
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 11:18, Andre Poenitz wrote: Ahm... I thought Angus was asking how to create the example, not how to recreate the original word... Oh, you are right. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xqPbewfbDGmeqhAQGaEgQAr/Dw6vib0ZWyHAXGH5C8DexGMi50wqH8 uQt6X1RNmVu4x8JzWhmFfqFYnzdRf77WfJX3KNaKV9kl0a+86QM+uBeqX85nLj/a YTTAZYFhlgUhxDYfbAEU+SXVBlwVPecHDLfKpcyA14sUo/bbSudIPqJeusOlcK4T HiYUmFxhnwA= =B/WG -END PGP SIGNATURE-
Re: [patch] Qt scrolling
On Mon, Dec 01, 2003 at 09:50:17PM +, Angus Leeming wrote: > + [...] 'psuedo' [...] The truoble with that langauge of yuors is that their is no ricognizible pattern in the youse of vowils. Andre'
Re: [patch] Qt scrolling
Andre Poenitz wrote: > On Mon, Dec 01, 2003 at 09:50:17PM +, Angus Leeming wrote: > >> + [...] 'psuedo' [...] > > The truoble with that langauge of yuors is that their is no > ricognizible pattern in the youse of vowils. And the azamnig tnhig aobut Egnlsih is taht tehre dosen't need to be to mkae snese of it so lnog as I get the frsit and lsat ltetres rhgit. But, granted, I'll fix it up. -- Angus
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 09:22:03AM +, Angus Leeming wrote: > Andre Poenitz wrote: > > > On Mon, Dec 01, 2003 at 09:50:17PM +, Angus Leeming wrote: > > > >> + [...] 'psuedo' [...] > > > > The truoble with that langauge of yuors is that their is no > > ricognizible pattern in the youse of vowils. > > And the azamnig tnhig aobut Egnlsih is taht tehre dosen't need to be > to mkae snese of it so lnog as I get the frsit and lsat ltetres > rhgit. Srue. Wrkos eevn in Grmaen. The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' Andre'
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 00:11, Angus Leeming wrote: > > Try 3, Kornel. > > > > This one should feel much smoother when you move the mouse back into > > the work area. In fact, I thnk that this is ready to go into the > > sources (and, indeed, be ported to 1.3.x) but I'd value it if you > > road-tested it for me one more time. > > Actually, try this. Factually the same but the debug output is gone, > the comments reflect reality and it'll actually apply against current > cvs ;-) Sorry for the late reply .. I had to support a customer .. Yes, selecting above and/or below the workarea is smoother. This I like. But, may it be possible to disable the timer while selecting inside the workarea? It is a little annoying to have to wait for the selection, even if you are selecting only some few characters. But even so, this is far better then before, so I vote for apply it. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xf4bewfbDGmeqhAQF2/AP+PnfF/cYWByQxlqnVNI3t3Bd07Xbd24ZH fX0RxFi8k9R0Bza4Sd9DI/0OUnVr0ZlmcXBwDB6agEeDgOHJDxJw3l0a+RRgMUNU xgEnkBH9cmTPHVGEEncJJMOfSLbAMCkfh+ANVrSn5f/PjfFa9arMPmu6GhOiLmiP wSrz6dVmmg8= =LmbA -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Andre Poenitz wrote: > Srue. Wrkos eevn in Grmaen. > > The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' ...which goes to prove something or other ;-) Incidentally, how long did it take you to rearrange the letters in alphabetical order? -- Angus
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 10:55, Angus Leeming wrote: > Andre Poenitz wrote: > > Srue. Wrkos eevn in Grmaen. > > > > The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' > > ...which goes to prove something or other ;-) > > Incidentally, how long did it take you to rearrange the letters in > alphabetical order? Not long, about 10 seconds. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xjILewfbDGmeqhAQGp8wP/RbdlRm6ksRuwqqAjjGvoIFxY1UGM0E/M 7zgm/0U4jWBHb27wzoilCLBhBY9e7acmeIguAcerkoyHf7ZkrsGViF+iZdxD9lWI Fs7ihXheWurXmOMitvyHiiSuFhsAzuI9HlzNnMffQieVj8nL93cMtSINPG8LesI9 gKSkpP5QgtY= =qgE/ -END PGP SIGNATURE-
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 09:55:23AM +, Angus Leeming wrote: > Andre Poenitz wrote: > > Srue. Wrkos eevn in Grmaen. > > > > The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' > > ...which goes to prove something or other ;-) > > Incidentally, how long did it take you to rearrange the letters in > alphabetical order? Less than a minute I suppose. echo D o n | tr ' ' '\n' | sort | tr -d '\n' Andre'
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 11:02:08AM +0100, Kornel Benko wrote: > > > The cssliac elpmaxe is 'Dcdhhiikmmnnopprssstttuzäüe' > > > > ...which goes to prove something or other ;-) > > > > Incidentally, how long did it take you to rearrange the letters in > > alphabetical order? > > Not long, about 10 seconds. That's not bad. How did you do that? Andre'
Re: [patch] Qt scrolling
Kornel Benko wrote: > Sorry for the late reply .. I had to support a customer .. ;-) > Yes, selecting above and/or below the workarea is smoother. This I > like. But, may it be possible to disable the timer while selecting > inside the workarea? It is a little annoying to have to wait for the > selection, even if you are selecting only some few characters. The timeout _is_ disabled when selecting inside the work area. Only when you return from outside is there a delay (of duration one timeout (400ms)). This delay is a feature rather than a bug; it gives us the smooth feel when returning from outside rather than the really jumpy feel we had before as we handled (say) 10 QmouseMove events. > But even so, this is far better then before, so I vote for apply it. Nonetheless, I have reduced the timeout to 200ms (same as that in the xforms frontend). Personally I think that this gives us both smooth, controllable scrolling and instant response. I've committed the patch to cvs. See what you think; we can always return to 400ms if you find that you prefer the current feel. Once the feel has stabilized, I'll prepare a patch for 1.3.x. -- Angus
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 11:09, Andre Poenitz wrote: > > Not long, about 10 seconds. > > That's not bad. How did you do that? It was a very long word. There are not too many long-word-examples. Some of them are starting with Donau ... One of them ends with kajüte ... So not too difficult to compare the rest. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xlhLewfbDGmeqhAQE2GwP+Ncy4VtXFkwdZXCzYSFQWl0LgDuUCrXXJ sc6Pn5GlCnvd5UxCdEoX9Z/D6BmCsvnCA6Msnh8urXUggD7L+j7Q2sgdKdc2d7UC obbId0ScFhBuJagQ6YOuabP+f4e8WTAqYjBKvxDXxmQ1ghQr+Y1qljlC2zyHqaLV 6hyuKMY8dzo= =MhaV -END PGP SIGNATURE-
Re: [patch] Qt scrolling
On Tue, Dec 02, 2003 at 11:12:20AM +0100, Kornel Benko wrote: > -BEGIN PGP SIGNED MESSAGE- > > On Dienstag, 2. Dezember 2003 11:09, Andre Poenitz wrote: > > > Not long, about 10 seconds. > > > > That's not bad. How did you do that? > > It was a very long word. There are not too many long-word-examples. > Some of them are starting with Donau ... One of them ends with > kajüte ... So not too difficult to compare the rest. Ahm... I thought Angus was asking how to create the example, not how to recreate the original word... Andre'
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Dienstag, 2. Dezember 2003 11:18, Andre Poenitz wrote: > Ahm... I thought Angus was asking how to create the example, not how to > recreate the original word... Oh, you are right. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8xqPbewfbDGmeqhAQGaEgQAr/Dw6vib0ZWyHAXGH5C8DexGMi50wqH8 uQt6X1RNmVu4x8JzWhmFfqFYnzdRf77WfJX3KNaKV9kl0a+86QM+uBeqX85nLj/a YTTAZYFhlgUhxDYfbAEU+SXVBlwVPecHDLfKpcyA14sUo/bbSudIPqJeusOlcK4T HiYUmFxhnwA= =B/WG -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Kornel Benko wrote: On Montag, 1. Dezember 2003 11:21, Angus Leeming wrote: The patch has the timout returning after 400ms. Could you modify the code to return after 200ms and see how that feels please. I would, but the patch is not applying anymore to cvs. I am at work now, and don't have the sources from yesterday. - From what I remember, even the 400 ms was fast ... I just managed to follow the selections, so I was not unhappy with that value. Try 3, Kornel. This one should feel much smoother when you move the mouse back into the work area. In fact, I thnk that this is ready to go into the sources (and, indeed, be ported to 1.3.x) but I'd value it if you road-tested it for me one more time. -- AngusIndex: src/frontends/qt2/QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.28 diff -u -p -r1.28 QContentPane.C --- src/frontends/qt2/QContentPane.C 30 Nov 2003 18:26:41 - 1.28 +++ src/frontends/qt2/QContentPane.C 1 Dec 2003 21:44:09 - @@ -10,6 +10,10 @@ #include config.h +#include debug.h + +#include boost/bind.hpp + #include QWorkArea.h #include QContentPane.h #include QLyXKeySym.h @@ -18,9 +22,6 @@ #include qtimer.h #include qapplication.h -#include funcrequest.h - - namespace { /// return the LyX key state from Qt's @@ -74,10 +75,20 @@ mouse_button::state q_motion_state(Qt::B } // namespace anon +SyntheticMouseEvent::SyntheticMouseEvent() + : timeout(400), restart_timeout(true), + x_old(-1), y_old(-1), scrollbar_value_old(-1.0) +{} + + QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, content_pane, WRepaintNoErase), track_scrollbar_(true), wa_(parent) { + synthetic_mouse_event_.timeout.timeout.connect( + boost::bind(QContentPane::generateSyntheticMouseEvent, + this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -85,7 +96,26 @@ QContentPane::QContentPane(QWorkArea * p // stupid moc strikes again connect(wa_-scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(scrollBarChanged(int))); +} + +void QContentPane::generateSyntheticMouseEvent() +{ + if (synthetic_mouse_event_.restart_timeout) + synthetic_mouse_event_.timeout.start(); + + // Has anything changed on-screen since the last timeout signal + // was received? + double const scrollbar_value = wa_-scrollbar_-value(); + if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + lyxerr dispatching from generate_synthetic_mouse_event() + std::endl; + wa_-dispatch(synthetic_mouse_event_.cmd); + } } @@ -107,6 +137,9 @@ void QContentPane::mousePressEvent(QMous return; } + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_PRESS, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -115,6 +148,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_RELEASE, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -123,9 +159,57 @@ void QContentPane::mouseReleaseEvent(QMo void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest cmd - (LFUN_MOUSE_MOTION, e-x(), e-y(), q_motion_state(e-state())); - wa_-dispatch(cmd); + int const dx = e-x() - x(); + int const dy = e-y() - y(); + + FuncRequest const + cmd(LFUN_MOUSE_MOTION, dx, dy, q_motion_state(e-state())); + + bool const above_or_below_workarea = dy = 0 || dy = height(); + + if (above_or_below_workarea) { + lyxerr Above/below work area. std::endl; + // Store the 'psuedo' event and start the timeout + // if it isn't already running. + synthetic_mouse_event_.cmd = cmd; + + if (synthetic_mouse_event_.timeout.running()) + // Discard event. + // Wait for the timeout to return and handle the + // (updated) FuncRequest. + return; + else { + synthetic_mouse_event_.restart_timeout = true; + synthetic_mouse_event_.timeout.start(); + // Fall through... + } + + } else if (synthetic_mouse_event_.timeout.running()) { + lyxerr About to return control to mouseMoveEvent proper + std::endl; + // Discard event. + // Wait for the timeout to return, handle one last + // 'pseudo' event and then proceed 'as normal'. + synthetic_mouse_event_.restart_timeout = false; + return; + } + + // Has anything changed on-screen since the last QMouseEvent + // was received? + double const scrollbar_value = wa_-scrollbar_-value(); + if (e-x() != synthetic_mouse_event_.x_old || + e-y() != synthetic_mouse_event_.y_old || + scrollbar_value !=
Re: [patch] Qt scrolling
Angus Leeming wrote: On Montag, 1. Dezember 2003 11:21, Angus Leeming wrote: The patch has the timout returning after 400ms. Could you modify the code to return after 200ms and see how that feels please. I would, but the patch is not applying anymore to cvs. I am at work now, and don't have the sources from yesterday. - From what I remember, even the 400 ms was fast ... I just managed to follow the selections, so I was not unhappy with that value. Try 3, Kornel. This one should feel much smoother when you move the mouse back into the work area. In fact, I thnk that this is ready to go into the sources (and, indeed, be ported to 1.3.x) but I'd value it if you road-tested it for me one more time. Actually, try this. Factually the same but the debug output is gone, the comments reflect reality and it'll actually apply against current cvs ;-) -- AngusIndex: src/frontends/qt2/QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.29 diff -u -p -r1.29 QContentPane.C --- src/frontends/qt2/QContentPane.C 1 Dec 2003 23:04:36 - 1.29 +++ src/frontends/qt2/QContentPane.C 1 Dec 2003 23:08:35 - @@ -10,6 +10,8 @@ #include config.h +#include boost/bind.hpp + #include QWorkArea.h #include QContentPane.h #include QLyXKeySym.h @@ -18,9 +20,6 @@ #include qtimer.h #include qapplication.h -#include funcrequest.h - - namespace { /// return the LyX key state from Qt's @@ -74,10 +73,20 @@ mouse_button::state q_motion_state(Qt::B } // namespace anon +SyntheticMouseEvent::SyntheticMouseEvent() + : timeout(400), restart_timeout(true), + x_old(-1), y_old(-1), scrollbar_value_old(-1.0) +{} + + QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, content_pane, WRepaintNoErase), track_scrollbar_(true), wa_(parent) { + synthetic_mouse_event_.timeout.timeout.connect( + boost::bind(QContentPane::generateSyntheticMouseEvent, + this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -85,7 +94,25 @@ QContentPane::QContentPane(QWorkArea * p // stupid moc strikes again connect(wa_-scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(scrollBarChanged(int))); +} + +void QContentPane::generateSyntheticMouseEvent() +{ + // Set things off to generate the _next_ 'psuedo' event. + if (synthetic_mouse_event_.restart_timeout) + synthetic_mouse_event_.timeout.start(); + + // Has anything changed on-screen since the last timeout signal + // was received? + double const scrollbar_value = wa_-scrollbar_-value(); + if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + wa_-dispatch(synthetic_mouse_event_.cmd); + } } @@ -115,6 +142,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest const cmd(LFUN_MOUSE_RELEASE, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -125,7 +155,50 @@ void QContentPane::mouseMoveEvent(QMouse { FuncRequest const cmd(LFUN_MOUSE_MOTION, e-x(), e-y(), q_motion_state(e-state())); - wa_-dispatch(cmd); + + // If we're above or below the work area... + if (e-y() = 0 || e-y() = height()) { + // Store the event, to be handled when the timeout expires. + synthetic_mouse_event_.cmd = cmd; + + if (synthetic_mouse_event_.timeout.running()) + // Wait for the timeout to expire before handling the + // event. + // Ie, when the timeout expires, we handle the + // most recent event but discard all others that + // occurred after the one used to start the timeout + // in the first place. + return; + else { + synthetic_mouse_event_.restart_timeout = true; + synthetic_mouse_event_.timeout.start(); + // Fall through to handle this event... + } + + } else if (synthetic_mouse_event_.timeout.running()) { + // Store the event, to be handled when the timeout expires. + // Thereafter, normal control is returned to mouseMoveEvent. + // This results in a much smoother 'feel' when moving the + // mouse back into the work area. + synthetic_mouse_event_.cmd = cmd; + synthetic_mouse_event_.restart_timeout = false; + return; + } + + // Has anything changed on-screen since the last QMouseEvent + // was received? + double const scrollbar_value = wa_-scrollbar_-value(); + if (e-x() != synthetic_mouse_event_.x_old || + e-y() != synthetic_mouse_event_.y_old || + scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.x_old = e-x(); + synthetic_mouse_event_.y_old = e-y(); +
Re: [patch] Qt scrolling
Kornel Benko wrote: Ok, Kornel, try 2. * revert yesterday's patch. * cvs up * apply the patch attached. Something fishy hier ... 3.57 korben.kornel 22:51 patch -p0 '/tmp/kde-kornel/kmailfnaUvb.3/qt.diff' patching file src/frontends/qt2//QContentPane.C Hunk #3 succeeded at 79 with fuzz 2. patching file src/frontends/qt2//QContentPane.h ... Fishy indeed, but it worked so let's not worry too much. It should fix both problems. If you still think (1) is too fast, could you play with the '400' ms passed to the timeout in the SyntheticMouseEvent constructor (QContentPane.h). No need for 400ms now. This patch cured both problems. Good. The patch has the timout returning after 400ms. Could you modify the code to return after 200ms and see how that feels please. BTW, I was unable to crash it with pointer selections. Good'o. P.S. This mail-delays are going to be too nerving. A PITA. -- Angus
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Montag, 1. Dezember 2003 11:21, Angus Leeming wrote: The patch has the timout returning after 400ms. Could you modify the code to return after 200ms and see how that feels please. I would, but the patch is not applying anymore to cvs. I am at work now, and don't have the sources from yesterday. - From what I remember, even the 400 ms was fast ... I just managed to follow the selections, so I was not unhappy with that value. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8s7VLewfbDGmeqhAQEjaAQAiEs8AzLcF5nqGhe+HI1d60f4Lyz7jhNH Co/SPZ8IQqeosuglcxb6Wp8D/blO+oqLBMxXOmtm73an833t7TpPqp9kEPT70bVh 9oPXBQOkgJg0fNYimQZmp1F6b3q+dfidTxMOfp1I97ymXRyLR82+rD0R5gqeM2/h RzyO0H3iC0o= =y5YI -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Kornel Benko wrote: >> Ok, Kornel, try 2. >> * revert yesterday's patch. >> * cvs up >> * apply the patch attached. > Something fishy hier ... > 3.57 korben.kornel 22:51 > patch -p0 < > '/tmp/kde-kornel/kmailfnaUvb.3/qt.diff' patching file > src/frontends/qt2//QContentPane.C Hunk #3 succeeded at 79 with fuzz > 2. patching file src/frontends/qt2//QContentPane.h > ... Fishy indeed, but it worked so let's not worry too much. >> It should fix both problems. If you still think (1) is too fast, >> could you play with the '400' ms passed to the timeout in the >> SyntheticMouseEvent constructor (QContentPane.h). > No need for 400ms now. This patch cured both problems. Good. The patch has the timout returning after 400ms. Could you modify the code to return after 200ms and see how that feels please. > BTW, I was unable to crash it with pointer selections. Good'o. > P.S. > This mail-delays are going to be too nerving. A PITA. -- Angus
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Montag, 1. Dezember 2003 11:21, Angus Leeming wrote: > The patch has the timout returning after 400ms. Could you modify the > code to return after 200ms and see how that feels please. I would, but the patch is not applying anymore to cvs. I am at work now, and don't have the sources from yesterday. - From what I remember, even the 400 ms was fast ... I just managed to follow the selections, so I was not unhappy with that value. Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iQCVAwUBP8s7VLewfbDGmeqhAQEjaAQAiEs8AzLcF5nqGhe+HI1d60f4Lyz7jhNH Co/SPZ8IQqeosuglcxb6Wp8D/blO+oqLBMxXOmtm73an833t7TpPqp9kEPT70bVh 9oPXBQOkgJg0fNYimQZmp1F6b3q+dfidTxMOfp1I97ymXRyLR82+rD0R5gqeM2/h RzyO0H3iC0o= =y5YI -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Kornel Benko wrote: > On Montag, 1. Dezember 2003 11:21, Angus Leeming wrote: >> The patch has the timout returning after 400ms. Could you modify >> the code to return after 200ms and see how that feels please. > > I would, but the patch is not applying anymore to cvs. I am at work > now, and don't have the sources from yesterday. > > - From what I remember, even the 400 ms was fast ... > I just managed to follow the selections, so I was not unhappy with > that value. Try 3, Kornel. This one should feel much smoother when you move the mouse back into the work area. In fact, I thnk that this is ready to go into the sources (and, indeed, be ported to 1.3.x) but I'd value it if you road-tested it for me one more time. -- AngusIndex: src/frontends/qt2/QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.28 diff -u -p -r1.28 QContentPane.C --- src/frontends/qt2/QContentPane.C 30 Nov 2003 18:26:41 - 1.28 +++ src/frontends/qt2/QContentPane.C 1 Dec 2003 21:44:09 - @@ -10,6 +10,10 @@ #include +#include "debug.h" + +#include + #include "QWorkArea.h" #include "QContentPane.h" #include "QLyXKeySym.h" @@ -18,9 +22,6 @@ #include #include -#include "funcrequest.h" - - namespace { /// return the LyX key state from Qt's @@ -74,10 +75,20 @@ mouse_button::state q_motion_state(Qt::B } // namespace anon +SyntheticMouseEvent::SyntheticMouseEvent() + : timeout(400), restart_timeout(true), + x_old(-1), y_old(-1), scrollbar_value_old(-1.0) +{} + + QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, "content_pane", WRepaintNoErase), track_scrollbar_(true), wa_(parent) { + synthetic_mouse_event_.timeout.timeout.connect( + boost::bind(::generateSyntheticMouseEvent, + this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -85,7 +96,26 @@ QContentPane::QContentPane(QWorkArea * p // stupid moc strikes again connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(scrollBarChanged(int))); +} + +void QContentPane::generateSyntheticMouseEvent() +{ + if (synthetic_mouse_event_.restart_timeout) + synthetic_mouse_event_.timeout.start(); + + // Has anything changed on-screen since the last timeout signal + // was received? + double const scrollbar_value = wa_->scrollbar_->value(); + if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + lyxerr << "dispatching from generate_synthetic_mouse_event()" + << std::endl; + wa_->dispatch(synthetic_mouse_event_.cmd); + } } @@ -107,6 +137,9 @@ void QContentPane::mousePressEvent(QMous return; } + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -115,6 +148,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -123,9 +159,57 @@ void QContentPane::mouseReleaseEvent(QMo void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest cmd - (LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state())); - wa_->dispatch(cmd); + int const dx = e->x() - x(); + int const dy = e->y() - y(); + + FuncRequest const + cmd(LFUN_MOUSE_MOTION, dx, dy, q_motion_state(e->state())); + + bool const above_or_below_workarea = dy <= 0 || dy >= height(); + + if (above_or_below_workarea) { + lyxerr << "Above/below work area." << std::endl; + // Store the 'psuedo' event and start the timeout + // if it isn't already running. + synthetic_mouse_event_.cmd = cmd; + + if (synthetic_mouse_event_.timeout.running()) + // Discard event. + // Wait for the timeout to return and handle the + // (updated) FuncRequest. + return; + else { + synthetic_mouse_event_.restart_timeout = true; + synthetic_mouse_event_.timeout.start(); + // Fall through... + } + + } else if (synthetic_mouse_event_.timeout.running()) { + lyxerr << "About to return control to mouseMoveEvent proper" + << std::endl; + // Discard event. + // Wait for the timeout to return, handle one last + // 'pseudo' event and then proceed 'as normal'. + synthetic_mouse_event_.restart_timeout = false; + return; + } + + // Has anything changed on-screen since the last QMouseEvent + // was received? + double const scrollbar_value = wa_->scrollbar_->value(); + if (e->x() != synthetic_mouse_event_.x_old || + e->y() != synthetic_mouse_event_.y_old || + scrollbar_value !=
Re: [patch] Qt scrolling
Angus Leeming wrote: >> On Montag, 1. Dezember 2003 11:21, Angus Leeming wrote: >>> The patch has the timout returning after 400ms. Could you modify >>> the code to return after 200ms and see how that feels please. >> >> I would, but the patch is not applying anymore to cvs. I am at work >> now, and don't have the sources from yesterday. >> >> - From what I remember, even the 400 ms was fast ... >> I just managed to follow the selections, so I was not unhappy with >> that value. > > Try 3, Kornel. > > This one should feel much smoother when you move the mouse back into > the work area. In fact, I thnk that this is ready to go into the > sources (and, indeed, be ported to 1.3.x) but I'd value it if you > road-tested it for me one more time. Actually, try this. Factually the same but the debug output is gone, the comments reflect reality and it'll actually apply against current cvs ;-) -- AngusIndex: src/frontends/qt2/QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.29 diff -u -p -r1.29 QContentPane.C --- src/frontends/qt2/QContentPane.C 1 Dec 2003 23:04:36 - 1.29 +++ src/frontends/qt2/QContentPane.C 1 Dec 2003 23:08:35 - @@ -10,6 +10,8 @@ #include +#include + #include "QWorkArea.h" #include "QContentPane.h" #include "QLyXKeySym.h" @@ -18,9 +20,6 @@ #include #include -#include "funcrequest.h" - - namespace { /// return the LyX key state from Qt's @@ -74,10 +73,20 @@ mouse_button::state q_motion_state(Qt::B } // namespace anon +SyntheticMouseEvent::SyntheticMouseEvent() + : timeout(400), restart_timeout(true), + x_old(-1), y_old(-1), scrollbar_value_old(-1.0) +{} + + QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, "content_pane", WRepaintNoErase), track_scrollbar_(true), wa_(parent) { + synthetic_mouse_event_.timeout.timeout.connect( + boost::bind(::generateSyntheticMouseEvent, + this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -85,7 +94,25 @@ QContentPane::QContentPane(QWorkArea * p // stupid moc strikes again connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), this, SLOT(scrollBarChanged(int))); +} + +void QContentPane::generateSyntheticMouseEvent() +{ + // Set things off to generate the _next_ 'psuedo' event. + if (synthetic_mouse_event_.restart_timeout) + synthetic_mouse_event_.timeout.start(); + + // Has anything changed on-screen since the last timeout signal + // was received? + double const scrollbar_value = wa_->scrollbar_->value(); + if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + wa_->dispatch(synthetic_mouse_event_.cmd); + } } @@ -115,6 +142,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest const cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -125,7 +155,50 @@ void QContentPane::mouseMoveEvent(QMouse { FuncRequest const cmd(LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state())); - wa_->dispatch(cmd); + + // If we're above or below the work area... + if (e->y() <= 0 || e->y() >= height()) { + // Store the event, to be handled when the timeout expires. + synthetic_mouse_event_.cmd = cmd; + + if (synthetic_mouse_event_.timeout.running()) + // Wait for the timeout to expire before handling the + // event. + // Ie, when the timeout expires, we handle the + // most recent event but discard all others that + // occurred after the one used to start the timeout + // in the first place. + return; + else { + synthetic_mouse_event_.restart_timeout = true; + synthetic_mouse_event_.timeout.start(); + // Fall through to handle this event... + } + + } else if (synthetic_mouse_event_.timeout.running()) { + // Store the event, to be handled when the timeout expires. + // Thereafter, normal control is returned to mouseMoveEvent. + // This results in a much smoother 'feel' when moving the + // mouse back into the work area. + synthetic_mouse_event_.cmd = cmd; + synthetic_mouse_event_.restart_timeout = false; + return; + } + + // Has anything changed on-screen since the last QMouseEvent + // was received? + double const scrollbar_value = wa_->scrollbar_->value(); + if (e->x() != synthetic_mouse_event_.x_old || + e->y() != synthetic_mouse_event_.y_old || + scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.x_old = e->x(); + synthetic_mouse_event_.y_old = e->y(); +
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Samstag, 29. November 2003 22:20, Angus Leeming wrote: Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. 1.) It feels still too fast selecting below the work area. 2.) If one starts selecting below the area, then the try to deselect some parts, i.e. select above, nonetheless continues selecting the parts below. (Don't know, if I express myself understandably enough) Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iQCVAwUBP8noZLewfbDGmeqhAQG6AwQAndNffbovvyDXUcj6v7X5Dt6hGzBs9hNK hA+ol4pvueoz29kOv+g2MkYGp9ocvqCNP1yTd+Ks7A5f+KHMwjgRRf3KS/HYPeIJ NxTHbS6JgRvTRj6vHFsPKUUFFo7u7I+EASrijme6ZnOVC4tlBhNM/s3nrJPoJx9C RltQ87c7zyk= =6Uev -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Kornel Benko wrote: -BEGIN PGP SIGNED MESSAGE- On Samstag, 29. November 2003 22:20, Angus Leeming wrote: Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. 1.) It feels still too fast selecting below the work area. Could you try changing the length of the timeout to (say) 400ms from its current 200ms. See line 81 of QContentPane.C: QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, content_pane, WRepaintNoErase), timeout_(200), track_scrollbar_(true), wa_(parent) { 2.) If one starts selecting below the area, then the try to deselect some parts, i.e. select above, nonetheless continues selecting the parts below. (Don't know, if I express myself understandably enough) So, you keep the mouse button pressed, move it below the work area so that the text starts scrolling and then move it up so that the cursor is in the work area once again? And the text keeps being scrolled? Hmmm, interesting. -- Angus
Re: [patch] Qt scrolling
Kornel Benko wrote: Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. 1.) It feels still too fast selecting below the work area. 2.) If one starts selecting below the area, then the try to deselect some parts, i.e. select above, nonetheless continues selecting the parts below. (Don't know, if I express myself understandably enough) Ok, Kornel, try 2. * revert yesterday's patch. * cvs up * apply the patch attached. It should fix both problems. If you still think (1) is too fast, could you play with the '400' ms passed to the timeout in the SyntheticMouseEvent constructor (QContentPane.h). Regards, -- AngusIndex: src/frontends/qt2//QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.28 diff -u -p -r1.28 QContentPane.C --- src/frontends/qt2//QContentPane.C 30 Nov 2003 18:26:41 - 1.28 +++ src/frontends/qt2//QContentPane.C 30 Nov 2003 18:28:39 - @@ -10,6 +10,10 @@ #include config.h +#include debug.h + +#include boost/bind.hpp + #include QWorkArea.h #include QContentPane.h #include QLyXKeySym.h @@ -18,9 +22,6 @@ #include qtimer.h #include qapplication.h -#include funcrequest.h - - namespace { /// return the LyX key state from Qt's @@ -78,6 +79,10 @@ QContentPane::QContentPane(QWorkArea * p : QWidget(parent, content_pane, WRepaintNoErase), track_scrollbar_(true), wa_(parent) { + synthetic_mouse_event_.timeout.timeout.connect( + boost::bind(QContentPane::generate_synthetic_mouse_event, + this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -89,6 +94,24 @@ QContentPane::QContentPane(QWorkArea * p } +void QContentPane::generate_synthetic_mouse_event() +{ + // Set things off to generate the _next_ 'pseudo' event... + synthetic_mouse_event_.timeout.start(); + + double const scrollbar_value = wa_-scrollbar_-value(); + // Has anything changed on-screen since the last QMouseEvent + // was received? + if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + wa_-dispatch(synthetic_mouse_event_.cmd); + } +} + + void QContentPane::scrollBarChanged(int val) { if (track_scrollbar_) @@ -107,6 +130,9 @@ void QContentPane::mousePressEvent(QMous return; } + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_PRESS, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -115,6 +141,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_RELEASE, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -123,9 +152,40 @@ void QContentPane::mouseReleaseEvent(QMo void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest cmd - (LFUN_MOUSE_MOTION, e-x(), e-y(), q_motion_state(e-state())); - wa_-dispatch(cmd); + FuncRequest cmd(LFUN_MOUSE_MOTION, e-x() - x(), e-y() - y(), + q_motion_state(e-state())); + + bool const above_or_below_workarea = + e-y() = y() || e-y() = y() + height(); + + if (above_or_below_workarea) { + if (synthetic_mouse_event_.timeout.running()) + // Discard event. + return; + + // Store the 'psuedo' event and start the timeout. + synthetic_mouse_event_.cmd = cmd; + synthetic_mouse_event_.timeout.start(); + + } else if (synthetic_mouse_event_.timeout.running()) + // We're interested in generating 'pseudo' events only + // when the cursor is outside of the work-area. + synthetic_mouse_event_.timeout.stop(); + + double const scrollbar_value = wa_-scrollbar_-value(); + // Has anything changed on-screen since the last QMouseEvent + // was received? + if (e-x() != synthetic_mouse_event_.x_old || + e-y() != synthetic_mouse_event_.y_old || + scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.x_old = e-x(); + synthetic_mouse_event_.y_old = e-y(); + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + wa_-dispatch(cmd); + } } @@ -200,4 +260,3 @@ void QContentPane::trackScrollbar(bool t { track_scrollbar_ = track_on; } - Index: src/frontends/qt2//QContentPane.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.h,v retrieving
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Sonntag, 30. November 2003 18:21, Angus Leeming wrote: Kornel Benko wrote: -BEGIN PGP SIGNED MESSAGE- On Samstag, 29. November 2003 22:20, Angus Leeming wrote: Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. 1.) It feels still too fast selecting below the work area. Could you try changing the length of the timeout to (say) 400ms from its current 200ms. See line 81 of QContentPane.C: QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, content_pane, WRepaintNoErase), timeout_(200), track_scrollbar_(true), wa_(parent) { Much better now. 2.) If one starts selecting below the area, then the try to deselect some parts, i.e. select above, nonetheless continues selecting the parts below. (Don't know, if I express myself understandably enough) So, you keep the mouse button pressed, move it below the work area so that the text starts scrolling and then move it up so that the cursor is in the work area once again? And the text keeps being scrolled? No, comming back to the work area stops the selections. But, still with the mouse button pressed, move the pointer _abowe_ the work area. Now the automatic selection starts again... in the wrong direction(_not_ diselecting) Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iQCVAwUBP8pRrrewfbDGmeqhAQGPMAP/T7mF8o/+hUwKfiPi5bLfr8bAOMKEWyUh fBPyni79hFfhMywdmQMqBiVdoUMdUuTP1IqnSzzrBJYxocWuTLv5BBoCU+d+1o0o J53i5NmYldxj2vzEHi25AkS8S6fsBNr5PjQruVuTIMfnEe8g+jIb1Bb0gc3D6Uhe 5H/pJaw2c/w= =Ap4N -END PGP SIGNATURE-
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Sonntag, 30. November 2003 19:32, Angus Leeming wrote: Kornel Benko wrote: Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. 1.) It feels still too fast selecting below the work area. 2.) If one starts selecting below the area, then the try to deselect some parts, i.e. select above, nonetheless continues selecting the parts below. (Don't know, if I express myself understandably enough) Ok, Kornel, try 2. * revert yesterday's patch. * cvs up * apply the patch attached. Something fishy hier ... 3.57 korben.kornel 22:51 patch -p0 '/tmp/kde-kornel/kmailfnaUvb.3/qt.diff' patching file src/frontends/qt2//QContentPane.C Hunk #3 succeeded at 79 with fuzz 2. patching file src/frontends/qt2//QContentPane.h ... It should fix both problems. If you still think (1) is too fast, could you play with the '400' ms passed to the timeout in the SyntheticMouseEvent constructor (QContentPane.h). No need for 400ms now. This patch cured both problems. BTW, I was unable to crash it with pointer selections. Kornel P.S. This mail-delays are going to be too nerving. - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iQCVAwUBP8pqAbewfbDGmeqhAQEBQAP/U6m26L8e4qie6yZw4n7jy7khAf2qKs98 d4vmSV/gaAvn23EU6Rt3nNU0coZjhTIhHVvZeHiP54h6yUjyLbwm85djPs59oyVL hq44pnDshpBHaXPWlvMjprpgoIz2MwdC+hIBqM9IeRXCK9smzXYcYNfcOHapPS7R iQQl+NBdSB8= =jikl -END PGP SIGNATURE-
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Samstag, 29. November 2003 22:20, Angus Leeming wrote: > Could the Qt-ers amongst you try out the attached patch. It gives you > scrolling behaviour similar to that of the xforms frontend. > > Specifically, if you move the mouse cursor above/below the work area, > you should get 'sensible' scrolling behaviour. > > Try it out and let me know. 1.) It feels still too fast selecting below the work area. 2.) If one starts selecting below the area, then the try to deselect some parts, i.e. select above, nonetheless continues selecting the parts below. (Don't know, if I express myself understandably enough) Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iQCVAwUBP8noZLewfbDGmeqhAQG6AwQAndNffbovvyDXUcj6v7X5Dt6hGzBs9hNK hA+ol4pvueoz29kOv+g2MkYGp9ocvqCNP1yTd+Ks7A5f+KHMwjgRRf3KS/HYPeIJ NxTHbS6JgRvTRj6vHFsPKUUFFo7u7I+EASrijme6ZnOVC4tlBhNM/s3nrJPoJx9C RltQ87c7zyk= =6Uev -END PGP SIGNATURE-
Re: [patch] Qt scrolling
Kornel Benko wrote: > -BEGIN PGP SIGNED MESSAGE- > > On Samstag, 29. November 2003 22:20, Angus Leeming wrote: >> Could the Qt-ers amongst you try out the attached patch. It gives >> you scrolling behaviour similar to that of the xforms frontend. >> >> Specifically, if you move the mouse cursor above/below the work >> area, you should get 'sensible' scrolling behaviour. >> >> Try it out and let me know. > > 1.) It feels still too fast selecting below the work area. Could you try changing the length of the timeout to (say) 400ms from its current 200ms. See line 81 of QContentPane.C: QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, "content_pane", WRepaintNoErase), timeout_(200), track_scrollbar_(true), wa_(parent) { > 2.) If one starts selecting below the area, then the try to deselect > some parts, i.e. select above, nonetheless continues selecting the > parts below. (Don't know, if I express myself understandably enough) So, you keep the mouse button pressed, move it below the work area so that the text starts scrolling and then move it up so that the cursor is in the work area once again? And the text keeps being scrolled? Hmmm, interesting. -- Angus
Re: [patch] Qt scrolling
Kornel Benko wrote: >> Could the Qt-ers amongst you try out the attached patch. It gives >> you scrolling behaviour similar to that of the xforms frontend. >> >> Specifically, if you move the mouse cursor above/below the work >> area, you should get 'sensible' scrolling behaviour. >> >> Try it out and let me know. > > 1.) It feels still too fast selecting below the work area. > > 2.) If one starts selecting below the area, then the try to deselect > some parts, i.e. select above, nonetheless continues selecting the > parts below. (Don't know, if I express myself understandably enough) Ok, Kornel, try 2. * revert yesterday's patch. * cvs up * apply the patch attached. It should fix both problems. If you still think (1) is too fast, could you play with the '400' ms passed to the timeout in the SyntheticMouseEvent constructor (QContentPane.h). Regards, -- AngusIndex: src/frontends/qt2//QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.28 diff -u -p -r1.28 QContentPane.C --- src/frontends/qt2//QContentPane.C 30 Nov 2003 18:26:41 - 1.28 +++ src/frontends/qt2//QContentPane.C 30 Nov 2003 18:28:39 - @@ -10,6 +10,10 @@ #include +#include "debug.h" + +#include + #include "QWorkArea.h" #include "QContentPane.h" #include "QLyXKeySym.h" @@ -18,9 +22,6 @@ #include #include -#include "funcrequest.h" - - namespace { /// return the LyX key state from Qt's @@ -78,6 +79,10 @@ QContentPane::QContentPane(QWorkArea * p : QWidget(parent, "content_pane", WRepaintNoErase), track_scrollbar_(true), wa_(parent) { + synthetic_mouse_event_.timeout.timeout.connect( + boost::bind(::generate_synthetic_mouse_event, + this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -89,6 +94,24 @@ QContentPane::QContentPane(QWorkArea * p } +void QContentPane::generate_synthetic_mouse_event() +{ + // Set things off to generate the _next_ 'pseudo' event... + synthetic_mouse_event_.timeout.start(); + + double const scrollbar_value = wa_->scrollbar_->value(); + // Has anything changed on-screen since the last QMouseEvent + // was received? + if (scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + wa_->dispatch(synthetic_mouse_event_.cmd); + } +} + + void QContentPane::scrollBarChanged(int val) { if (track_scrollbar_) @@ -107,6 +130,9 @@ void QContentPane::mousePressEvent(QMous return; } + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -115,6 +141,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (synthetic_mouse_event_.timeout.running()) + synthetic_mouse_event_.timeout.stop(); + FuncRequest cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -123,9 +152,40 @@ void QContentPane::mouseReleaseEvent(QMo void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest cmd - (LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state())); - wa_->dispatch(cmd); + FuncRequest cmd(LFUN_MOUSE_MOTION, e->x() - x(), e->y() - y(), + q_motion_state(e->state())); + + bool const above_or_below_workarea = + e->y() <= y() || e->y() >= y() + height(); + + if (above_or_below_workarea) { + if (synthetic_mouse_event_.timeout.running()) + // Discard event. + return; + + // Store the 'psuedo' event and start the timeout. + synthetic_mouse_event_.cmd = cmd; + synthetic_mouse_event_.timeout.start(); + + } else if (synthetic_mouse_event_.timeout.running()) + // We're interested in generating 'pseudo' events only + // when the cursor is outside of the work-area. + synthetic_mouse_event_.timeout.stop(); + + double const scrollbar_value = wa_->scrollbar_->value(); + // Has anything changed on-screen since the last QMouseEvent + // was received? + if (e->x() != synthetic_mouse_event_.x_old || + e->y() != synthetic_mouse_event_.y_old || + scrollbar_value != synthetic_mouse_event_.scrollbar_value_old) { + // Yes it has. Store the params used to check this. + synthetic_mouse_event_.x_old = e->x(); + synthetic_mouse_event_.y_old = e->y(); + synthetic_mouse_event_.scrollbar_value_old = scrollbar_value; + + // ... and dispatch the event to the LyX core. + wa_->dispatch(cmd); + } } @@ -200,4 +260,3 @@ void QContentPane::trackScrollbar(bool t { track_scrollbar_ = track_on; } - Index: src/frontends/qt2//QContentPane.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.h,v
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Sonntag, 30. November 2003 18:21, Angus Leeming wrote: > Kornel Benko wrote: > > > -BEGIN PGP SIGNED MESSAGE- > > > > On Samstag, 29. November 2003 22:20, Angus Leeming wrote: > >> Could the Qt-ers amongst you try out the attached patch. It gives > >> you scrolling behaviour similar to that of the xforms frontend. > >> > >> Specifically, if you move the mouse cursor above/below the work > >> area, you should get 'sensible' scrolling behaviour. > >> > >> Try it out and let me know. > > 1.) It feels still too fast selecting below the work area. > > Could you try changing the length of the timeout to (say) 400ms from > its current 200ms. See line 81 of QContentPane.C: > > QContentPane::QContentPane(QWorkArea * parent) > : QWidget(parent, "content_pane", WRepaintNoErase), > timeout_(200), track_scrollbar_(true), wa_(parent) > { Much better now. > > 2.) If one starts selecting below the area, then the try to deselect > > some parts, i.e. select above, nonetheless continues selecting the > > parts below. (Don't know, if I express myself understandably enough) > > So, you keep the mouse button pressed, move it below the work area so > that the text starts scrolling and then move it up so that the cursor > is in the work area once again? And the text keeps being scrolled? No, comming back to the work area stops the selections. But, still with the mouse button pressed, move the pointer _abowe_ the work area. Now the automatic selection starts again... in the wrong direction(_not_ diselecting) Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iQCVAwUBP8pRrrewfbDGmeqhAQGPMAP/T7mF8o/+hUwKfiPi5bLfr8bAOMKEWyUh fBPyni79hFfhMywdmQMqBiVdoUMdUuTP1IqnSzzrBJYxocWuTLv5BBoCU+d+1o0o J53i5NmYldxj2vzEHi25AkS8S6fsBNr5PjQruVuTIMfnEe8g+jIb1Bb0gc3D6Uhe 5H/pJaw2c/w= =Ap4N -END PGP SIGNATURE-
Re: [patch] Qt scrolling
-BEGIN PGP SIGNED MESSAGE- On Sonntag, 30. November 2003 19:32, Angus Leeming wrote: > Kornel Benko wrote: > >> Could the Qt-ers amongst you try out the attached patch. It gives > >> you scrolling behaviour similar to that of the xforms frontend. > >> > >> Specifically, if you move the mouse cursor above/below the work > >> area, you should get 'sensible' scrolling behaviour. > >> > >> Try it out and let me know. > > > > 1.) It feels still too fast selecting below the work area. > > > > 2.) If one starts selecting below the area, then the try to deselect > > some parts, i.e. select above, nonetheless continues selecting the > > parts below. (Don't know, if I express myself understandably enough) > > Ok, Kornel, try 2. > * revert yesterday's patch. > * cvs up > * apply the patch attached. Something fishy hier ... 3.57 korben.kornel 22:51 > patch -p0 < '/tmp/kde-kornel/kmailfnaUvb.3/qt.diff' patching file src/frontends/qt2//QContentPane.C Hunk #3 succeeded at 79 with fuzz 2. patching file src/frontends/qt2//QContentPane.h ... > It should fix both problems. If you still think (1) is too fast, could > you play with the '400' ms passed to the timeout in the > SyntheticMouseEvent constructor (QContentPane.h). No need for 400ms now. This patch cured both problems. BTW, I was unable to crash it with pointer selections. Kornel P.S. This mail-delays are going to be too nerving. - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iQCVAwUBP8pqAbewfbDGmeqhAQEBQAP/U6m26L8e4qie6yZw4n7jy7khAf2qKs98 d4vmSV/gaAvn23EU6Rt3nNU0coZjhTIhHVvZeHiP54h6yUjyLbwm85djPs59oyVL hq44pnDshpBHaXPWlvMjprpgoIz2MwdC+hIBqM9IeRXCK9smzXYcYNfcOHapPS7R iQQl+NBdSB8= =jikl -END PGP SIGNATURE-
[patch] Qt scrolling
Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. Angus ps, Using this on the User Guide will crash eventually and may also occasionally 'get stuck' (for me the start of Chapter 2) moving the mouse back into the work area and out again fixed that for me. I assume that both these bugs are 'PosIterator' related. A. Index: src/frontends/qt2/QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.27 diff -u -p -r1.27 QContentPane.C --- src/frontends/qt2/QContentPane.C 24 Nov 2003 08:26:08 - 1.27 +++ src/frontends/qt2/QContentPane.C 29 Nov 2003 21:15:12 - @@ -10,6 +10,11 @@ #include config.h +#include debug.h +#include funcrequest.h + +#include boost/bind.hpp + #include QWorkArea.h #include QContentPane.h #include QLyXKeySym.h @@ -18,9 +23,6 @@ #include qtimer.h #include qapplication.h -#include funcrequest.h - - namespace { /// return the LyX key state from Qt's @@ -76,8 +78,11 @@ mouse_button::state q_motion_state(Qt::B QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, content_pane, WRepaintNoErase), - wa_(parent), track_scrollbar_(true) + timeout_(200), track_scrollbar_(true), wa_(parent) { + timeout_.timeout.connect( + boost::bind(QContentPane::timeout_slot, this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -89,6 +94,28 @@ QContentPane::QContentPane(QWorkArea * p } +namespace { + +FuncRequest synthetic_mouse_move_event_; +int x_old = -1; +int y_old = -1; +double scrollbar_value_old = -1.0; + +}// namespace anon + + +void QContentPane::timeout_slot() +{ + lyxerr QContentPane::timeout_slot() std::endl; + timeout_.start(); + double const scrollbar_value = wa_-scrollbar_-value(); + if (scrollbar_value != scrollbar_value_old) { + scrollbar_value_old = scrollbar_value; + wa_-dispatch(synthetic_mouse_move_event_); + } +} + + void QContentPane::scrollBarChanged(int val) { if (track_scrollbar_) @@ -107,6 +134,9 @@ void QContentPane::mousePressEvent(QMous return; } + if (timeout_.running()) + timeout_.stop(); + FuncRequest cmd(LFUN_MOUSE_PRESS, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -115,6 +145,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (timeout_.running()) + timeout_.stop(); + FuncRequest cmd(LFUN_MOUSE_RELEASE, e-x(), e-y(), q_button_state(e-button())); wa_-dispatch(cmd); @@ -123,9 +156,27 @@ void QContentPane::mouseReleaseEvent(QMo void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest cmd - (LFUN_MOUSE_MOTION, e-x(), e-y(), q_motion_state(e-state())); - wa_-dispatch(cmd); + FuncRequest cmd(LFUN_MOUSE_MOTION, e-x() - x(), e-y() - y(), + q_motion_state(e-state())); + + bool const above_or_below_workarea = + e-y() = y() || e-y() = y() + height(); + + if (above_or_below_workarea) { + if (timeout_.running()) + return; + synthetic_mouse_move_event_ = cmd; + timeout_.start(); + } + + double const scrollbar_value = wa_-scrollbar_-value(); + if (e-x() != x_old || e-y() != y_old || + scrollbar_value != scrollbar_value_old) { + x_old = e-x(); + y_old = e-y(); + scrollbar_value_old = scrollbar_value; + wa_-dispatch(cmd); + } } Index: src/frontends/qt2/QContentPane.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.h,v retrieving revision 1.11 diff -u -p -r1.11 QContentPane.h --- src/frontends/qt2/QContentPane.h 24 Nov 2003 08:26:08 - 1.11 +++ src/frontends/qt2/QContentPane.h 29 Nov 2003 21:15:12 - @@ -12,6 +12,11 @@ #ifndef QCONTENTPANE_H #define QCONTENTPANE_H +#ifdef emit +#undef emit +#endif +#include Timeout.h + #include qwidget.h #include qpixmap.h @@ -76,6 +81,9 @@ public slots: void scrollBarChanged(int); private: + void timeout_slot(); + Timeout timeout_; + /// bool track_scrollbar_; /// owning widget
[patch] Qt scrolling
Could the Qt-ers amongst you try out the attached patch. It gives you scrolling behaviour similar to that of the xforms frontend. Specifically, if you move the mouse cursor above/below the work area, you should get 'sensible' scrolling behaviour. Try it out and let me know. Angus ps, Using this on the User Guide will crash eventually and may also occasionally 'get stuck' (for me the start of Chapter 2) moving the mouse back into the work area and out again fixed that for me. I assume that both these bugs are 'PosIterator' related. A. Index: src/frontends/qt2/QContentPane.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.C,v retrieving revision 1.27 diff -u -p -r1.27 QContentPane.C --- src/frontends/qt2/QContentPane.C 24 Nov 2003 08:26:08 - 1.27 +++ src/frontends/qt2/QContentPane.C 29 Nov 2003 21:15:12 - @@ -10,6 +10,11 @@ #include +#include "debug.h" +#include "funcrequest.h" + +#include + #include "QWorkArea.h" #include "QContentPane.h" #include "QLyXKeySym.h" @@ -18,9 +23,6 @@ #include #include -#include "funcrequest.h" - - namespace { /// return the LyX key state from Qt's @@ -76,8 +78,11 @@ mouse_button::state q_motion_state(Qt::B QContentPane::QContentPane(QWorkArea * parent) : QWidget(parent, "content_pane", WRepaintNoErase), - wa_(parent), track_scrollbar_(true) + timeout_(200), track_scrollbar_(true), wa_(parent) { + timeout_.timeout.connect( + boost::bind(::timeout_slot, this)); + setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); @@ -89,6 +94,28 @@ QContentPane::QContentPane(QWorkArea * p } +namespace { + +FuncRequest synthetic_mouse_move_event_; +int x_old = -1; +int y_old = -1; +double scrollbar_value_old = -1.0; + +}// namespace anon + + +void QContentPane::timeout_slot() +{ + lyxerr << "QContentPane::timeout_slot()" << std::endl; + timeout_.start(); + double const scrollbar_value = wa_->scrollbar_->value(); + if (scrollbar_value != scrollbar_value_old) { + scrollbar_value_old = scrollbar_value; + wa_->dispatch(synthetic_mouse_move_event_); + } +} + + void QContentPane::scrollBarChanged(int val) { if (track_scrollbar_) @@ -107,6 +134,9 @@ void QContentPane::mousePressEvent(QMous return; } + if (timeout_.running()) + timeout_.stop(); + FuncRequest cmd(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -115,6 +145,9 @@ void QContentPane::mousePressEvent(QMous void QContentPane::mouseReleaseEvent(QMouseEvent * e) { + if (timeout_.running()) + timeout_.stop(); + FuncRequest cmd(LFUN_MOUSE_RELEASE, e->x(), e->y(), q_button_state(e->button())); wa_->dispatch(cmd); @@ -123,9 +156,27 @@ void QContentPane::mouseReleaseEvent(QMo void QContentPane::mouseMoveEvent(QMouseEvent * e) { - FuncRequest cmd - (LFUN_MOUSE_MOTION, e->x(), e->y(), q_motion_state(e->state())); - wa_->dispatch(cmd); + FuncRequest cmd(LFUN_MOUSE_MOTION, e->x() - x(), e->y() - y(), + q_motion_state(e->state())); + + bool const above_or_below_workarea = + e->y() <= y() || e->y() >= y() + height(); + + if (above_or_below_workarea) { + if (timeout_.running()) + return; + synthetic_mouse_move_event_ = cmd; + timeout_.start(); + } + + double const scrollbar_value = wa_->scrollbar_->value(); + if (e->x() != x_old || e->y() != y_old || + scrollbar_value != scrollbar_value_old) { + x_old = e->x(); + y_old = e->y(); + scrollbar_value_old = scrollbar_value; + wa_->dispatch(cmd); + } } Index: src/frontends/qt2/QContentPane.h === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QContentPane.h,v retrieving revision 1.11 diff -u -p -r1.11 QContentPane.h --- src/frontends/qt2/QContentPane.h 24 Nov 2003 08:26:08 - 1.11 +++ src/frontends/qt2/QContentPane.h 29 Nov 2003 21:15:12 - @@ -12,6 +12,11 @@ #ifndef QCONTENTPANE_H #define QCONTENTPANE_H +#ifdef emit +#undef emit +#endif +#include "Timeout.h" + #include #include @@ -76,6 +81,9 @@ public slots: void scrollBarChanged(int); private: + void timeout_slot(); + Timeout timeout_; + /// bool track_scrollbar_; /// owning widget