desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 - desktop/source/lib/init.cxx | 45 ++++++++++++++++++ include/LibreOfficeKit/LibreOfficeKit.h | 9 +++ include/LibreOfficeKit/LibreOfficeKit.hxx | 16 ++++++ include/vcl/GestureEvent.hxx | 42 +++++++++++++++++ include/vcl/commandevent.hxx | 24 +++++++++ include/vcl/svapp.hxx | 3 + include/vcl/vclevent.hxx | 1 vcl/inc/salwtype.hxx | 14 +++++ vcl/inc/window.h | 1 vcl/source/app/svapp.cxx | 68 +++++++++++++++++++++++++--- vcl/source/control/imp_listbox.cxx | 4 + vcl/source/window/commandevent.cxx | 9 +++ vcl/source/window/window.cxx | 1 vcl/source/window/window2.cxx | 20 ++++++++ vcl/source/window/winproc.cxx | 44 ++++++++++++++++++ 16 files changed, 296 insertions(+), 8 deletions(-)
New commits: commit e2817afbfff5039e3c2f40c250cf2a7a02accc5c Author: Tor Lillqvist <[email protected]> AuthorDate: Tue Mar 26 17:51:37 2019 +0200 Commit: Michael Meeks <[email protected]> CommitDate: Fri Aug 2 15:36:52 2019 -0400 Make contents of combobox follow the finger when scrolling with a pan gesture It is the contents that we are dragging with the gesture, not the scrollbar "thumb". The DoScroll() call takes as argument how much the "thumb" should be moved, though. Change-Id: Id95a4bf9d2bb4e950dd85c6bebb4d2b5f2726ee0 diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index eb631d3edc8c..74e84ba381fa 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -765,7 +765,7 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, else if(pData->meEventType == GestureEventType::PanningUpdate) { long nOriginalPosition = mpWindowImpl->mpFrameData->mnTouchPanPosition; - pVScrl->DoScroll(nOriginalPosition + (pData->mfOffset)); + pVScrl->DoScroll(nOriginalPosition + (pData->mfOffset / pVScrl->GetVisibleSize())); } if (pData->meEventType == GestureEventType::PanningEnd) { commit 690a6924ab6173547218151d7b9094154aaeea2a Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Mar 25 18:23:36 2019 +0900 Commit: Michael Meeks <[email protected]> CommitDate: Fri Aug 2 15:36:09 2019 -0400 tdf#124146 support posting of gesture event for LOKit Change-Id: I51845f2e41dbcbe1ae6cb0a18cf9f42d5549968b Reviewed-on: https://gerrit.libreoffice.org/69657 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 5e71f5771835..2b1c6ae96af6 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2454,9 +2454,10 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(44), offsetof(struct _LibreOfficeKitDocumentClass, addCertificate)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(45), offsetof(struct _LibreOfficeKitDocumentClass, getSignatureState)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent)); // Extending is fine, update this, and add new assert for the offsetof the // new method - CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7dd7fe6644e1..afceb472a8e6 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -101,6 +101,7 @@ #include <svx/svxids.hrc> #include <svx/ucsubset.hxx> #include <vcl/vclevent.hxx> +#include <vcl/GestureEvent.hxx> #include <vcl/svapp.hxx> #include <unotools/resmgr.hxx> #include <tools/fract.hxx> @@ -648,6 +649,12 @@ static void doc_postWindowMouseEvent (LibreOfficeKitDocument* pThis, int nCount, int nButtons, int nModifier); +static void doc_postWindowGestureEvent(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + const char* pType, + int nX, + int nY, + int nOffset); static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, @@ -783,6 +790,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->getSignatureState = doc_getSignatureState; m_pDocumentClass->renderShapeSelection = doc_renderShapeSelection; + m_pDocumentClass->postWindowGestureEvent = doc_postWindowGestureEvent; gDocumentClass = m_pDocumentClass; } @@ -2777,6 +2785,43 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned } } +static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, const char* pType, int nX, int nY, int nOffset) +{ + SolarMutexGuard aGuard; + if (gImpl) + gImpl->maLastExceptionMsg.clear(); + + VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); + if (!pWindow) + { + gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found."; + return; + } + + OString aType(pType); + GestureEventType eEventType = GestureEventType::PanningUpdate; + + if (aType == "panBegin") + eEventType = GestureEventType::PanningBegin; + else if (aType == "panEnd") + eEventType = GestureEventType::PanningEnd; + + GestureEvent aEvent { + sal_Int32(nX), + sal_Int32(nY), + eEventType, + sal_Int32(nOffset), + PanningOrientation::Vertical, + }; + + if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get())) + { + pDialog->EnableInput(); + } + + Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, &aEvent); +} + static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) { SolarMutexGuard aGuard; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 4dd23a2cbc7a..dcaf4583b27e 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -346,10 +346,19 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::getSignatureState(). int (*getSignatureState) (LibreOfficeKitDocument* pThis); +// END CERTIFICATE AND SIGNING /// @see lok::Document::renderShapeSelection size_t (*renderShapeSelection)(LibreOfficeKitDocument* pThis, char** pOutput); + /// @see lok::Document::postWindowGestureEvent(). + void (*postWindowGestureEvent) (LibreOfficeKitDocument* pThis, + unsigned nWindowId, + const char* pType, + int nX, + int nY, + int nOffset); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 5d7771cf80b0..2266fc80e7c5 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -629,6 +629,22 @@ public: return mpDoc->pClass->renderShapeSelection(mpDoc, pOutput); } + /** + * Posts a gesture event to the window with given id. + * + * @param nWindowId + * @param pType Event type, like panStart, panEnd, panUpdate. + * @param nX horizontal position in document coordinates + * @param nY vertical position in document coordinates + * @param nOffset difference value from when the gesture started to current value + */ + void postWindowGestureEvent(unsigned nWindowId, + const char* pType, + int nX, int nY, int nOffset) + { + return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset); + } + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; commit 21e89df8ac7044de42ccbe93488480e9ac289eec Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Mar 25 18:10:26 2019 +0900 Commit: Michael Meeks <[email protected]> CommitDate: Fri Aug 2 15:36:01 2019 -0400 tdf#124146 Support panning (pan gesture) of the combobox list Change-Id: Ic57f4b784d96e69c71caa0e47dbe8117b019a712 Reviewed-on: https://gerrit.libreoffice.org/69656 Reviewed-by: Tomaž Vajngerl <[email protected]> Tested-by: Tomaž Vajngerl <[email protected]> diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 452a88e6f9f5..1f61f2b1d4a7 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -159,6 +159,7 @@ struct ImplFrameData bool mbInSysObjFocusHdl; //< within a SysChildren's GetFocus handler bool mbInSysObjToTopHdl; //< within a SysChildren's ToTop handler bool mbSysObjFocus; //< does a SysChild have focus + sal_Int32 mnTouchPanPosition; css::uno::Reference< css::datatransfer::dnd::XDragSource > mxDragSource; css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget; diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 41750ae91eca..4aa9b820ccb4 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -2506,6 +2506,10 @@ bool ImplListBox::EventNotify( NotifyEvent& rNEvt ) bDone = HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar ); } } + else if (rCEvt.GetCommand() == CommandEventId::Gesture) + { + bDone = HandleScrollCommand(rCEvt, mpHScrollBar, mpVScrollBar); + } } return bDone || Window::EventNotify( rNEvt ); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 8df50b57da1f..1a4257760118 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -810,6 +810,7 @@ ImplFrameData::ImplFrameData( vcl::Window *pWindow ) mbInBufferedPaint = false; mnDPIX = 96; mnDPIY = 96; + mnTouchPanPosition = -1; } namespace vcl { diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 922b4b4ab161..eb631d3edc8c 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -755,6 +755,26 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd, } break; + case CommandEventId::Gesture: + { + const CommandGestureData* pData = rCmd.GetGestureData(); + if (pData->meEventType == GestureEventType::PanningBegin) + { + mpWindowImpl->mpFrameData->mnTouchPanPosition = pVScrl->GetThumbPos(); + } + else if(pData->meEventType == GestureEventType::PanningUpdate) + { + long nOriginalPosition = mpWindowImpl->mpFrameData->mnTouchPanPosition; + pVScrl->DoScroll(nOriginalPosition + (pData->mfOffset)); + } + if (pData->meEventType == GestureEventType::PanningEnd) + { + mpWindowImpl->mpFrameData->mnTouchPanPosition = -1; + } + bRet = true; + } + break; + case CommandEventId::AutoScroll: { const CommandScrollData* pData = rCmd.GetAutoScrollData(); commit 0373ff970783ed9e4b9950d0199d98e1f7cfa3c5 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Mon Mar 25 18:05:35 2019 +0900 Commit: Michael Meeks <[email protected]> CommitDate: Fri Aug 2 15:35:51 2019 -0400 tdf#124146 add (general) gesture event support to VCL Change-Id: I766930bb35071442e132b91477cd3d55e8f00f48 Reviewed-on: https://gerrit.libreoffice.org/69655 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <[email protected]> diff --git a/include/vcl/GestureEvent.hxx b/include/vcl/GestureEvent.hxx new file mode 100644 index 000000000000..2070fc76d39a --- /dev/null +++ b/include/vcl/GestureEvent.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * 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/. + * + */ + +#ifndef INCLUDED_VCL_GESTUREEVENT_HXX +#define INCLUDED_VCL_GESTUREEVENT_HXX + +#include <vcl/dllapi.h> + +enum class GestureEventType +{ + PanningBegin, + PanningUpdate, + PanningEnd +}; + +enum class PanningOrientation +{ + Horizontal, + Vertical +}; + +class VCL_DLLPUBLIC GestureEvent +{ +public: + sal_Int32 mnX; + sal_Int32 mnY; + GestureEventType meEventType; + + sal_Int32 mnOffset; + PanningOrientation meOrientation; +}; + +#endif // INCLUDED_VCL_GESTUREEVENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx index 88185efde077..a3ee2fb73c99 100644 --- a/include/vcl/commandevent.hxx +++ b/include/vcl/commandevent.hxx @@ -27,6 +27,7 @@ #include <vcl/keycodes.hxx> #include <o3tl/typed_flags_set.hxx> #include <rtl/ustring.hxx> +#include <vcl/GestureEvent.hxx> class CommandExtTextInputData; class CommandWheelData; @@ -37,6 +38,8 @@ class CommandMediaData; class CommandSelectionChangeData; class CommandSwipeData; class CommandLongPressData; +class CommandGestureData; + enum class CommandEventId; enum class ExtTextInputAttr { @@ -86,6 +89,7 @@ public: const CommandSelectionChangeData* GetSelectionChangeData() const; const CommandSwipeData* GetSwipeData() const; const CommandLongPressData* GetLongPressData() const; + const CommandGestureData* GetGestureData() const; }; class VCL_DLLPUBLIC CommandExtTextInputData @@ -300,6 +304,25 @@ public: double getY() const { return mnY; } }; +class VCL_DLLPUBLIC CommandGestureData +{ +public: + double const mfX; + double const mfY; + GestureEventType const meEventType; + + double const mfOffset; + PanningOrientation const meOrientation; + + CommandGestureData(double fX, double fY, GestureEventType eEventType, double fOffset, PanningOrientation eOrientation) + : mfX(fX) + , mfY(fY) + , meEventType(eEventType) + , mfOffset(fOffset) + , meOrientation(eOrientation) + {} +}; + enum class CommandEventId { NONE = 0, @@ -323,6 +346,7 @@ enum class CommandEventId QueryCharPosition = 20, Swipe = 21, LongPress = 22, + Gesture = 23, }; #endif // INCLUDED_VCL_COMMANDEVENT_HXX diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 664f8ba8d56a..dce6af76262f 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -68,6 +68,7 @@ class Reflection; class NotifyEvent; class KeyEvent; class MouseEvent; +class GestureEvent; struct ImplSVEvent; struct ConvertData; @@ -756,6 +757,8 @@ public: */ static ImplSVEvent * PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent ); + static ImplSVEvent* PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, GestureEvent const * pGestureEvent); + /** Remove mouse and keypress events from a window... any also zoom and scroll events if the platform supports it. diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx index 698fd038bbde..575320f7639d 100644 --- a/include/vcl/vclevent.hxx +++ b/include/vcl/vclevent.hxx @@ -174,6 +174,7 @@ enum class VclEventId WindowShow, WindowStartDocking, // pData = DockingData WindowToggleFloating, + WindowGestureEvent, }; class VCL_DLLPUBLIC VclSimpleEvent diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 342f18d3ec85..ac28793aa339 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -24,6 +24,7 @@ #include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <tools/solar.h> +#include <vcl/GestureEvent.hxx> class LogicalFontInstance; class SalGraphics; @@ -82,7 +83,9 @@ enum class SalEvent { StartReconversion, QueryCharPosition, Swipe, - LongPress + LongPress, + ExternalGesture, + Gesture, }; // MOUSELEAVE must send, when the pointer leave the client area and @@ -256,6 +259,15 @@ struct SalLongPressEvent long mnY; }; +struct SalGestureEvent +{ + GestureEventType meEventType; + PanningOrientation meOrientation; + double mfOffset; + long mnX; + long mnY; +}; + typedef void (*SALTIMERPROC)(); #endif // INCLUDED_VCL_INC_SALWTYPE_HXX diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 626214690166..e85f28d2f1ae 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -131,11 +131,26 @@ struct ImplPostEventData ImplSVEvent * mnEventId; KeyEvent maKeyEvent; MouseEvent maMouseEvent; - - ImplPostEventData( VclEventId nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent ) : - mnEvent( nEvent ), mpWin( pWin ), mnEventId( nullptr ), maKeyEvent( rKeyEvent ) {} - ImplPostEventData( VclEventId nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent ) : - mnEvent( nEvent ), mpWin( pWin ), mnEventId( nullptr ), maMouseEvent( rMouseEvent ) {} + GestureEvent maGestureEvent; + + ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const KeyEvent& rKeyEvent) + : mnEvent(nEvent) + , mpWin(pWin) + , mnEventId(nullptr) + , maKeyEvent(rKeyEvent) + {} + ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const MouseEvent& rMouseEvent) + : mnEvent(nEvent) + , mpWin(pWin) + , mnEventId(nullptr) + , maMouseEvent(rMouseEvent) + {} + ImplPostEventData(VclEventId nEvent, vcl::Window* pWin, const GestureEvent& rGestureEvent) + : mnEvent(nEvent) + , mpWin(pWin) + , mnEventId(nullptr) + , maGestureEvent(rGestureEvent) + {} }; Application* GetpApp() @@ -829,7 +844,43 @@ ImplSVEvent * Application::PostKeyEvent( VclEventId nEvent, vcl::Window *pWin, K return nEventId; } -ImplSVEvent * Application::PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent ) +ImplSVEvent* Application::PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, GestureEvent const * pGestureEvent) +{ + const SolarMutexGuard aGuard; + ImplSVEvent * nEventId = nullptr; + + if (pWin && pGestureEvent) + { + Point aTransformedPosition(pGestureEvent->mnX, pGestureEvent->mnY); + + aTransformedPosition.AdjustX(pWin->GetOutOffXPixel()); + aTransformedPosition.AdjustY(pWin->GetOutOffYPixel()); + + const GestureEvent aGestureEvent{ + sal_Int32(aTransformedPosition.X()), + sal_Int32(aTransformedPosition.Y()), + pGestureEvent->meEventType, + pGestureEvent->mnOffset, + pGestureEvent->meOrientation + }; + + std::unique_ptr<ImplPostEventData> pPostEventData(new ImplPostEventData(nEvent, pWin, aGestureEvent)); + + nEventId = PostUserEvent( + LINK( nullptr, Application, PostEventHandler ), + pPostEventData.get()); + + if (nEventId) + { + pPostEventData->mnEventId = nEventId; + ImplGetSVData()->maAppData.maPostedEventList.emplace_back(pWin, pPostEventData.release()); + } + } + + return nEventId; +} + +ImplSVEvent* Application::PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, MouseEvent const * pMouseEvent ) { const SolarMutexGuard aGuard; ImplSVEvent * nEventId = nullptr; @@ -898,6 +949,11 @@ IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData, void ) pEventData = &pData->maKeyEvent; break; + case VclEventId::WindowGestureEvent: + nEvent = SalEvent::ExternalGesture; + pEventData = &pData->maGestureEvent; + break; + default: nEvent = SalEvent::NONE; pEventData = nullptr; diff --git a/vcl/source/window/commandevent.cxx b/vcl/source/window/commandevent.cxx index c8b486e7fc59..06e974c9fc6a 100644 --- a/vcl/source/window/commandevent.cxx +++ b/vcl/source/window/commandevent.cxx @@ -186,4 +186,13 @@ const CommandLongPressData* CommandEvent::GetLongPressData() const return nullptr; } +const CommandGestureData* CommandEvent::GetGestureData() const +{ + if (mnCommand == CommandEventId::Gesture) + return static_cast<const CommandGestureData*>(mpData); + else + return nullptr; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 7a54ea209268..3f127e0afd08 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -28,6 +28,7 @@ #include <vcl/unohelp.hxx> #include <vcl/timer.hxx> #include <vcl/event.hxx> +#include <vcl/GestureEvent.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/cursor.hxx> @@ -1550,6 +1551,30 @@ static bool ImplHandleLongPress(vcl::Window *pWindow, const SalLongPressEvent& r return aHandler.HandleEvent(); } +class HandleGeneralGestureEvent : public HandleGestureEvent +{ +private: + CommandGestureData m_aGestureData; + +public: + HandleGeneralGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent) + : HandleGestureEvent(pWindow, Point(rEvent.mnX, rEvent.mnY)) + , m_aGestureData(rEvent.mnX, rEvent.mnY, rEvent.meEventType, rEvent.mfOffset, rEvent.meOrientation) + { + } + + virtual bool CallCommand(vcl::Window* pWindow, const Point& /*rMousePos*/) override + { + return ImplCallCommand(pWindow, CommandEventId::Gesture, &m_aGestureData); + } +}; + +static bool ImplHandleGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent) +{ + HandleGeneralGestureEvent aHandler(pWindow, rEvent); + return aHandler.HandleEvent(); +} + static void ImplHandlePaint( vcl::Window* pWindow, const tools::Rectangle& rBoundRect, bool bImmediateUpdate ) { // system paint events must be checked for re-mirroring @@ -2537,7 +2562,26 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pE bRet = ImplHandleLongPress(pWindow, *static_cast<const SalLongPressEvent*>(pEvent)); break; + case SalEvent::ExternalGesture: + { + auto const * pGestureEvent = static_cast<GestureEvent const *>(pEvent); + + SalGestureEvent aSalGestureEvent; + aSalGestureEvent.mfOffset = pGestureEvent->mnOffset; + aSalGestureEvent.mnX = pGestureEvent->mnX; + aSalGestureEvent.mnY = pGestureEvent->mnY; + aSalGestureEvent.meEventType = pGestureEvent->meEventType; + aSalGestureEvent.meOrientation = pGestureEvent->meOrientation; + bRet = ImplHandleGestureEvent(pWindow, aSalGestureEvent); + } + break; + case SalEvent::Gesture: + { + auto const * aSalGestureEvent = static_cast<SalGestureEvent const *>(pEvent); + bRet = ImplHandleGestureEvent(pWindow, *aSalGestureEvent); + } + break; default: SAL_WARN( "vcl.layout", "ImplWindowFrameProc(): unknown event (" << static_cast<int>(nEvent) << ")" ); break; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
