summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-07-16 22:59:49 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-10-02 17:02:24 +0200
commit42dd11c0a2c9e71e8163363afbfd14f448c65ef5 (patch)
tree81a1191c6af5b5556ffecc47d9d7c05c03702362 /desktop
parentf779609a9be63d70b895ba6f0d769e91b5321a2e (diff)
input: ensure that removeTextContext happens in the right order.
Unfortunately the backspace key-events we emit trigger uno accelerator handling, which happens another PostMessage further out, so cheat by doing it synchronously, and relying on the PostMessage inside to get the ordering right. Change-Id: Ibee80af7674fd5107cb1c9ba323071ac024c45ae Reviewed-on: https://gerrit.libreoffice.org/79883 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6a43d56c0296..fe11dbaeccee 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3072,16 +3072,33 @@ static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWi
return;
}
+ // Annoyingly - backspace and delete are handled in the apps via an accelerator
+ // which are PostMessage'd by SfxViewShell::ExecKey_Impl so to stay in the same
+ // order we do this synchronously here, unless we're in a dialog.
if (nCharBefore > 0)
{
// backspace
- SfxLokHelper::postKeyEventAsync(pWindow, LOK_EXT_TEXTINPUT, 8, 1283, nCharBefore - 1);
+ if (nLOKWindowId == 0)
+ {
+ KeyEvent aEvt(8, 1283);
+ for (int i = 0; i < nCharBefore; ++i)
+ pWindow->KeyInput(aEvt);
+ }
+ else
+ SfxLokHelper::postKeyEventAsync(pWindow, LOK_KEYEVENT_KEYINPUT, 8, 1283, nCharBefore - 1);
}
if (nCharAfter > 0)
{
// delete (forward)
- SfxLokHelper::postKeyEventAsync(pWindow, LOK_EXT_TEXTINPUT, 46, 1286, nCharAfter - 1);
+ if (nLOKWindowId == 0)
+ {
+ KeyEvent aEvt(46, 1286);
+ for (int i = 0; i < nCharAfter; ++i)
+ pWindow->KeyInput(aEvt);
+ }
+ else
+ SfxLokHelper::postKeyEventAsync(pWindow, LOK_KEYEVENT_KEYINPUT, 46, 1286, nCharAfter - 1);
}
}