Author: hdu Date: Wed May 21 06:51:34 2014 New Revision: 1596491 URL: http://svn.apache.org/r1596491 Log: #i124191# fix horizontal scroll events on Mac
A problem with horizontal scrolling was reported on Mac. Reviewing the relevant code identified some problems. The patch to fix them was confirmed to also fix the reported problem. Found-by: [email protected] Tested-by: [email protected] Tested-by: [email protected] Tested-by: [email protected] Modified: openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm Modified: openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm?rev=1596491&r1=1596490&r2=1596491&view=diff ============================================================================== --- openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm (original) +++ openoffice/trunk/main/vcl/aqua/source/window/salframeview.mm Wed May 21 06:51:34 2014 @@ -803,8 +803,8 @@ private: mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; // merge pending scroll wheel events - float dX = 0.0; - float dY = 0.0; + CGFloat dX = 0.0; + CGFloat dY = 0.0; for(;;) { dX += [pEvent deltaX]; @@ -833,7 +833,7 @@ private: if( dX != 0.0 ) { aEvent.mnDelta = static_cast<long>(floor(dX)); - aEvent.mnNotchDelta = dX < 0 ? -1 : 1; + aEvent.mnNotchDelta = (dX < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = TRUE; @@ -843,7 +843,7 @@ private: if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame )) { aEvent.mnDelta = static_cast<long>(floor(dY)); - aEvent.mnNotchDelta = dY < 0 ? -1 : 1; + aEvent.mnNotchDelta = (dY < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; @@ -863,8 +863,8 @@ private: mpFrame->mnLastModifierFlags = [pEvent modifierFlags]; // merge pending scroll wheel events - float dX = 0.0; - float dY = 0.0; + CGFloat dX = 0.0; + CGFloat dY = 0.0; for(;;) { dX += [pEvent deltaX]; @@ -893,11 +893,11 @@ private: if( dX != 0.0 ) { aEvent.mnDelta = static_cast<long>(floor(dX)); - aEvent.mnNotchDelta = dX < 0 ? -1 : 1; + aEvent.mnNotchDelta = (dX < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = TRUE; - aEvent.mnScrollLines = dY > 0 ? dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR; + aEvent.mnScrollLines = (dX > 0) ? +dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR; if( aEvent.mnScrollLines == 0 ) aEvent.mnScrollLines = 1; @@ -906,11 +906,11 @@ private: if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) ) { aEvent.mnDelta = static_cast<long>(floor(dY)); - aEvent.mnNotchDelta = dY < 0 ? -1 : 1; + aEvent.mnNotchDelta = (dY < 0) ? -1 : +1; if( aEvent.mnDelta == 0 ) aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; - aEvent.mnScrollLines = dY > 0 ? dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR; + aEvent.mnScrollLines = (dY > 0) ? +dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR; if( aEvent.mnScrollLines < 1 ) aEvent.mnScrollLines = 1;
