summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-04-03 12:29:28 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-07 09:18:17 +0200
commit7297feb6bcc89c55d1768794754f3b7d796c4c75 (patch)
tree4ace51a4630ff12dfef2cb406a45bd9b4fea7640 /sw
parentae4f4b7192f909eb8304dcd9c644796cb3af83f8 (diff)
LOK: reimplement lok::Document::postKeyEvent()
Instead of posting an event to the main loop of the soffice thread, do what every other methods do: take the solar mutex and execute the task on the thread. This fixes random lost/delayed key events on Android. Change-Id: Ibe819282b5f3bb64e44d4b6f0a92611fe651bb39
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unotxdoc.hxx2
-rw-r--r--sw/source/uibase/inc/edtwin.hxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx21
3 files changed, 24 insertions, 1 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 720256288216..22375eb3cebe 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -409,6 +409,8 @@ public:
virtual void initializeForTiledRendering() SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::registerCallback().
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
+ /// @see vcl::ITiledRenderable::postKeyEvent().
+ virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::postMouseEvent().
virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::setTextSelection().
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index 5a4cf7aa7198..e8c2e5e99d17 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -189,7 +189,6 @@ protected:
virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
virtual void PrePaint() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
- virtual void KeyInput(const KeyEvent &rKEvt) SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
@@ -218,6 +217,7 @@ protected:
bool IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const;
public:
+ virtual void KeyInput(const KeyEvent &rKEvt) SAL_OVERRIDE;
void UpdatePointer(const Point &, sal_uInt16 nButtons = 0);
bool IsDrawSelMode();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index f34f83b75181..5feadbf3b6af 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3183,6 +3183,27 @@ void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* p
pViewShell->registerLibreOfficeKitCallback(pCallback, pData);
}
+void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
+{
+ SolarMutexGuard aGuard;
+
+ SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();
+ KeyEvent aEvent(nCharCode, nKeyCode, 0);
+
+ switch (nType)
+ {
+ case LOK_KEYEVENT_KEYINPUT:
+ rEditWin.KeyInput(aEvent);
+ break;
+ case LOK_KEYEVENT_KEYUP:
+ rEditWin.KeyUp(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+}
+
void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount)
{
SolarMutexGuard aGuard;