summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2018-02-23 02:58:59 +0530
committerJan Holesovsky <kendy@collabora.com>2018-02-23 20:46:42 +0100
commit0178d2b7071be32ac2334e0548beae3b4e8dbc7d (patch)
treee03f506322ecfe9c0c9ce0d3d7d4e7511b2db2b7
parent4152ecf98622d81aef50b68c9165292ba244abb9 (diff)
lokdialog sc: post key events to the main thread
This also fixes the problem when some dialog is executed inside the key handler. Change-Id: I831ed4b886c1a5eac13dffd8e881a07045458e44 Reviewed-on: https://gerrit.libreoffice.org/50244 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx1
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
2 files changed, 5 insertions, 2 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 74d2d3dc5f0a..11c5179622c6 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1590,6 +1590,7 @@ void ScTiledRenderingTest::testIMESupport()
// commit the string to the cell
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+ Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(aInputs[aInputs.size() - 1], pDoc->GetString(ScAddress(0, 0, 0)));
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b6cbc5e46fac..d191d14ba9a5 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -619,14 +619,16 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode)
if (!pWindow)
return;
+ if (!pWindow->HasFocus())
+ pWindow->GrabFocus();
KeyEvent aEvent(nCharCode, nKeyCode, 0);
switch (nType)
{
case LOK_KEYEVENT_KEYINPUT:
- pWindow->KeyInput(aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
break;
case LOK_KEYEVENT_KEYUP:
- pWindow->KeyUp(aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
break;
default:
assert(false);