Handle the scroll wheel changing over scrollbars.

* Extract the scrollbar change based on the mouse wheel delta into a protected
  method of BView.
* Call that method from BScrollBar's MessageReceived.

With this change it is now a bit easier to scroll horizontally around the
system by putting the mouse cursor over a horizontal scrollbar and using the
wheel.

Fixes #8631.
This commit is contained in:
Ryan Leavengood
2012-06-24 10:50:42 -04:00
parent bfc18b1ecd
commit 9f5864ab09
3 changed files with 40 additions and 21 deletions
+16
View File
@@ -642,6 +642,22 @@ BScrollBar::MessageReceived(BMessage* message)
ValueChanged(value);
break;
}
case B_MOUSE_WHEEL_CHANGED:
{
// Must handle this here since BView checks for the existence of
// scrollbars, which a scrollbar itself does not have
float deltaX = 0.0f, deltaY = 0.0f;
message->FindFloat("be:wheel_delta_x", &deltaX);
message->FindFloat("be:wheel_delta_y", &deltaY);
if (deltaX == 0.0f && deltaY == 0.0f)
break;
if (deltaX != 0.0f && deltaY == 0.0f)
deltaY = deltaX;
ScrollWithMouseWheelDelta(this, deltaY);
}
default:
BView::MessageReceived(message);
break;