mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Add APZ support for mousewheel delta multiplier prefs. (bug 1214170 part 2, r=kats)
This commit is contained in:
parent
a34f7136a3
commit
6ff0e08776
@ -5716,14 +5716,16 @@ EventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta(
|
||||
(mMultiplierY[index] != 1.0 && mMultiplierY[index] != -1.0);
|
||||
}
|
||||
|
||||
bool
|
||||
EventStateManager::WheelPrefs::HasUserPrefsForDelta(WidgetWheelEvent* aEvent)
|
||||
void
|
||||
EventStateManager::WheelPrefs::GetUserPrefsForEvent(WidgetWheelEvent* aEvent,
|
||||
double* aOutMultiplierX,
|
||||
double* aOutMultiplierY)
|
||||
{
|
||||
Index index = GetIndexFor(aEvent);
|
||||
Init(index);
|
||||
|
||||
return mMultiplierX[index] != 1.0 ||
|
||||
mMultiplierY[index] != 1.0;
|
||||
*aOutMultiplierX = mMultiplierX[index];
|
||||
*aOutMultiplierY = mMultiplierY[index];
|
||||
}
|
||||
|
||||
bool
|
||||
@ -5733,10 +5735,13 @@ EventStateManager::WheelEventIsScrollAction(WidgetWheelEvent* aEvent)
|
||||
WheelPrefs::GetInstance()->ComputeActionFor(aEvent) == WheelPrefs::ACTION_SCROLL;
|
||||
}
|
||||
|
||||
bool
|
||||
EventStateManager::WheelEventNeedsDeltaMultipliers(WidgetWheelEvent* aEvent)
|
||||
void
|
||||
EventStateManager::GetUserPrefsForWheelEvent(WidgetWheelEvent* aEvent,
|
||||
double* aOutMultiplierX,
|
||||
double* aOutMultiplierY)
|
||||
{
|
||||
return WheelPrefs::GetInstance()->HasUserPrefsForDelta(aEvent);
|
||||
WheelPrefs::GetInstance()->GetUserPrefsForEvent(
|
||||
aEvent, aOutMultiplierX, aOutMultiplierY);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -242,9 +242,10 @@ public:
|
||||
// Returns true if the given WidgetWheelEvent will resolve to a scroll action.
|
||||
static bool WheelEventIsScrollAction(WidgetWheelEvent* aEvent);
|
||||
|
||||
// Returns true if user prefs for wheel deltas apply to the given
|
||||
// WidgetWheelEvent.
|
||||
static bool WheelEventNeedsDeltaMultipliers(WidgetWheelEvent* aEvent);
|
||||
// Returns user-set multipliers for a wheel event.
|
||||
static void GetUserPrefsForWheelEvent(WidgetWheelEvent* aEvent,
|
||||
double* aOutMultiplierX,
|
||||
double* aOutMultiplierY);
|
||||
|
||||
// Returns whether or not a frame can be vertically scrolled with a mouse
|
||||
// wheel (as opposed to, say, a selection or touch scroll).
|
||||
@ -449,7 +450,9 @@ protected:
|
||||
* Returns whether or not ApplyUserPrefsToDelta() would change the delta
|
||||
* values of an event.
|
||||
*/
|
||||
bool HasUserPrefsForDelta(WidgetWheelEvent* aEvent);
|
||||
void GetUserPrefsForEvent(WidgetWheelEvent* aEvent,
|
||||
double* aOutMultiplierX,
|
||||
double* aOutMultiplierY);
|
||||
|
||||
/**
|
||||
* If ApplyUserPrefsToDelta() changed the delta values with customized
|
||||
|
@ -626,8 +626,7 @@ WillHandleWheelEvent(WidgetWheelEvent* aEvent)
|
||||
{
|
||||
return EventStateManager::WheelEventIsScrollAction(aEvent) &&
|
||||
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE ||
|
||||
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) &&
|
||||
!EventStateManager::WheelEventNeedsDeltaMultipliers(aEvent);
|
||||
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -1090,8 +1089,17 @@ APZCTreeManager::ProcessWheelEvent(WidgetWheelEvent& aEvent,
|
||||
scrollMode,
|
||||
ScrollWheelInput::DeltaTypeForDeltaMode(aEvent.deltaMode),
|
||||
origin,
|
||||
aEvent.deltaX,
|
||||
aEvent.deltaY);
|
||||
aEvent.deltaX, aEvent.deltaY);
|
||||
|
||||
// We add the user multiplier as a separate field, rather than premultiplying
|
||||
// it, because if the input is converted back to a WidgetWheelEvent, then
|
||||
// EventStateManager would apply the delta a second time. We could in theory
|
||||
// work around this by asking ESM to customize the event much sooner, and
|
||||
// then save the "customizedByUserPrefs" bit on ScrollWheelInput - but for
|
||||
// now, this seems easier.
|
||||
EventStateManager::GetUserPrefsForWheelEvent(&aEvent,
|
||||
&input.mUserDeltaMultiplierX,
|
||||
&input.mUserDeltaMultiplierY);
|
||||
|
||||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
aEvent.refPoint.x = input.mOrigin.x;
|
||||
|
@ -1604,7 +1604,18 @@ AsyncPanZoomController::GetScrollWheelDelta(const ScrollWheelInput& aEvent) cons
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected scroll delta type");
|
||||
}
|
||||
|
||||
if (isRootContent && gfxPrefs::MouseWheelHasRootScrollDeltaOverride()) {
|
||||
// Apply user-set multipliers.
|
||||
delta.x *= aEvent.mUserDeltaMultiplierX;
|
||||
delta.y *= aEvent.mUserDeltaMultiplierY;
|
||||
|
||||
// For the conditions under which we allow system scroll overrides, see
|
||||
// EventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction
|
||||
// and WheelTransaction::OverrideSystemScrollSpeed.
|
||||
if (isRootContent &&
|
||||
gfxPrefs::MouseWheelHasRootScrollDeltaOverride() &&
|
||||
!aEvent.IsCustomizedByUserPrefs() &&
|
||||
aEvent.mDeltaType == ScrollWheelInput::SCROLLDELTA_LINE)
|
||||
{
|
||||
// Only apply delta multipliers if we're increasing the delta.
|
||||
double hfactor = double(gfxPrefs::MouseWheelRootHScrollDeltaFactor()) / 100;
|
||||
double vfactor = double(gfxPrefs::MouseWheelRootVScrollDeltaFactor()) / 100;
|
||||
|
@ -376,6 +376,8 @@ ScrollWheelInput::ScrollWheelInput(const WidgetWheelEvent& aWheelEvent) :
|
||||
mDeltaY(aWheelEvent.deltaY),
|
||||
mLineOrPageDeltaX(aWheelEvent.lineOrPageDeltaX),
|
||||
mLineOrPageDeltaY(aWheelEvent.lineOrPageDeltaY),
|
||||
mUserDeltaMultiplierX(1.0),
|
||||
mUserDeltaMultiplierY(1.0),
|
||||
mIsMomentum(aWheelEvent.isMomentum)
|
||||
{
|
||||
mOrigin =
|
||||
@ -415,4 +417,11 @@ ScrollWheelInput::TransformToLocal(const gfx::Matrix4x4& aTransform)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ScrollWheelInput::IsCustomizedByUserPrefs() const
|
||||
{
|
||||
return mUserDeltaMultiplierX != 1.0 ||
|
||||
mUserDeltaMultiplierY != 1.0;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -583,6 +583,8 @@ public:
|
||||
mLineOrPageDeltaX(0),
|
||||
mLineOrPageDeltaY(0),
|
||||
mScrollSeriesNumber(0),
|
||||
mUserDeltaMultiplierX(1.0),
|
||||
mUserDeltaMultiplierY(1.0),
|
||||
mIsMomentum(false)
|
||||
{}
|
||||
|
||||
@ -591,6 +593,8 @@ public:
|
||||
WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
|
||||
bool TransformToLocal(const gfx::Matrix4x4& aTransform);
|
||||
|
||||
bool IsCustomizedByUserPrefs() const;
|
||||
|
||||
ScrollDeltaType mDeltaType;
|
||||
ScrollMode mScrollMode;
|
||||
ScreenPoint mOrigin;
|
||||
@ -620,6 +624,10 @@ public:
|
||||
// first event is 1; if not a member of a transaction, this is 0.
|
||||
uint32_t mScrollSeriesNumber;
|
||||
|
||||
// User-set delta multipliers.
|
||||
double mUserDeltaMultiplierX;
|
||||
double mUserDeltaMultiplierY;
|
||||
|
||||
bool mIsMomentum;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user