summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-03-13 17:18:11 +0100
committerJan Holesovsky <kendy@collabora.com>2019-03-15 09:53:12 +0100
commit41b22ebcb480e1e4a78e83b7bc211f73ad62ab31 (patch)
tree3171554b03444ef78e0cf3252abf05f8cc6fd609 /sw
parent7a758da47cdcf4017f41e1e16dc1f643148d2f9b (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 'sw')
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx45
1 files changed, 3 insertions, 42 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 789c7a5308b7..d58c8ac5e1dc 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3502,27 +3502,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
{
SolarMutexGuard aGuard;
-
- VclPtr<vcl::Window> pWindow = getDocWindow();
- if (!pWindow || pWindow->IsDisposed())
- return;
-
- LOKAsyncEventData* pLOKEv = new LOKAsyncEventData;
- pLOKEv->mpWindow = pWindow;
- switch (nType)
- {
- case LOK_KEYEVENT_KEYINPUT:
- pLOKEv->mnEvent = VclEventId::WindowKeyInput;
- break;
- case LOK_KEYEVENT_KEYUP:
- pLOKEv->mnEvent = VclEventId::WindowKeyUp;
- break;
- default:
- assert(false);
- }
-
- pLOKEv->maKeyEvent = KeyEvent(nCharCode, nKeyCode, 0);
- Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent));
+ SfxLokHelper::postKeyEventAsync(getDocWindow(), nType, nCharCode, nKeyCode);
}
void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
@@ -3550,29 +3530,10 @@ void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int
}
SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
-
-
- LOKAsyncEventData* pLOKEv = new LOKAsyncEventData;
- pLOKEv->mpWindow = &rEditWin;
- switch (nType)
- {
- case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pLOKEv->mnEvent = VclEventId::WindowMouseButtonDown;
- break;
- case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pLOKEv->mnEvent = VclEventId::WindowMouseButtonUp;
- break;
- case LOK_MOUSEEVENT_MOUSEMOVE:
- pLOKEv->mnEvent = VclEventId::WindowMouseMove;
- break;
- default:
- assert(false);
- }
-
- pLOKEv->maMouseEvent = MouseEvent(Point(nX, nY), nCount,
+ SfxLokHelper::postMouseEventAsync(&rEditWin, nType,
+ Point(nX, nY), nCount,
MouseEventModifiers::SIMPLECLICK,
nButtons, nModifier);
- Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent));
}
void SwXTextDocument::setTextSelection(int nType, int nX, int nY)