desktop/source/lib/init.cxx |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 42dd11c0a2c9e71e8163363afbfd14f448c65ef5
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue Jul 16 22:59:49 2019 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Wed Oct 2 17:02:24 2019 +0200

    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.me...@collabora.com>

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);
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to