[Libreoffice-commits] .: Branch 'feature/android' - 2 commits - README.Android vcl/android

Jan Holesovsky kendy at kemper.freedesktop.org
Fri Feb 3 11:37:46 PST 2012


 README.Android              |    1 +
 vcl/android/androidinst.cxx |   25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 898e88edc1a55e4825399d8d962f7f77cc3831ac
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Feb 3 20:39:39 2012 +0100

    android: An attempt to handle mouse events.

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 50a3040..ec38cec 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -399,7 +399,7 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
 
 int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* event)
 {
-    bool bHandled;
+    bool bHandled = false;
     fprintf (stderr, "input event for app %p, event %p type %d source %d device id %d\n",
              app, event,
              AInputEvent_getType(event),
@@ -437,6 +437,8 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent*
         else
             fprintf (stderr, "no focused frame to emit event on\n");
 
+        fprintf( stderr, "bHandled == %s\n", bHandled? "true": "false" );
+
         // FIXME: queueing full re-draw on key events ...
         mbQueueReDraw = true;
         break;
@@ -456,6 +458,27 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent*
                     AMotionEvent_getX(event, i),
                     AMotionEvent_getY(event, i),
                     AMotionEvent_getPressure(event, i));
+
+        SalMouseEvent aMouseEvent;
+        sal_uInt16 nEvent = 0;
+
+        // FIXME: all this filing the nEvent and aMouseEvent has to be cleaned up
+        nEvent = AMotionEvent_getAction(event)? SALEVENT_MOUSEBUTTONUP: SALEVENT_MOUSEBUTTONDOWN;
+
+        aMouseEvent.mnX = AMotionEvent_getXOffset(event);
+        aMouseEvent.mnY = AMotionEvent_getYOffset(event);
+        aMouseEvent.mnTime = 0; // FIXME
+        aMouseEvent.mnCode = 0; // FIXME
+        aMouseEvent.mnButton = MOUSE_LEFT; // FIXME
+
+        SalFrame *pFocus = SvpSalFrame::GetFocusFrame();
+        if (pFocus)
+            bHandled = pFocus->CallCallback( nEvent, &aMouseEvent );
+        else
+            fprintf (stderr, "no focused frame to emit event on\n");
+
+        fprintf( stderr, "bHandled == %s\n", bHandled? "true": "false" );
+
         break;
     }
     default:
commit f076254c6db77a999d4ad0aecc6b7df7b43b4c32
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri Feb 3 20:37:37 2012 +0100

    android: Source env. before trying to run it.

diff --git a/README.Android b/README.Android
index b5e32c7..e96597e 100644
--- a/README.Android
+++ b/README.Android
@@ -15,6 +15,7 @@ Then it is necessary to get stdout/err to go to somewhere we can find it:
 
 	Then:
 
+	. Env.Host.sh
 	cd android/qa/sc
 	make clean all install
 	make run ; adb shell logcat


More information about the Libreoffice-commits mailing list