summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/source/ui/inc/Window.hxx2
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx28
3 files changed, 31 insertions, 1 deletions
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
index be2bb1af4e11..dca72fbdc519 100644
--- a/sd/source/ui/inc/Window.hxx
+++ b/sd/source/ui/inc/Window.hxx
@@ -147,6 +147,7 @@ public:
*/
void SetUseDropScroll (bool bUseDropScroll);
void DropScroll (const Point& rMousePos);
+ virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
protected:
::sd::Window* mpShareWin;
Point maWinPos;
@@ -171,7 +172,6 @@ protected:
virtual void Resize() 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 MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index bb840f2b1983..b9c17ac4ba4e 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -245,6 +245,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/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 9cb8df9acd93..e2ab4f8bde16 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2378,6 +2378,34 @@ void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void
mpDoc->registerLibreOfficeKitCallback(pCallback, pData);
}
+void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
+{
+ SolarMutexGuard aGuard;
+
+ DrawViewShell* pViewShell = GetViewShell();
+ if (!pViewShell)
+ return;
+
+ sd::Window* pWindow = pViewShell->GetActiveWindow();
+ if (!pWindow)
+ return;
+
+ KeyEvent aEvent(nCharCode, nKeyCode, 0);
+
+ switch (nType)
+ {
+ case LOK_KEYEVENT_KEYINPUT:
+ pWindow->KeyInput(aEvent);
+ break;
+ case LOK_KEYEVENT_KEYUP:
+ pWindow->KeyUp(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+}
+
void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount)
{
SolarMutexGuard aGuard;