зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288187 - Allow synthesizing widget touch events on OS X. r=mstange
MozReview-Commit-ID: AGvZQZtbPh
This commit is contained in:
Родитель
d8e85035dd
Коммит
f27c48490f
|
@ -419,6 +419,12 @@ public:
|
|||
uint32_t aModifierFlags,
|
||||
uint32_t aAdditionalFlags,
|
||||
nsIObserver* aObserver) override;
|
||||
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
TouchPointerState aPointerState,
|
||||
LayoutDeviceIntPoint aPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver) override;
|
||||
|
||||
// Mac specific methods
|
||||
|
||||
|
@ -646,6 +652,10 @@ protected:
|
|||
static uint32_t sLastInputEventCount;
|
||||
|
||||
void ReleaseTitlebarCGContext();
|
||||
|
||||
// This is used by SynthesizeNativeTouchPoint to maintain state between
|
||||
// multiple synthesized points
|
||||
mozilla::UniquePtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
|
||||
};
|
||||
|
||||
#endif // nsChildView_h_
|
||||
|
|
|
@ -1184,6 +1184,54 @@ nsresult nsChildView::SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntP
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
nsresult nsChildView::SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
||||
TouchPointerState aPointerState,
|
||||
mozilla::LayoutDeviceIntPoint aPoint,
|
||||
double aPointerPressure,
|
||||
uint32_t aPointerOrientation,
|
||||
nsIObserver* aObserver)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
AutoObserverNotifier notifier(aObserver, "touchpoint");
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (aPointerState == TOUCH_HOVER) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!mSynthesizedTouchInput) {
|
||||
mSynthesizedTouchInput = MakeUnique<MultiTouchInput>();
|
||||
}
|
||||
|
||||
LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
|
||||
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
|
||||
mSynthesizedTouchInput.get(), aPointerId, aPointerState,
|
||||
pointInWindow, aPointerPressure, aPointerOrientation);
|
||||
|
||||
if (mAPZC) {
|
||||
uint64_t inputBlockId = 0;
|
||||
ScrollableLayerGuid guid;
|
||||
|
||||
nsEventStatus result = mAPZC->ReceiveInputEvent(inputToDispatch, &guid, &inputBlockId);
|
||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
WidgetTouchEvent event = inputToDispatch.ToWidgetTouchEvent(this);
|
||||
ProcessUntransformedAPZEvent(&event, guid, inputBlockId, result);
|
||||
} else {
|
||||
WidgetTouchEvent event = inputToDispatch.ToWidgetTouchEvent(this);
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
}
|
||||
|
||||
return NS_OK;;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
// First argument has to be an NSMenu representing the application's top-level
|
||||
// menu bar. The returned item is *not* retained.
|
||||
static NSMenuItem* NativeMenuItemWithLocation(NSMenu* menubar, NSString* locationString)
|
||||
|
|
Загрузка…
Ссылка в новой задаче