summaryrefslogtreecommitdiff
path: root/sc
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 /sc
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 'sc')
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx28
3 files changed, 32 insertions, 1 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 56425694d42e..0e5808787469 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -394,6 +394,9 @@ public:
/// @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;
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 9d8965d052fb..259844ebfd35 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -287,7 +287,6 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
protected:
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;
@@ -304,6 +303,7 @@ public:
ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos );
virtual ~ScGridWindow();
+ virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
// #i70788# flush and get overlay
rtl::Reference<sdr::overlay::OverlayManager> getOverlayManager();
void flushOverlayManager();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 47f1e4124013..92dc6e16633b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -528,6 +528,34 @@ void ScModelObj::registerCallback(LibreOfficeKitCallback pCallback, void* pData)
pDocShell->GetDocument().GetDrawLayer()->registerLibreOfficeKitCallback(pCallback, pData);
}
+void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode)
+{
+ SolarMutexGuard aGuard;
+
+ // There seems to be no clear way of getting the grid window for this
+ // particular document, hence we need to hope we get the right window.
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ ScGridWindow* pGridWindow = pViewData->GetActiveWin();
+
+ if (!pGridWindow)
+ return;
+
+ KeyEvent aEvent(nCharCode, nKeyCode, 0);
+
+ switch (nType)
+ {
+ case LOK_KEYEVENT_KEYINPUT:
+ pGridWindow->KeyInput(aEvent);
+ break;
+ case LOK_KEYEVENT_KEYUP:
+ pGridWindow->KeyUp(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+}
+
void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount)
{
SolarMutexGuard aGuard;