summaryrefslogtreecommitdiff
path: root/vcl/android
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-02-28 14:42:41 +0200
committerTor Lillqvist <tml@iki.fi>2013-02-28 22:34:23 +0200
commit32da3c3a6bfc61de44c37a77bfca84e3cac2c59d (patch)
treed8ac8606faf2e47739ecfb341fcdebab40f745e5 /vcl/android
parent658824e43dc306b986a85e73cb1bffaf0e48b879 (diff)
Try to use another kind of events
I see randomish crashes that likely are caused by parallelism problems. Try to see if using Application::PostKeyEventg() and PostMouseEvent() instead of SalFrame::CallCallback() helps. Change-Id: Ia97259a378fe40ff0dab3fbb538599e9d2e69c1f
Diffstat (limited to 'vcl/android')
-rw-r--r--vcl/android/androidinst.cxx36
1 files changed, 14 insertions, 22 deletions
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 5c9fb78a3e4a..d855c17b89ff 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -977,19 +977,14 @@ extern "C" SAL_JNI_EXPORT void JNICALL
Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */,
jobject /* clazz */,
jchar c,
- jshort timestamp)
+ jshort /* timestamp */)
{
- SalKeyEvent aEvent;
-
- aEvent.mnCharCode = c;
- aEvent.mnTime = timestamp;
- aEvent.mnCode = c;
- aEvent.mnRepeat = 0;
+ KeyEvent aEvent(c, c, 0);
SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame();
if (pFocus) {
- pFocus->CallCallback( SALEVENT_KEYINPUT, &aEvent );
- pFocus->CallCallback( SALEVENT_KEYUP, &aEvent );
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
}
else
LOGW("No focused frame to emit event on");
@@ -1002,26 +997,23 @@ Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */,
jint action,
jint x,
jint y,
- jshort timestamp)
+ jshort /* timestamp */)
{
- SalMouseEvent aEvent;
-
- aEvent.mnTime = timestamp;
- aEvent.mnX = x;
- aEvent.mnY = y;
- aEvent.mnButton = MOUSE_LEFT;
- aEvent.mnCode = 0;
+ MouseEvent aEvent;
- sal_uInt16 eventKind;
+ sal_uLong nEvent;
switch (action) {
case AMOTION_EVENT_ACTION_DOWN:
- eventKind = SALEVENT_MOUSEBUTTONDOWN;
+ aEvent = MouseEvent(Point(x, y), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT);
+ nEvent = VCLEVENT_WINDOW_MOUSEBUTTONDOWN;
break;
case AMOTION_EVENT_ACTION_UP:
- eventKind = SALEVENT_MOUSEBUTTONUP;
+ aEvent = MouseEvent(Point(x, y), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT);
+ nEvent = VCLEVENT_WINDOW_MOUSEBUTTONUP;
break;
case AMOTION_EVENT_ACTION_MOVE:
- eventKind = SALEVENT_MOUSEMOVE;
+ aEvent = MouseEvent(Point(x, y), 1, MOUSE_SIMPLEMOVE, MOUSE_LEFT);
+ nEvent = VCLEVENT_WINDOW_MOUSEMOVE;
break;
default:
LOGE("Java_org_libreoffice_experimental_desktop_Desktop_touch: Invalid action %d", action);
@@ -1030,7 +1022,7 @@ Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */,
SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame();
if (pFocus)
- pFocus->CallCallback( eventKind, &aEvent );
+ Application::PostMouseEvent(nEvent, pFocus->GetWindow(), &aEvent);
else
LOGW("No focused frame to emit event on");
}