Commit b65d41e6 authored by Timothy Nikkel's avatar Timothy Nikkel
Browse files

Bug 1641996. Small follow up.

Depends on D77576

Differential Revision: https://phabricator.services.mozilla.com/D77583
parent 015f54d3
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -355,6 +355,10 @@ DirectManipulationOwner::~DirectManipulationOwner() { Destroy(); }
#if !defined(__MINGW32__) && !defined(__MINGW64__)

void DManipEventHandler::SendPinch(Phase aPhase, float aScale) {
  if (!mWindow) {
    return;
  }

  PinchGestureInput::PinchGestureType pinchGestureType =
      PinchGestureInput::PINCHGESTURE_SCALE;
  switch (aPhase) {
@@ -383,7 +387,7 @@ void DManipEventHandler::SendPinch(Phase aPhase, float aScale) {

  POINT cursor_pos;
  ::GetCursorPos(&cursor_pos);
  HWND wnd = static_cast<HWND>(mWindow ? mWindow->GetNativeData(NS_NATIVE_WINDOW) : nullptr);
  HWND wnd = static_cast<HWND>(mWindow->GetNativeData(NS_NATIVE_WINDOW));
  ::ScreenToClient(wnd, &cursor_pos);
  ScreenPoint position = {(float)cursor_pos.x, (float)cursor_pos.y};

@@ -397,13 +401,15 @@ void DManipEventHandler::SendPinch(Phase aPhase, float aScale) {
      100.0 * ((aPhase != Phase::eMiddle) ? 1.f : mLastScale),
      mods};

  if (mWindow) {
  mWindow->SendAnAPZEvent(event);
}
}

void DManipEventHandler::SendPan(Phase aPhase, float x, float y,
                                 bool aIsInertia) {
  if (!mWindow) {
    return;
  }

  PanGestureInput::PanGestureType panGestureType =
      PanGestureInput::PANGESTURE_PAN;
  if (aIsInertia) {
@@ -443,17 +449,15 @@ void DManipEventHandler::SendPan(Phase aPhase, float x, float y,

  POINT cursor_pos;
  ::GetCursorPos(&cursor_pos);
  HWND wnd = static_cast<HWND>(mWindow ? mWindow->GetNativeData(NS_NATIVE_WINDOW) : nullptr);
  HWND wnd = static_cast<HWND>(mWindow->GetNativeData(NS_NATIVE_WINDOW));
  ::ScreenToClient(wnd, &cursor_pos);
  ScreenPoint position = {(float)cursor_pos.x, (float)cursor_pos.y};

  PanGestureInput event{panGestureType, eventIntervalTime, eventTimeStamp,
                        position,       ScreenPoint(x, y), mods};

  if (mWindow) {
  mWindow->SendAnAPZEvent(event);
}
}

#endif  // !defined(__MINGW32__) && !defined(__MINGW64__)