From 8a6f654e95cb25ad167cbc028373245e671db461 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 20:28:00 +0200 Subject: Bug 1299197 Part1: Refine WidgetPointerHelper native in moebius --- widget/MouseEvents.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'widget') diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h index 643132618..f214ec22b 100644 --- a/widget/MouseEvents.h +++ b/widget/MouseEvents.h @@ -43,21 +43,27 @@ namespace dom { class WidgetPointerHelper { public: - bool convertToPointer; uint32_t pointerId; uint32_t tiltX; uint32_t tiltY; + bool convertToPointer; bool retargetedByPointerCapture; - WidgetPointerHelper() : convertToPointer(true), pointerId(0), tiltX(0), tiltY(0), - retargetedByPointerCapture(false) {} + WidgetPointerHelper() + : pointerId(0) + , tiltX(0) + , tiltY(0) + , convertToPointer(true) + , retargetedByPointerCapture(false) + { + } void AssignPointerHelperData(const WidgetPointerHelper& aEvent) { - convertToPointer = aEvent.convertToPointer; pointerId = aEvent.pointerId; tiltX = aEvent.tiltX; tiltY = aEvent.tiltY; + convertToPointer = aEvent.convertToPointer; retargetedByPointerCapture = aEvent.retargetedByPointerCapture; } }; -- cgit v1.2.3 From e43cde864f88cf264dae56ee6201a84091fec5b4 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 20:30:07 +0200 Subject: Bug 1299197 Part2: Serialize WidgetPointerHelper in IPC message native in moebius --- widget/nsGUIEventIPC.h | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'widget') diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h index 7a9d870d9..e06e3784a 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -218,6 +218,30 @@ struct ParamTraits } }; +template<> +struct ParamTraits +{ + typedef mozilla::WidgetPointerHelper paramType; + + static void Write(Message* aMsg, const paramType& aParam) + { + WriteParam(aMsg, aParam.pointerId); + WriteParam(aMsg, aParam.tiltX); + WriteParam(aMsg, aParam.tiltY); + // We don't serialize convertToPointer and retargetedByPointerCapture since + // they are temporarily variable and should be reset to default. + } + + static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) + { + bool rv; + rv = ReadParam(aMsg, aIter, &aResult->pointerId) && + ReadParam(aMsg, aIter, &aResult->tiltX) && + ReadParam(aMsg, aIter, &aResult->tiltY); + return rv; + } +}; + template<> struct ParamTraits { @@ -226,13 +250,13 @@ struct ParamTraits static void Write(Message* aMsg, const paramType& aParam) { WriteParam(aMsg, static_cast(aParam)); + WriteParam(aMsg, static_cast(aParam)); WriteParam(aMsg, aParam.mIgnoreRootScrollFrame); WriteParam(aMsg, static_cast(aParam.mReason)); WriteParam(aMsg, static_cast( aParam.mContextMenuTrigger)); WriteParam(aMsg, static_cast(aParam.mExitFrom)); WriteParam(aMsg, aParam.mClickCount); - WriteParam(aMsg, aParam.pointerId); } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) @@ -243,12 +267,13 @@ struct ParamTraits paramType::ExitFromType exitFrom = 0; rv = ReadParam(aMsg, aIter, static_cast(aResult)) && + ReadParam(aMsg, aIter, + static_cast(aResult)) && ReadParam(aMsg, aIter, &aResult->mIgnoreRootScrollFrame) && ReadParam(aMsg, aIter, &reason) && ReadParam(aMsg, aIter, &contextMenuTrigger) && ReadParam(aMsg, aIter, &exitFrom) && - ReadParam(aMsg, aIter, &aResult->mClickCount) && - ReadParam(aMsg, aIter, &aResult->pointerId); + ReadParam(aMsg, aIter, &aResult->mClickCount); aResult->mReason = static_cast(reason); aResult->mContextMenuTrigger = static_cast(contextMenuTrigger); @@ -290,8 +315,6 @@ struct ParamTraits WriteParam(aMsg, static_cast(aParam)); WriteParam(aMsg, aParam.mWidth); WriteParam(aMsg, aParam.mHeight); - WriteParam(aMsg, aParam.tiltX); - WriteParam(aMsg, aParam.tiltY); WriteParam(aMsg, aParam.mIsPrimary); } @@ -301,8 +324,6 @@ struct ParamTraits ReadParam(aMsg, aIter, static_cast(aResult)) && ReadParam(aMsg, aIter, &aResult->mWidth) && ReadParam(aMsg, aIter, &aResult->mHeight) && - ReadParam(aMsg, aIter, &aResult->tiltX) && - ReadParam(aMsg, aIter, &aResult->tiltY) && ReadParam(aMsg, aIter, &aResult->mIsPrimary); return rv; } -- cgit v1.2.3 From 09f456b2808224e7707e51bfab8957ef067154e4 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 22:18:52 +0200 Subject: moebius#71: DOM - Pointer Events - improvements https://github.com/MoonchildProductions/moebius/pull/71 --- widget/MouseEvents.h | 9 ++++++--- widget/nsGUIEventIPC.h | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'widget') diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h index f214ec22b..442ac41e8 100644 --- a/widget/MouseEvents.h +++ b/widget/MouseEvents.h @@ -46,15 +46,17 @@ public: uint32_t pointerId; uint32_t tiltX; uint32_t tiltY; + uint32_t twist; + float tangentialPressure; bool convertToPointer; - bool retargetedByPointerCapture; WidgetPointerHelper() : pointerId(0) , tiltX(0) , tiltY(0) + , twist(0) + , tangentialPressure(0) , convertToPointer(true) - , retargetedByPointerCapture(false) { } @@ -63,8 +65,9 @@ public: pointerId = aEvent.pointerId; tiltX = aEvent.tiltX; tiltY = aEvent.tiltY; + twist = aEvent.twist; + tangentialPressure = aEvent.tangentialPressure; convertToPointer = aEvent.convertToPointer; - retargetedByPointerCapture = aEvent.retargetedByPointerCapture; } }; diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h index e06e3784a..e45189bb1 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -228,8 +228,10 @@ struct ParamTraits WriteParam(aMsg, aParam.pointerId); WriteParam(aMsg, aParam.tiltX); WriteParam(aMsg, aParam.tiltY); - // We don't serialize convertToPointer and retargetedByPointerCapture since - // they are temporarily variable and should be reset to default. + WriteParam(aMsg, aParam.twist); + WriteParam(aMsg, aParam.tangentialPressure); + // We don't serialize convertToPointer since it's temporarily variable and + // should be reset to default. } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) @@ -237,7 +239,9 @@ struct ParamTraits bool rv; rv = ReadParam(aMsg, aIter, &aResult->pointerId) && ReadParam(aMsg, aIter, &aResult->tiltX) && - ReadParam(aMsg, aIter, &aResult->tiltY); + ReadParam(aMsg, aIter, &aResult->tiltY) && + ReadParam(aMsg, aIter, &aResult->twist) && + ReadParam(aMsg, aIter, &aResult->tangentialPressure); return rv; } }; -- cgit v1.2.3