diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-03-13 17:18:11 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-03-15 09:53:12 +0100 |
commit | 41b22ebcb480e1e4a78e83b7bc211f73ad62ab31 (patch) | |
tree | 3171554b03444ef78e0cf3252abf05f8cc6fd609 /include | |
parent | 7a758da47cdcf4017f41e1e16dc1f643148d2f9b (diff) |
LOK: re-factor async key & mouse event re-posting.
A fairly pure re-factor, although adding disposed window
checking to a number of sites with a warning.
Moves the event emission helpers from VCL into SfxLokHelper: we're
going to need more view / integration here next anyway.
Removes lots of copy/paste horror.
Change-Id: I279c11a1d8093b4feeeb6b7850f500806fff80dd
Reviewed-on: https://gerrit.libreoffice.org/69218
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/69268
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/lokhelper.hxx | 10 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 51 |
2 files changed, 10 insertions, 51 deletions
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 9f68c6d7dd60..5ef2b3f7d182 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -58,6 +58,16 @@ public: /// Notify about the editing context change. static void notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext); + /// Helper for posting async key event + static void postKeyEventAsync(const VclPtr<vcl::Window> &xWindow, + int nType, int nCharCode, int nKeyCode); + + /// Helper for posting async mouse event + static void postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, + int nType, const Point &rPos, + int nCount, MouseEventModifiers aModifiers, + int nButtons, int nModifier); + /// A special value to signify 'infinity'. /// This value is chosen such that sal_Int32 will not overflow when manipulated. static const long MaxTwips = 1e9; diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 7f8f7ce4c332..db95bfd81de5 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -90,56 +90,6 @@ protected: int mnTilePixelWidth, mnTilePixelHeight; int mnTileTwipWidth, mnTileTwipHeight; public: - struct LOKAsyncEventData - { - VclPtr<vcl::Window> mpWindow; - VclEventId mnEvent; - MouseEvent maMouseEvent; - KeyEvent maKeyEvent; - }; - - static void LOKPostAsyncEvent(void* pEv, void*) - { - LOKAsyncEventData* pLOKEv = static_cast<LOKAsyncEventData*>(pEv); - if (pLOKEv->mpWindow->IsDisposed()) - return; - - switch (pLOKEv->mnEvent) - { - case VclEventId::WindowKeyInput: - pLOKEv->mpWindow->KeyInput(pLOKEv->maKeyEvent); - break; - case VclEventId::WindowKeyUp: - pLOKEv->mpWindow->KeyUp(pLOKEv->maKeyEvent); - break; - case VclEventId::WindowMouseButtonDown: - pLOKEv->mpWindow->LogicMouseButtonDown(pLOKEv->maMouseEvent); - // Invoke the context menu - if (pLOKEv->maMouseEvent.GetButtons() & MOUSE_RIGHT) - { - const CommandEvent aCEvt(pLOKEv->maMouseEvent.GetPosPixel(), CommandEventId::ContextMenu, true, nullptr); - pLOKEv->mpWindow->Command(aCEvt); - } - break; - case VclEventId::WindowMouseButtonUp: - pLOKEv->mpWindow->LogicMouseButtonUp(pLOKEv->maMouseEvent); - - // sometimes MouseButtonDown captures mouse and starts tracking, and VCL - // will not take care of releasing that with tiled rendering - if (pLOKEv->mpWindow->IsTracking()) - pLOKEv->mpWindow->EndTracking(); - - break; - case VclEventId::WindowMouseMove: - pLOKEv->mpWindow->LogicMouseMove(pLOKEv->maMouseEvent); - break; - default: - assert(false); - break; - } - - delete pLOKEv; - } virtual ~ITiledRenderable(); @@ -368,7 +318,6 @@ public: { return OUString(); } - }; } // namespace vcl |