예제 #1
0
// defined in nsWindowBase, called from shared module WinMouseScrollHandler.
bool
MetroWidget::DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent)
{
  WidgetGUIEvent* newEvent = nullptr;
  switch(aEvent->eventStructType) {
    case NS_WHEEL_EVENT:
    {
      WidgetWheelEvent* oldEvent = aEvent->AsWheelEvent();
      WidgetWheelEvent* wheelEvent =
        new WidgetWheelEvent(oldEvent->mFlags.mIsTrusted, oldEvent->message, oldEvent->widget);
      wheelEvent->AssignWheelEventData(*oldEvent, true);
      newEvent = static_cast<WidgetGUIEvent*>(wheelEvent);
    }
    break;
    case NS_CONTENT_COMMAND_EVENT:
    {
      WidgetContentCommandEvent* oldEvent = aEvent->AsContentCommandEvent();
      WidgetContentCommandEvent* cmdEvent =
        new WidgetContentCommandEvent(oldEvent->mFlags.mIsTrusted, oldEvent->message, oldEvent->widget);
      cmdEvent->AssignContentCommandEventData(*oldEvent, true);
      newEvent = static_cast<WidgetGUIEvent*>(cmdEvent);
    }
    break;
    default:
      MOZ_CRASH("unknown event in DispatchScrollEvent");
    break;
  }
  mEventQueue.Push(newEvent);
  nsCOMPtr<nsIRunnable> runnable =
    NS_NewRunnableMethod(this, &MetroWidget::DeliverNextScrollEvent);
  NS_DispatchToCurrentThread(runnable);
  return false;
}
예제 #2
0
void
APZEventState::ProcessWheelEvent(const WidgetWheelEvent& aEvent,
                                 const ScrollableLayerGuid& aGuid,
                                 uint64_t aInputBlockId)
{
  // If this event starts a swipe, indicate that it shouldn't result in a
  // scroll by setting defaultPrevented to true.
  bool defaultPrevented = aEvent.DefaultPrevented() || aEvent.TriggersSwipe();
  mContentReceivedInputBlockCallback(aGuid, aInputBlockId, defaultPrevented);
}
예제 #3
0
// defined in nsWindowBase, called from shared module WinMouseScrollHandler.
bool
MetroWidget::DispatchWheelEvent(mozilla::WidgetWheelEvent* aEvent)
{
  WidgetWheelEvent* wheelEvent =
    new WidgetWheelEvent(aEvent->mFlags.mIsTrusted, aEvent->message, aEvent->widget);
  wheelEvent->AssignWheelEventData(*aEvent, true);
  mEventQueue.Push(wheelEvent);
  nsCOMPtr<nsIRunnable> runnable =
    NS_NewRunnableMethod(this, &MetroWidget::DeliverNextScrollEvent);
  NS_DispatchToCurrentThread(runnable);
  return false;
}