[Libreoffice-commits] core.git: 2 commits - android/experimental vcl/android

Tor Lillqvist tml at iki.fi
Wed Feb 27 11:01:34 PST 2013


 android/experimental/desktop/native-code.cxx                                               |    1 
 android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java |    5 +
 vcl/android/androidinst.cxx                                                                |   29 +++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 2341da1f207228c274b4449f4bfc2207c9535d31
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 27 21:00:22 2013 +0200

    We need the spell library as soon as we have some text in Writer
    
    Change-Id: Ice3eb23f57069043c0c971fce5dfe22aa95c3870

diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
index e6e4143..7c1d102 100644
--- a/android/experimental/desktop/native-code.cxx
+++ b/android/experimental/desktop/native-code.cxx
@@ -91,6 +91,7 @@ lo_get_libmap(void)
         { "libsmdlo.a", smd_component_getFactory },
         { "libsmlo.a", sm_component_getFactory },
         { "libspllo.a", spl_component_getFactory },
+        { "libspelllo.a", spell_component_getFactory },
         { "libsvgfilterlo.a", svgfilter_component_getFactory },
         { "libsvxlo.a", svx_component_getFactory },
         { "libswdlo.a", swd_component_getFactory },
commit 7cf5fea49991cce9198d43d63a5fb403234f6d4c
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Feb 27 21:00:02 2013 +0200

    Send text input to the LO code
    
    Change-Id: I28070fb1a8b85c9737d2a78a8a713243ce47dde9

diff --git a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java
index a3eb4d6..5c54330 100644
--- a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java
@@ -45,6 +45,7 @@ public class Desktop
     /* implementend by vcl */
     public static native void renderVCL(Bitmap bitmap);
     public static native void setViewSize(int width, int height);
+    public static native void key(char c, short timestamp);
 
     /**
      * This class contains the state that is initialized once and never changes
@@ -217,6 +218,10 @@ public class Desktop
 
         @Override public boolean commitText(CharSequence text, int newCursorPosition) {
             Log.i(TAG, "commitText(" + text + ", " + newCursorPosition + ")");
+            short timestamp = (short) (System.currentTimeMillis() % Short.MAX_VALUE);
+            for (int i = 0; i < text.length(); i++) {
+                Desktop.key(text.charAt(i), timestamp);
+            }
             return true;
         }
     }
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 2bdcf8a..b94855d 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -39,6 +39,7 @@
 
 #define LOGTAG "LibreOffice/androidinst"
 #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__))
+#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, LOGTAG, __VA_ARGS__))
 #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOGTAG, __VA_ARGS__))
 
 static bool bHitIdle = false;
@@ -463,6 +464,8 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
         }
 }
 
+#endif
+
 /*
  * Try too hard to get a frame, in the absence of anything better to do
  */
@@ -486,6 +489,8 @@ SalFrame *AndroidSalInstance::getFocusFrame() const
     return pFocus;
 }
 
+#if 0
+
 int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* event)
 {
     bool bHandled = false;
@@ -960,7 +965,7 @@ typedef struct ANativeWindow_Buffer {
 
 extern "C" SAL_JNI_EXPORT void JNICALL
 Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */,
-                                                              jobject /* object */,
+                                                              jobject /* clazz */,
                                                               jint width,
                                                               jint height)
 {
@@ -969,4 +974,26 @@ Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */
     viewHeight = height;
 }
 
+extern "C" SAL_JNI_EXPORT void JNICALL
+Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */,
+                                                      jobject /* clazz */,
+                                                      jchar c,
+                                                      jshort timestamp)
+{
+    SalKeyEvent aEvent;
+
+    aEvent.mnCharCode = c;
+    aEvent.mnTime = timestamp;
+    aEvent.mnCode = c;
+    aEvent.mnRepeat = 0;
+
+    SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame();
+    if (pFocus) {
+        pFocus->CallCallback( SALEVENT_KEYINPUT, &aEvent );
+        pFocus->CallCallback( SALEVENT_KEYUP, &aEvent );
+    }
+    else
+        LOGW("No focused frame to emit event on");
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list