зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1289435 - Support native event synthesization even for non-touch windows devices. r=jimm
MozReview-Commit-ID: IeHmDOiWOW2
This commit is contained in:
Родитель
713c58caee
Коммит
9d9124f381
|
@ -128,7 +128,25 @@ nsWindowBase::SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|||
AutoObserverNotifier notifier(aObserver, "touchpoint");
|
||||
|
||||
if (!InitTouchInjection()) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
// If we don't have touch injection from the OS, we can just fake it and
|
||||
// synthesize the events from here.
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (aPointerState == TOUCH_HOVER) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!mSynthesizedTouchInput) {
|
||||
mSynthesizedTouchInput = MakeUnique<MultiTouchInput>();
|
||||
}
|
||||
|
||||
WidgetEventTime time = CurrentMessageWidgetEventTime();
|
||||
LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
|
||||
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
|
||||
mSynthesizedTouchInput.get(), time.mTime, time.mTimeStamp,
|
||||
aPointerId, aPointerState, pointInWindow, aPointerPressure,
|
||||
aPointerOrientation);
|
||||
DispatchTouchInput(inputToDispatch);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool hover = aPointerState & TOUCH_HOVER;
|
||||
|
|
|
@ -129,6 +129,10 @@ protected:
|
|||
static bool sTouchInjectInitialized;
|
||||
static InjectTouchInputPtr sInjectTouchFuncPtr;
|
||||
|
||||
// This is used by SynthesizeNativeTouchPoint to maintain state between
|
||||
// multiple synthesized points, in the case where we can't call InjectTouch
|
||||
// directly.
|
||||
mozilla::UniquePtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
|
||||
protected:
|
||||
InputContext mInputContext;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче