mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 822898 - Implement pointer events. Interface. r=smaug
This commit is contained in:
parent
68d38376ad
commit
8428edd05d
@ -1758,6 +1758,18 @@ GK_ATOM(onMozEdgeUIStarted, "onMozEdgeUIStarted")
|
||||
GK_ATOM(onMozEdgeUICanceled, "onMozEdgeUICanceled")
|
||||
GK_ATOM(onMozEdgeUICompleted, "onMozEdgeUICompleted")
|
||||
|
||||
// Pointer events
|
||||
GK_ATOM(onpointerdown, "onpointerdown")
|
||||
GK_ATOM(onpointermove, "onpointermove")
|
||||
GK_ATOM(onpointerup, "onpointerup")
|
||||
GK_ATOM(onpointercancel, "onpointercancel")
|
||||
GK_ATOM(onpointerover, "onpointerover")
|
||||
GK_ATOM(onpointerout, "onpointerout")
|
||||
GK_ATOM(onpointerenter, "onpointerenter")
|
||||
GK_ATOM(onpointerleave, "onpointerleave")
|
||||
GK_ATOM(ongotpointercapture, "ongotpointercapture")
|
||||
GK_ATOM(onlostpointercapture, "onlostpointercapture")
|
||||
|
||||
// orientation support
|
||||
GK_ATOM(ondevicemotion, "ondevicemotion")
|
||||
GK_ATOM(ondeviceorientation, "ondeviceorientation")
|
||||
|
@ -293,6 +293,48 @@ EVENT(mozpointerlockerror,
|
||||
NS_POINTERLOCKERROR,
|
||||
EventNameType_HTML,
|
||||
NS_EVENT)
|
||||
|
||||
EVENT(pointerdown,
|
||||
NS_POINTER_DOWN,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointermove,
|
||||
NS_POINTER_MOVE,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointerup,
|
||||
NS_POINTER_UP,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointercancel,
|
||||
NS_POINTER_CANCEL,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointerover,
|
||||
NS_POINTER_OVER,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointerout,
|
||||
NS_POINTER_OUT,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointerenter,
|
||||
NS_POINTER_ENTER,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(pointerleave,
|
||||
NS_POINTER_LEAVE,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(gotpointercapture,
|
||||
NS_POINTER_GOT_CAPTURE,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
EVENT(lostpointercapture,
|
||||
NS_POINTER_LOST_CAPTURE,
|
||||
EventNameType_All,
|
||||
NS_POINTER_EVENT)
|
||||
|
||||
// Not supported yet; probably never because "wheel" is a better idea.
|
||||
// EVENT(mousewheel)
|
||||
EVENT(pause,
|
||||
|
150
content/events/src/PointerEvent.cpp
Normal file
150
content/events/src/PointerEvent.cpp
Normal file
@ -0,0 +1,150 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* Portions Copyright 2013 Microsoft Open Technologies, Inc. */
|
||||
|
||||
#include "PointerEvent.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "prtime.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
PointerEvent::PointerEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetPointerEvent* aEvent)
|
||||
: nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_POINTER_EVENT, "event type mismatch NS_POINTER_EVENT");
|
||||
|
||||
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
} else {
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
ConvertStringToPointerType(const nsAString& aPointerTypeArg)
|
||||
{
|
||||
if (aPointerTypeArg.EqualsLiteral("mouse")) {
|
||||
return nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
|
||||
}
|
||||
if (aPointerTypeArg.EqualsLiteral("pen")) {
|
||||
return nsIDOMMouseEvent::MOZ_SOURCE_PEN;
|
||||
}
|
||||
if (aPointerTypeArg.EqualsLiteral("touch")) {
|
||||
return nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
|
||||
}
|
||||
|
||||
return nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
|
||||
//static
|
||||
already_AddRefed<PointerEvent>
|
||||
PointerEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::PointerEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<PointerEvent> e = new PointerEvent(t, nullptr, nullptr);
|
||||
bool trusted = e->Init(t);
|
||||
|
||||
aRv = e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
|
||||
aParam.mView, aParam.mDetail, aParam.mScreenX,
|
||||
aParam.mScreenY, aParam.mClientX, aParam.mClientY,
|
||||
aParam.mCtrlKey, aParam.mAltKey, aParam.mShiftKey,
|
||||
aParam.mMetaKey, aParam.mButton, aParam.mRelatedTarget);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WidgetPointerEvent* widgetEvent = e->mEvent->AsPointerEvent();
|
||||
widgetEvent->pointerId = aParam.mPointerId;
|
||||
widgetEvent->width = aParam.mWidth;
|
||||
widgetEvent->height = aParam.mHeight;
|
||||
widgetEvent->pressure = aParam.mPressure;
|
||||
widgetEvent->tiltX = aParam.mTiltX;
|
||||
widgetEvent->tiltY = aParam.mTiltY;
|
||||
widgetEvent->inputSource = ConvertStringToPointerType(aParam.mPointerType);
|
||||
widgetEvent->isPrimary = aParam.mIsPrimary;
|
||||
widgetEvent->buttons = aParam.mButtons;
|
||||
|
||||
e->SetTrusted(trusted);
|
||||
return e.forget();
|
||||
}
|
||||
|
||||
void
|
||||
PointerEvent::GetPointerType(nsAString& aPointerType)
|
||||
{
|
||||
switch (mEvent->AsPointerEvent()->inputSource) {
|
||||
case nsIDOMMouseEvent::MOZ_SOURCE_MOUSE:
|
||||
aPointerType.AssignLiteral("mouse");
|
||||
break;
|
||||
case nsIDOMMouseEvent::MOZ_SOURCE_PEN:
|
||||
aPointerType.AssignLiteral("pen");
|
||||
break;
|
||||
case nsIDOMMouseEvent::MOZ_SOURCE_TOUCH:
|
||||
aPointerType.AssignLiteral("touch");
|
||||
break;
|
||||
case nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN:
|
||||
aPointerType.AssignLiteral("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t PointerEvent::PointerId()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->pointerId;
|
||||
}
|
||||
|
||||
int32_t PointerEvent::Width()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->width;
|
||||
}
|
||||
|
||||
int32_t PointerEvent::Height()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->height;
|
||||
}
|
||||
|
||||
int32_t PointerEvent::Pressure()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->pressure;
|
||||
}
|
||||
|
||||
int32_t PointerEvent::TiltX()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->tiltX;
|
||||
}
|
||||
|
||||
int32_t PointerEvent::TiltY()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->tiltY;
|
||||
}
|
||||
|
||||
bool PointerEvent::IsPrimary()
|
||||
{
|
||||
return mEvent->AsPointerEvent()->isPrimary;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsresult NS_NewDOMPointerEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetPointerEvent *aEvent)
|
||||
{
|
||||
dom::PointerEvent *it = new dom::PointerEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
50
content/events/src/PointerEvent.h
Normal file
50
content/events/src/PointerEvent.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* Portions Copyright 2013 Microsoft Open Technologies, Inc. */
|
||||
|
||||
#ifndef PointerEvent_h__
|
||||
#define PointerEvent_h__
|
||||
|
||||
#include "nsDOMMouseEvent.h"
|
||||
#include "mozilla/dom/PointerEventBinding.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class PointerEvent : public nsDOMMouseEvent
|
||||
{
|
||||
public:
|
||||
PointerEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetPointerEvent* aEvent);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::PointerEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
static already_AddRefed<PointerEvent>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const PointerEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
int32_t PointerId();
|
||||
int32_t Width();
|
||||
int32_t Height();
|
||||
int32_t Pressure();
|
||||
int32_t TiltX();
|
||||
int32_t TiltY();
|
||||
bool IsPrimary();
|
||||
void GetPointerType(nsAString& aPointerType);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -14,6 +14,7 @@ EXPORTS += [
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'PointerEvent.h',
|
||||
'Touch.h',
|
||||
]
|
||||
|
||||
@ -57,6 +58,7 @@ UNIFIED_SOURCES += [
|
||||
'nsIMEStateManager.cpp',
|
||||
'nsPaintRequest.cpp',
|
||||
'nsPrivateTextRange.cpp',
|
||||
'PointerEvent.cpp',
|
||||
'TextComposition.cpp',
|
||||
'Touch.cpp',
|
||||
]
|
||||
|
@ -739,6 +739,9 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
return NS_NewDOMSimpleGestureEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsSimpleGestureEvent());
|
||||
case NS_POINTER_EVENT:
|
||||
return NS_NewDOMPointerEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsPointerEvent());
|
||||
case NS_TOUCH_EVENT:
|
||||
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsTouchEvent());
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "jspubtd.h"
|
||||
%}
|
||||
|
||||
[scriptable, uuid(22df6ed6-d094-4e45-97fc-a8eca11c390c)]
|
||||
[scriptable, uuid(6c1fcf3d-119b-4cf4-9437-b9357508976a)]
|
||||
interface nsIInlineEventHandlers : nsISupports
|
||||
{
|
||||
[implicit_jscontext] attribute jsval onabort;
|
||||
@ -71,6 +71,17 @@ interface nsIInlineEventHandlers : nsISupports
|
||||
[implicit_jscontext] attribute jsval onwaiting;
|
||||
[implicit_jscontext] attribute jsval onwheel;
|
||||
|
||||
[implicit_jscontext] attribute jsval onpointerdown;
|
||||
[implicit_jscontext] attribute jsval onpointermove;
|
||||
[implicit_jscontext] attribute jsval onpointerout;
|
||||
[implicit_jscontext] attribute jsval onpointerover;
|
||||
[implicit_jscontext] attribute jsval onpointerup;
|
||||
[implicit_jscontext] attribute jsval onpointerenter;
|
||||
[implicit_jscontext] attribute jsval onpointerleave;
|
||||
[implicit_jscontext] attribute jsval ongotpointercapture;
|
||||
[implicit_jscontext] attribute jsval onlostpointercapture;
|
||||
[implicit_jscontext] attribute jsval onpointercancel;
|
||||
|
||||
/**
|
||||
* Non-HTML5 event attributes
|
||||
*/
|
||||
|
@ -372,6 +372,11 @@ NS_NewDOMAnimationEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::InternalAnimationEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMPointerEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetPointerEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
|
@ -88,6 +88,22 @@ interface GlobalEventHandlers {
|
||||
attribute EventHandler onvolumechange;
|
||||
attribute EventHandler onwaiting;
|
||||
|
||||
// Pointer events handlers
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerdown;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerup;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointermove;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerout;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerover;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerenter;
|
||||
[Pref="dom.w3c_pointer_events.enabled"]
|
||||
attribute EventHandler onpointerleave;
|
||||
|
||||
// Mozilla-specific handlers
|
||||
attribute EventHandler onmozfullscreenchange;
|
||||
attribute EventHandler onmozfullscreenerror;
|
||||
|
37
dom/webidl/PointerEvent.webidl
Normal file
37
dom/webidl/PointerEvent.webidl
Normal file
@ -0,0 +1,37 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* For more information see nsIPointerEvent.idl.
|
||||
*
|
||||
* Portions Copyright 2013 Microsoft Open Technologies, Inc. */
|
||||
|
||||
interface WindowProxy;
|
||||
|
||||
[Pref="dom.w3c_pointer_events.enabled",
|
||||
Constructor(DOMString type, optional PointerEventInit eventInitDict)]
|
||||
interface PointerEvent : MouseEvent
|
||||
{
|
||||
readonly attribute long pointerId;
|
||||
readonly attribute long width;
|
||||
readonly attribute long height;
|
||||
readonly attribute float pressure;
|
||||
readonly attribute long tiltX;
|
||||
readonly attribute long tiltY;
|
||||
readonly attribute DOMString pointerType;
|
||||
readonly attribute boolean isPrimary;
|
||||
};
|
||||
|
||||
dictionary PointerEventInit : MouseEventInit
|
||||
{
|
||||
long pointerId = 0;
|
||||
long width = 0;
|
||||
long height = 0;
|
||||
float pressure = 0;
|
||||
long tiltX = 0;
|
||||
long tiltY = 0;
|
||||
DOMString pointerType = "";
|
||||
boolean isPrimary = false;
|
||||
};
|
||||
|
@ -254,6 +254,7 @@ WEBIDL_FILES = [
|
||||
'PhoneNumberService.webidl',
|
||||
'Plugin.webidl',
|
||||
'PluginArray.webidl',
|
||||
'PointerEvent.webidl',
|
||||
'Position.webidl',
|
||||
'PositionError.webidl',
|
||||
'ProcessingInstruction.webidl',
|
||||
|
@ -4385,6 +4385,9 @@ pref("dom.mozPermissionSettings.enabled", false);
|
||||
pref("dom.w3c_touch_events.enabled", 2);
|
||||
#endif
|
||||
|
||||
// W3C draft pointer events
|
||||
pref("dom.w3c_pointer_events.enabled", false);
|
||||
|
||||
// enable JS dump() function.
|
||||
pref("browser.dom.window.dump.enabled", false);
|
||||
|
||||
|
@ -41,6 +41,7 @@ enum nsEventStructType
|
||||
NS_DRAG_EVENT, // WidgetDragEvent
|
||||
NS_MOUSE_SCROLL_EVENT, // WidgetMouseScrollEvent
|
||||
NS_WHEEL_EVENT, // WidgetWheelEvent
|
||||
NS_POINTER_EVENT, // PointerEvent
|
||||
|
||||
// TouchEvents.h
|
||||
NS_GESTURENOTIFY_EVENT, // WidgetGestureNotifyEvent
|
||||
@ -135,6 +136,19 @@ enum nsEventStructType
|
||||
#define NS_MOUSEENTER (NS_MOUSE_MESSAGE_START + 34)
|
||||
#define NS_MOUSELEAVE (NS_MOUSE_MESSAGE_START + 35)
|
||||
|
||||
// Pointer spec events
|
||||
#define NS_POINTER_EVENT_START 4400
|
||||
#define NS_POINTER_MOVE (NS_POINTER_EVENT_START)
|
||||
#define NS_POINTER_UP (NS_POINTER_EVENT_START + 1)
|
||||
#define NS_POINTER_DOWN (NS_POINTER_EVENT_START + 2)
|
||||
#define NS_POINTER_OVER (NS_POINTER_EVENT_START + 22)
|
||||
#define NS_POINTER_OUT (NS_POINTER_EVENT_START + 23)
|
||||
#define NS_POINTER_ENTER (NS_POINTER_EVENT_START + 24)
|
||||
#define NS_POINTER_LEAVE (NS_POINTER_EVENT_START + 25)
|
||||
#define NS_POINTER_CANCEL (NS_POINTER_EVENT_START + 26)
|
||||
#define NS_POINTER_GOT_CAPTURE (NS_POINTER_EVENT_START + 27)
|
||||
#define NS_POINTER_LOST_CAPTURE (NS_POINTER_EVENT_START + 28)
|
||||
|
||||
#define NS_CONTEXTMENU_MESSAGE_START 500
|
||||
#define NS_CONTEXTMENU (NS_CONTEXTMENU_MESSAGE_START)
|
||||
|
||||
|
@ -33,6 +33,7 @@ NS_EVENT_CLASS(Widget, MouseEvent)
|
||||
NS_EVENT_CLASS(Widget, DragEvent)
|
||||
NS_EVENT_CLASS(Widget, MouseScrollEvent)
|
||||
NS_EVENT_CLASS(Widget, WheelEvent)
|
||||
NS_EVENT_CLASS(Widget, PointerEvent)
|
||||
|
||||
// TouchEvents.h
|
||||
NS_EVENT_CLASS(Widget, GestureNotifyEvent)
|
||||
|
@ -456,6 +456,67 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::WidgetPointerEvent
|
||||
******************************************************************************/
|
||||
|
||||
class WidgetPointerEvent : public WidgetMouseEvent
|
||||
{
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
WidgetPointerEvent()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual WidgetPointerEvent* AsPointerEvent() MOZ_OVERRIDE { return this; }
|
||||
|
||||
WidgetPointerEvent(bool aIsTrusted, uint32_t aMsg, nsIWidget* w)
|
||||
: WidgetMouseEvent(aIsTrusted, aMsg, w, NS_POINTER_EVENT, eReal)
|
||||
, pointerId(0)
|
||||
, width(0)
|
||||
, height(0)
|
||||
, tiltX(0)
|
||||
, tiltY(0)
|
||||
, isPrimary(true)
|
||||
{
|
||||
}
|
||||
|
||||
WidgetPointerEvent(const WidgetMouseEvent& aEvent)
|
||||
: WidgetMouseEvent(aEvent)
|
||||
, pointerId(0)
|
||||
, width(0)
|
||||
, height(0)
|
||||
, tiltX(0)
|
||||
, tiltY(0)
|
||||
, isPrimary(true)
|
||||
{
|
||||
eventStructType = NS_POINTER_EVENT;
|
||||
}
|
||||
|
||||
WidgetPointerEvent(bool aIsTrusted, uint32_t aMsg, nsIWidget* w,
|
||||
uint32_t aPointerId,
|
||||
uint32_t aWidth, uint32_t aHeight,
|
||||
uint32_t aTiltX, uint32_t aTiltY, bool aIsPrimary)
|
||||
: WidgetMouseEvent(aIsTrusted, aMsg, w, NS_POINTER_EVENT, eReal)
|
||||
, pointerId(aPointerId)
|
||||
, width(aWidth)
|
||||
, height(aHeight)
|
||||
, tiltX(aTiltX)
|
||||
, tiltY(aTiltY)
|
||||
, isPrimary(aIsPrimary)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t pointerId;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t tiltX;
|
||||
uint32_t tiltY;
|
||||
bool isPrimary;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_MouseEvents_h__
|
||||
|
@ -206,6 +206,36 @@ struct ParamTraits<mozilla::WidgetMouseEvent>
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::WidgetPointerEvent>
|
||||
{
|
||||
typedef mozilla::WidgetPointerEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.pointerId);
|
||||
WriteParam(aMsg, aParam.width);
|
||||
WriteParam(aMsg, aParam.height);
|
||||
WriteParam(aMsg, aParam.tiltX);
|
||||
WriteParam(aMsg, aParam.tiltY);
|
||||
WriteParam(aMsg, aParam.isPrimary);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
bool rv =
|
||||
ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->pointerId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->width) &&
|
||||
ReadParam(aMsg, aIter, &aResult->height) &&
|
||||
ReadParam(aMsg, aIter, &aResult->tiltX) &&
|
||||
ReadParam(aMsg, aIter, &aResult->tiltY) &&
|
||||
ReadParam(aMsg, aIter, &aResult->isPrimary);
|
||||
return rv;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::WidgetTouchEvent>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user