--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1092,39 +1092,39 @@ nsDOMWindowUtils::SendNativeTouchPoint(u
return NS_ERROR_FAILURE;
}
if (aPressure < 0 || aPressure > 1 || aOrientation > 359) {
return NS_ERROR_INVALID_ARG;
}
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
- <uint32_t, nsIWidget::TouchPointerState, ScreenIntPoint, double, uint32_t, nsIObserver*>
+ <uint32_t, nsIWidget::TouchPointerState, LayoutDeviceIntPoint, double, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
(nsIWidget::TouchPointerState)aTouchState,
- ScreenIntPoint(aScreenX, aScreenY),
+ LayoutDeviceIntPoint(aScreenX, aScreenY),
aPressure, aOrientation, aObserver));
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
int32_t aScreenY,
bool aLongTap,
nsIObserver* aObserver)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
return NS_ERROR_FAILURE;
}
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
- <ScreenIntPoint, bool, nsIObserver*>
+ <LayoutDeviceIntPoint, bool, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchTap,
- ScreenIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
+ LayoutDeviceIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::ClearNativeTouchSequence(nsIObserver* aObserver)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -457,21 +457,21 @@ parent:
double aDeltaX,
double aDeltaY,
double aDeltaZ,
uint32_t aModifierFlags,
uint32_t aAdditionalFlags,
uint64_t aObserverId);
async SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
uint64_t aObserverId);
- async SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
+ async SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
bool aLongTap,
uint64_t aObserverId);
async ClearNativeTouchSequence(uint64_t aObserverId);
child:
async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
parent:
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1457,40 +1457,39 @@ TabParent::RecvSynthesizeNativeMouseScro
responder.GetObserver());
}
return true;
}
bool
TabParent::RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
const TouchPointerState& aPointerState,
- const ScreenIntPoint& aPointerScreenPoint,
+ const LayoutDeviceIntPoint& aPoint,
const double& aPointerPressure,
const uint32_t& aPointerOrientation,
const uint64_t& aObserverId)
{
AutoSynthesizedEventResponder responder(this, aObserverId, "touchpoint");
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget) {
- widget->SynthesizeNativeTouchPoint(aPointerId, aPointerState, aPointerScreenPoint,
+ widget->SynthesizeNativeTouchPoint(aPointerId, aPointerState, aPoint,
aPointerPressure, aPointerOrientation, responder.GetObserver());
}
return true;
}
bool
-TabParent::RecvSynthesizeNativeTouchTap(const ScreenIntPoint& aPointerScreenPoint,
+TabParent::RecvSynthesizeNativeTouchTap(const LayoutDeviceIntPoint& aPoint,
const bool& aLongTap,
const uint64_t& aObserverId)
{
AutoSynthesizedEventResponder responder(this, aObserverId, "touchtap");
nsCOMPtr<nsIWidget> widget = GetWidget();
if (widget) {
- widget->SynthesizeNativeTouchTap(aPointerScreenPoint, aLongTap,
- responder.GetObserver());
+ widget->SynthesizeNativeTouchTap(aPoint, aLongTap, responder.GetObserver());
}
return true;
}
bool
TabParent::RecvClearNativeTouchSequence(const uint64_t& aObserverId)
{
AutoSynthesizedEventResponder responder(this, aObserverId, "cleartouch");
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -391,23 +391,23 @@ public:
const double& aDeltaZ,
const uint32_t& aModifierFlags,
const uint32_t& aAdditionalFlags,
const uint64_t& aObserverId) override;
virtual bool
RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
const TouchPointerState& aPointerState,
- const ScreenIntPoint& aPointerScreenPoint,
+ const LayoutDeviceIntPoint& aPoint,
const double& aPointerPressure,
const uint32_t& aPointerOrientation,
const uint64_t& aObserverId) override;
virtual bool
- RecvSynthesizeNativeTouchTap(const ScreenIntPoint& aPointerScreenPoint,
+ RecvSynthesizeNativeTouchTap(const LayoutDeviceIntPoint& aPoint,
const bool& aLongTap,
const uint64_t& aObserverId) override;
virtual bool
RecvClearNativeTouchSequence(const uint64_t& aObserverId) override;
void SendMouseEvent(const nsAString& aType, float aX, float aY,
int32_t aButton, int32_t aClickCount,
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -445,41 +445,41 @@ PuppetWidget::SynthesizeNativeMouseScrol
aDeltaX, aDeltaY, aDeltaZ, aModifierFlags, aAdditionalFlags,
notifier.SaveObserver());
return NS_OK;
}
nsresult
PuppetWidget::SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchpoint");
if (!mTabChild) {
return NS_ERROR_FAILURE;
}
mTabChild->SendSynthesizeNativeTouchPoint(aPointerId, aPointerState,
- aPointerScreenPoint, aPointerPressure, aPointerOrientation,
+ aPoint, aPointerPressure, aPointerOrientation,
notifier.SaveObserver());
return NS_OK;
}
nsresult
-PuppetWidget::SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
+PuppetWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
bool aLongTap,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchtap");
if (!mTabChild) {
return NS_ERROR_FAILURE;
}
- mTabChild->SendSynthesizeNativeTouchTap(aPointerScreenPoint, aLongTap,
+ mTabChild->SendSynthesizeNativeTouchTap(aPoint, aLongTap,
notifier.SaveObserver());
return NS_OK;
}
nsresult
PuppetWidget::ClearNativeTouchSequence(nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "cleartouch");
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -235,21 +235,21 @@ public:
double aDeltaX,
double aDeltaY,
double aDeltaZ,
uint32_t aModifierFlags,
uint32_t aAdditionalFlags,
nsIObserver* aObserver) override;
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
- virtual nsresult SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
+ virtual nsresult SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
bool aLongTap,
nsIObserver* aObserver) override;
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;
virtual uint32_t GetMaxTouchPoints() const override;
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
virtual void SetCandidateWindowForPlugin(
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -3364,17 +3364,17 @@ nsWindow::GetIMEUpdatePreference()
return nsIMEUpdatePreference(
nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE);
}
nsresult
nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
{
mozilla::widget::AutoObserverNotifier notifier(aObserver, "touchpoint");
int eventType;
switch (aPointerState) {
@@ -3393,18 +3393,17 @@ nsWindow::SynthesizeNativeTouchPoint(uin
case TOUCH_HOVER: // not supported for now
default:
return NS_ERROR_UNEXPECTED;
}
MOZ_ASSERT(mGLControllerSupport);
GeckoLayerClient::LocalRef client = mGLControllerSupport->GetLayerClient();
client->SynthesizeNativeTouchPoint(aPointerId, eventType,
- aPointerScreenPoint.x, aPointerScreenPoint.y, aPointerPressure,
- aPointerOrientation);
+ aPoint.x, aPoint.y, aPointerPressure, aPointerOrientation);
return NS_OK;
}
void
nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager,
LayoutDeviceIntRect aRect)
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -185,17 +185,17 @@ public:
virtual uint32_t GetMaxTouchPoints() const override;
void UpdateZoomConstraints(const uint32_t& aPresShellId,
const FrameMetrics::ViewID& aViewId,
const mozilla::Maybe<ZoomConstraints>& aConstraints) override;
nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
protected:
void BringToFront();
nsWindow *FindTopLevel();
bool IsTopLevel();
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -250,53 +250,56 @@ public:
private:
MultiTouchInput mInput;
};
nsresult
nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchpoint");
if (aPointerState == TOUCH_HOVER) {
return NS_ERROR_UNEXPECTED;
}
if (!mSynthesizedTouchInput) {
mSynthesizedTouchInput = new MultiTouchInput();
}
+ ScreenIntPoint pointerScreenPoint = ViewAs<ScreenPixel>(aPoint,
+ PixelCastJustification::LayoutDeviceIsScreenForBounds);
+
// We can't dispatch mSynthesizedTouchInput directly because (a) dispatching
// it might inadvertently modify it and (b) in the case of touchend or
// touchcancel events mSynthesizedTouchInput will hold the touches that are
// still down whereas the input dispatched needs to hold the removed
// touch(es). We use |inputToDispatch| for this purpose.
MultiTouchInput inputToDispatch;
inputToDispatch.mInputType = MULTITOUCH_INPUT;
int32_t index = mSynthesizedTouchInput->IndexOfTouch((int32_t)aPointerId);
if (aPointerState == TOUCH_CONTACT) {
if (index >= 0) {
// found an existing touch point, update it
SingleTouchData& point = mSynthesizedTouchInput->mTouches[index];
- point.mScreenPoint = aPointerScreenPoint;
+ point.mScreenPoint = pointerScreenPoint;
point.mRotationAngle = (float)aPointerOrientation;
point.mForce = (float)aPointerPressure;
inputToDispatch.mType = MultiTouchInput::MULTITOUCH_MOVE;
} else {
// new touch point, add it
mSynthesizedTouchInput->mTouches.AppendElement(SingleTouchData(
(int32_t)aPointerId,
- aPointerScreenPoint,
+ pointerScreenPoint,
ScreenSize(0, 0),
(float)aPointerOrientation,
(float)aPointerPressure));
inputToDispatch.mType = MultiTouchInput::MULTITOUCH_START;
}
inputToDispatch.mTouches = mSynthesizedTouchInput->mTouches;
} else {
MOZ_ASSERT(aPointerState == TOUCH_REMOVE || aPointerState == TOUCH_CANCEL);
@@ -304,17 +307,17 @@ nsWindow::SynthesizeNativeTouchPoint(uin
if (index >= 0) {
mSynthesizedTouchInput->mTouches.RemoveElementAt(index);
}
inputToDispatch.mType = (aPointerState == TOUCH_REMOVE
? MultiTouchInput::MULTITOUCH_END
: MultiTouchInput::MULTITOUCH_CANCEL);
inputToDispatch.mTouches.AppendElement(SingleTouchData(
(int32_t)aPointerId,
- aPointerScreenPoint,
+ pointerScreenPoint,
ScreenSize(0, 0),
(float)aPointerOrientation,
(float)aPointerPressure));
}
// Can't use NewRunnableMethod here because that will pass a const-ref
// argument to DispatchTouchInputViaAPZ whereas that function takes a
// non-const ref. At this callsite we don't care about the mutations that
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -84,17 +84,17 @@ public:
void DispatchTouchEventForAPZ(const mozilla::MultiTouchInput& aInput,
const ScrollableLayerGuid& aGuid,
const uint64_t aInputBlockId,
nsEventStatus aApzResponse);
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus);
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
bool aDoCapture)
{
return NS_ERROR_NOT_IMPLEMENTED;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6871,17 +6871,17 @@ nsWindow::SynthesizeNativeMouseScrollEve
return NS_OK;
}
#if GTK_CHECK_VERSION(3,4,0)
nsresult
nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchpoint");
if (!mGdkWindow) {
return NS_OK;
@@ -6933,23 +6933,20 @@ nsWindow::SynthesizeNativeTouchPoint(uin
event.touch.window = mGdkWindow;
event.touch.time = GDK_CURRENT_TIME;
GdkDisplay* display = gdk_window_get_display(mGdkWindow);
GdkDeviceManager* device_manager = gdk_display_get_device_manager(display);
event.touch.device = gdk_device_manager_get_client_pointer(device_manager);
- event.touch.x_root = DevicePixelsToGdkCoordRoundDown(aPointerScreenPoint.x);
- event.touch.y_root = DevicePixelsToGdkCoordRoundDown(aPointerScreenPoint.y);
-
- LayoutDeviceIntPoint pointInWindow =
- ViewAs<LayoutDevicePixel>(aPointerScreenPoint,
- PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent)
- - WidgetToScreenOffset();
+ event.touch.x_root = DevicePixelsToGdkCoordRoundDown(aPoint.x);
+ event.touch.y_root = DevicePixelsToGdkCoordRoundDown(aPoint.y);
+
+ LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
event.touch.x = DevicePixelsToGdkCoordRoundDown(pointInWindow.x);
event.touch.y = DevicePixelsToGdkCoordRoundDown(pointInWindow.y);
gdk_event_put(&event);
return NS_OK;
}
#endif
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -342,17 +342,17 @@ public:
double aDeltaZ,
uint32_t aModifierFlags,
uint32_t aAdditionalFlags,
nsIObserver* aObserver) override;
#if GTK_CHECK_VERSION(3,4,0)
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
#endif
// HiDPI scale conversion
gint GdkScaleFactor();
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1917,46 +1917,46 @@ nsBaseWidget::GetWidgetScreen()
nsCOMPtr<nsIScreen> screen;
screenManager->ScreenForRect(bounds.x, bounds.y,
bounds.width, bounds.height,
getter_AddRefs(screen));
return screen.forget();
}
nsresult
-nsIWidget::SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint, bool aLongTap,
+nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint, bool aLongTap,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchtap");
if (sPointerIdCounter > TOUCH_INJECT_MAX_POINTS) {
sPointerIdCounter = 0;
}
int pointerId = sPointerIdCounter;
sPointerIdCounter++;
nsresult rv = SynthesizeNativeTouchPoint(pointerId, TOUCH_CONTACT,
- aPointerScreenPoint, 1.0, 90, nullptr);
+ aPoint, 1.0, 90, nullptr);
if (NS_FAILED(rv)) {
return rv;
}
if (!aLongTap) {
nsresult rv = SynthesizeNativeTouchPoint(pointerId, TOUCH_REMOVE,
- aPointerScreenPoint, 0, 0, nullptr);
+ aPoint, 0, 0, nullptr);
return rv;
}
// initiate a long tap
int elapse = Preferences::GetInt("ui.click_hold_context_menus.delay",
TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC);
if (!mLongTapTimer) {
mLongTapTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
SynthesizeNativeTouchPoint(pointerId, TOUCH_CANCEL,
- aPointerScreenPoint, 0, 0, nullptr);
+ aPoint, 0, 0, nullptr);
return NS_ERROR_UNEXPECTED;
}
// Windows requires recuring events, so we set this to a smaller window
// than the pref value.
int timeout = elapse;
if (timeout > TOUCH_INJECT_PUMP_TIMER_MSEC) {
timeout = TOUCH_INJECT_PUMP_TIMER_MSEC;
}
@@ -1967,17 +1967,17 @@ nsIWidget::SynthesizeNativeTouchTap(Scre
// If we already have a long tap pending, cancel it. We only allow one long
// tap to be active at a time.
if (mLongTapTouchPoint) {
SynthesizeNativeTouchPoint(mLongTapTouchPoint->mPointerId, TOUCH_CANCEL,
mLongTapTouchPoint->mPosition, 0, 0, nullptr);
}
- mLongTapTouchPoint = new LongTapInfo(pointerId, aPointerScreenPoint,
+ mLongTapTouchPoint = new LongTapInfo(pointerId, aPoint,
TimeDuration::FromMilliseconds(elapse),
aObserver);
notifier.SkipNotification(); // we'll do it in the long-tap callback
return NS_OK;
}
// static
void
--- a/widget/nsBaseWidget.h
+++ b/widget/nsBaseWidget.h
@@ -418,17 +418,17 @@ protected:
nsIObserver* aObserver) override
{
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mousescrollevent");
return NS_ERROR_UNEXPECTED;
}
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override
{
mozilla::widget::AutoObserverNotifier notifier(aObserver, "touchpoint");
return NS_ERROR_UNEXPECTED;
}
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1681,39 +1681,39 @@ class nsIWidget : public nsISupports {
/*
* Create a new or update an existing touch pointer on the digitizer.
* To trigger os level gestures, individual touch points should
* transition through a complete set of touch states which should be
* sent as individual messages.
*
* @param aPointerId The touch point id to create or update.
* @param aPointerState one or more of the touch states listed above
- * @param aScreenX, aScreenY screen coords of this event
+ * @param aPoint coords of this event
* @param aPressure 0.0 -> 1.0 float val indicating pressure
* @param aOrientation 0 -> 359 degree value indicating the
* orientation of the pointer. Use 90 for normal taps.
* @param aObserver The observer that will get notified once the events
* have been dispatched.
*/
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) = 0;
/*
* Helper for simulating a simple tap event with one touch point. When
* aLongTap is true, simulates a native long tap with a duration equal to
* ui.click_hold_context_menus.delay. This pref is compatible with the
* apzc long tap duration. Defaults to 1.5 seconds.
* @param aObserver The observer that will get notified once the events
* have been dispatched.
*/
- virtual nsresult SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
+ virtual nsresult SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
bool aLongTap,
nsIObserver* aObserver);
/*
* Cancels all active simulated touch input points and pending long taps.
* Native widgets should track existing points such that they can clear the
* digitizer state when this call is made.
* @param aObserver The observer that will get notified once the touch
@@ -1722,29 +1722,29 @@ class nsIWidget : public nsISupports {
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver);
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0;
private:
class LongTapInfo
{
public:
- LongTapInfo(int32_t aPointerId, ScreenIntPoint& aPoint,
+ LongTapInfo(int32_t aPointerId, LayoutDeviceIntPoint& aPoint,
mozilla::TimeDuration aDuration,
nsIObserver* aObserver) :
mPointerId(aPointerId),
mPosition(aPoint),
mDuration(aDuration),
mObserver(aObserver),
mStamp(mozilla::TimeStamp::Now())
{
}
int32_t mPointerId;
- ScreenIntPoint mPosition;
+ LayoutDeviceIntPoint mPosition;
mozilla::TimeDuration mDuration;
nsCOMPtr<nsIObserver> mObserver;
mozilla::TimeStamp mStamp;
};
static void OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure);
nsAutoPtr<LongTapInfo> mLongTapTouchPoint;
--- a/widget/windows/nsWindowBase.cpp
+++ b/widget/windows/nsWindowBase.cpp
@@ -65,17 +65,17 @@ nsWindowBase::InitTouchInjection()
return false;
}
sTouchInjectInitialized = true;
}
return true;
}
bool
-nsWindowBase::InjectTouchPoint(uint32_t aId, ScreenIntPoint& aPointerScreenPoint,
+nsWindowBase::InjectTouchPoint(uint32_t aId, LayoutDeviceIntPoint& aPoint,
POINTER_FLAGS aFlags, uint32_t aPressure,
uint32_t aOrientation)
{
if (aId > TOUCH_INJECT_MAX_POINTS) {
WinUtils::Log("Pointer ID exceeds maximum. See TOUCH_INJECT_MAX_POINTS.");
return false;
}
@@ -85,18 +85,18 @@ nsWindowBase::InjectTouchPoint(uint32_t
info.touchFlags = TOUCH_FLAG_NONE;
info.touchMask = TOUCH_MASK_CONTACTAREA|TOUCH_MASK_ORIENTATION|TOUCH_MASK_PRESSURE;
info.pressure = aPressure;
info.orientation = aOrientation;
info.pointerInfo.pointerFlags = aFlags;
info.pointerInfo.pointerType = PT_TOUCH;
info.pointerInfo.pointerId = aId;
- info.pointerInfo.ptPixelLocation.x = aPointerScreenPoint.x;
- info.pointerInfo.ptPixelLocation.y = aPointerScreenPoint.y;
+ info.pointerInfo.ptPixelLocation.x = aPoint.x;
+ info.pointerInfo.ptPixelLocation.y = aPoint.y;
info.rcContact.top = info.pointerInfo.ptPixelLocation.y - 2;
info.rcContact.bottom = info.pointerInfo.ptPixelLocation.y + 2;
info.rcContact.left = info.pointerInfo.ptPixelLocation.x - 2;
info.rcContact.right = info.pointerInfo.ptPixelLocation.x + 2;
if (!sInjectTouchFuncPtr(1, &info)) {
WinUtils::Log("InjectTouchInput failure. GetLastError=%d", GetLastError());
@@ -114,17 +114,17 @@ void nsWindowBase::ChangedDPI()
}
mWidgetListener->UIResolutionChanged();
}
}
nsresult
nsWindowBase::SynthesizeNativeTouchPoint(uint32_t aPointerId,
nsIWidget::TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchpoint");
if (!InitTouchInjection()) {
return NS_ERROR_NOT_IMPLEMENTED;
@@ -155,36 +155,36 @@ nsWindowBase::SynthesizeNativeTouchPoint
// so shouldn't leak.
mActivePointers.Remove(aPointerId);
}
if (cancel) {
flags |= POINTER_FLAG_CANCELED;
}
- return !InjectTouchPoint(aPointerId, aPointerScreenPoint, flags,
+ return !InjectTouchPoint(aPointerId, aPoint, flags,
pressure, aPointerOrientation) ?
NS_ERROR_UNEXPECTED : NS_OK;
}
// Missing init state, error out
if (remove || cancel) {
return NS_ERROR_INVALID_ARG;
}
// Create a new pointer
- info = new PointerInfo(aPointerId, aPointerScreenPoint);
+ info = new PointerInfo(aPointerId, aPoint);
POINTER_FLAGS flags = POINTER_FLAG_INRANGE;
if (contact) {
flags |= POINTER_FLAG_INCONTACT|POINTER_FLAG_DOWN;
}
mActivePointers.Put(aPointerId, info);
- return !InjectTouchPoint(aPointerId, aPointerScreenPoint, flags,
+ return !InjectTouchPoint(aPointerId, aPoint, flags,
pressure, aPointerOrientation) ?
NS_ERROR_UNEXPECTED : NS_OK;
}
nsresult
nsWindowBase::ClearNativeTouchSequence(nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "cleartouch");
--- a/widget/windows/nsWindowBase.h
+++ b/widget/windows/nsWindowBase.h
@@ -85,17 +85,17 @@ public:
*/
virtual bool DispatchPluginEvent(const MSG& aMsg);
/*
* Touch input injection apis
*/
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
- ScreenIntPoint aPointerScreenPoint,
+ LayoutDeviceIntPoint aPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;
/*
* WM_APPCOMMAND common handler.
* Sends events via NativeKey::HandleAppCommandMessage().
@@ -103,31 +103,31 @@ public:
virtual bool HandleAppCommandMsg(const MSG& aAppCommandMsg,
LRESULT *aRetValue);
protected:
virtual int32_t LogToPhys(double aValue) = 0;
void ChangedDPI();
static bool InitTouchInjection();
- bool InjectTouchPoint(uint32_t aId, ScreenIntPoint& aPointerScreenPoint,
+ bool InjectTouchPoint(uint32_t aId, LayoutDeviceIntPoint& aPoint,
POINTER_FLAGS aFlags, uint32_t aPressure = 1024,
uint32_t aOrientation = 90);
class PointerInfo
{
public:
- PointerInfo(int32_t aPointerId, ScreenIntPoint& aPoint) :
+ PointerInfo(int32_t aPointerId, LayoutDeviceIntPoint& aPoint) :
mPointerId(aPointerId),
mPosition(aPoint)
{
}
int32_t mPointerId;
- ScreenIntPoint mPosition;
+ LayoutDeviceIntPoint mPosition;
};
nsClassHashtable<nsUint32HashKey, PointerInfo> mActivePointers;
static bool sTouchInjectInitialized;
static InjectTouchInputPtr sInjectTouchFuncPtr;
protected:
InputContext mInputContext;