desktop/source/lib/init.cxx | 14 +------------- include/sfx2/lokhelper.hxx | 4 ++++ sfx2/source/view/lokhelper.cxx | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 13 deletions(-)
New commits: commit f779609a9be63d70b895ba6f0d769e91b5321a2e Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Tue Jul 16 16:14:16 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Wed Oct 2 16:53:43 2019 +0200 Ensure that 'input' events are processed asynchronously too. Change-Id: I715eadd444e428148cfff8a61436987517004fae Reviewed-on: https://gerrit.libreoffice.org/79882 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3b8e7eb128c7..6a43d56c0296 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3044,19 +3044,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig return; } - switch (nType) - { - case LOK_EXT_TEXTINPUT: - pWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, - OUString::fromUtf8(OString(pText, strlen(pText)))); - break; - case LOK_EXT_TEXTINPUT_END: - pWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, - OUString::fromUtf8(OString(pText, strlen(pText)))); - break; - default: - assert(false && "Unhandled External Text input event!"); - } + SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(OString(pText, strlen(pText)))); } static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 1e6a0caad205..760b2ed5dfc6 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -65,6 +65,10 @@ public: static void postKeyEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, int nCharCode, int nKeyCode, int nRepeat = 0); + /// Helper for posting input event + static void postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow, + int nType, const OUString &rText); + /// Helper for posting async mouse event static void postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, const Point &rPos, diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index f9c559093861..b7a4b238f18b 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -301,6 +301,7 @@ namespace VclEventId mnEvent; MouseEvent maMouseEvent; KeyEvent maKeyEvent; + OUString maText; }; void LOKPostAsyncEvent(void* pEv, void*) @@ -356,6 +357,10 @@ namespace case VclEventId::WindowMouseMove: pLOKEv->mpWindow->LogicMouseMove(pLOKEv->maMouseEvent); break; + case VclEventId::ExtTextInput: + case VclEventId::EndExtTextInput: + pLOKEv->mpWindow->PostExtTextInputEvent(pLOKEv->mnEvent, pLOKEv->maText); + break; default: assert(false); break; @@ -405,6 +410,27 @@ void SfxLokHelper::postKeyEventAsync(const VclPtr<vcl::Window> &xWindow, postEventAsync(pLOKEv); } +void SfxLokHelper::postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow, + int nType, const OUString &rText) +{ + LOKAsyncEventData* pLOKEv = new LOKAsyncEventData; + switch (nType) + { + case LOK_EXT_TEXTINPUT: + pLOKEv->mnEvent = VclEventId::ExtTextInput; + pLOKEv->maText = rText; + break; + case LOK_EXT_TEXTINPUT_END: + pLOKEv->mnEvent = VclEventId::EndExtTextInput; + pLOKEv->maText = ""; + break; + default: + assert(false); + } + pLOKEv->mpWindow = xWindow; + postEventAsync(pLOKEv); +} + void SfxLokHelper::postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, const Point &rPos, int nCount, MouseEventModifiers aModifiers, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits