"James C. Sutherland" <james.sutherl...@utah.edu> writes:
> When trying to scroll with the mouse, I get many copies of the following
> message:
>
>> /Users/stephan/cvs/lyx/lyx-2.0.0alpha4/src/frontends/qt4/GuiWorkArea.cpp(840):
>> wheelScrollLines = 3 delta = 0 scroll_value = 0 page_step = 734
>>

The problem is "delata = 0". The code reads:

void GuiWorkArea::wheelEvent(QWheelEvent * ev)
{
        // Wheel rotation by one notch results in a delta() of 120 (see
        // documentation of QWheelEvent)
        int const delta = ev->delta() / 120;

On PCs, the mouse wheel clicks, and each wheelEvent corresponds to a
multiple of 120 (unot is eighth of degree, and a click is 15 degrees).
On a mac, the situation is different, since the wheel turns smoothly.

It might be enough to have delta be a double. Could you test the
attached patch?

JMarc

Index: src/frontends/qt4/GuiWorkArea.cpp
===================================================================
--- src/frontends/qt4/GuiWorkArea.cpp	(révision 34729)
+++ src/frontends/qt4/GuiWorkArea.cpp	(copie de travail)
@@ -816,7 +816,7 @@
 {
 	// Wheel rotation by one notch results in a delta() of 120 (see
 	// documentation of QWheelEvent)
-	int const delta = ev->delta() / 120;
+	double const delta = ev->delta() / 120.0;
 	if (ev->modifiers() & Qt::ControlModifier) {
 		docstring arg = convert<docstring>(5 * delta);
 		lyx::dispatch(FuncRequest(LFUN_BUFFER_ZOOM_IN, arg));
@@ -830,11 +830,8 @@
 	int scroll_value = lines > page_step
 		? page_step : lines * verticalScrollBar()->singleStep();
 
-	// Take into account the rotation.
-	scroll_value *= delta;
-
-	// Take into account user preference.
-	scroll_value = int(scroll_value * lyxrc.mouse_wheel_speed);
+	// Take into account the rotation and the user preferences.
+	scroll_value = int(scroll_value * delta * lyxrc.mouse_wheel_speed);
 	LYXERR(Debug::SCROLLING, "wheelScrollLines = " << lines
 			<< " delta = " << delta << " scroll_value = " << scroll_value
 			<< " page_step = " << page_step);

Reply via email to