[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - desktop/source include/sfx2 sfx2/source
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 2 19:50:18 UTC 2019
desktop/source/lib/init.cxx | 35 ++++++++++++++++++++---------------
include/sfx2/lokhelper.hxx | 4 ++++
sfx2/source/view/lokhelper.cxx | 26 ++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 15 deletions(-)
New commits:
commit 0c157b0d40019abe43531b512cb27bff28ae778b
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jul 16 22:59:49 2019 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Oct 2 21:49:32 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.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/80060
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 76839f609f65..017152e77352 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3055,16 +3055,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);
}
}
commit 55cca7daaffaa670b4e1422a48d05c791d3e3bee
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jul 16 16:14:16 2019 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Oct 2 21:49:22 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.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/80059
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9beabf8c1d1d..76839f609f65 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3027,19 +3027,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 49311105fff2..80f92bb04414 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -66,6 +66,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 529faf90f17a..c44d4c94d37d 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -298,6 +298,7 @@ namespace
VclEventId mnEvent;
MouseEvent maMouseEvent;
KeyEvent maKeyEvent;
+ OUString maText;
};
void LOKPostAsyncEvent(void* pEv, void*)
@@ -353,6 +354,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;
@@ -402,6 +407,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,
More information about the Libreoffice-commits
mailing list