[Libreoffice-commits] core.git: 2 commits - android/experimental vcl/android
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 t...@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 t...@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,
[Libreoffice-commits] core.git: 2 commits - android/experimental vcl/android
android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java | 10 vcl/android/androidinst.cxx | 166 +- 2 files changed, 92 insertions(+), 84 deletions(-) New commits: commit e6cccd3df8397a07d6d5e403fa08cf0fd658b31e Author: Tor Lillqvist t...@iki.fi Date: Mon Feb 25 14:24:39 2013 +0200 Use __android_log_print() instead of fprintf(stderr) Printing to stderr is not at all any faster or more direct in an Android app than just using the Android standard logging API. Note that in a normal Android app, stdout and stderr are not connected anywhere. (Just like in GUI subsystem (as opposed to console) Windows programs, heh.) It is our own code in sal/android/lo-bootstrap.c that redirects stdout and stderr to pipes which we set up and which are read in a separate thread that we start. The lines read are then, surprise, passed on to __android_log_print(). Thus writes to stdout or stderr in normal LibreOffice code aren't lost. But in code that is by definition Android-specific it makes little sense to use stdout and stderr. (Much of the affected logging in this change is in NativeActivity-related #if 0'ed code, sure, so won't actually be reached.) Change-Id: I409114f36f3e535bb144b4bde0d378110b3336a1 diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 8baea41..2ed1585 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -37,6 +37,10 @@ #include rtl/strbuf.hxx #include basebmp/scanlineformats.hxx +#define LOGTAG LibreOffice/androidinst +#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__)) +#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOGTAG, __VA_ARGS__)) + static bool bHitIdle = false; class AndroidSalData : public SalGenericData @@ -185,13 +189,13 @@ static sal_uInt16 KeyToCode(AInputEvent *event) case AKEYCODE_BUTTON_START: case AKEYCODE_BUTTON_SELECT: case AKEYCODE_BUTTON_MODE: -fprintf (stderr, un-mapped keycode %d\n, nCode); +LOGI(un-mapped keycode %d\n, nCode); nCode = 0; break; #undef MAP_SAME #undef MAP } -fprintf (stderr, mapped %d - %d\n, AKeyEvent_getKeyCode(event), nCode); +LOGI(mapped %d - %d\n, AKeyEvent_getKeyCode(event), nCode); return nCode; } @@ -202,7 +206,7 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, const ARect rSrcRect, int nDestX, int nDestY) { -fprintf (stderr, Blit frame src %d,%d-%d,%d to position %d, %d\n, +LOGI(Blit frame src %d,%d-%d,%d to position %d, %d\n, rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom, nDestX, nDestY); @@ -252,7 +256,7 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, break; } default: -fprintf (stderr, unknown pixel format %d !\n, pOutBuffer-format); +LOGI(unknown pixel format %d !\n, pOutBuffer-format); break; } } @@ -271,7 +275,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buf ANativeWindow_Buffer aOutBuffer; memset ((void *)aOutBuffer, 0, sizeof (aOutBuffer)); -fprintf (stderr, RedrawWindows\n); +LOGI(RedrawWindows\n); int32_t nRet = 0; if (pBuffer != NULL) @@ -282,10 +286,10 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buf return; //ARect aRect; -fprintf (stderr, pre lock #3\n); +LOGI(pre lock #3\n); nRet = ANativeWindow_lock(pWindow, aOutBuffer, NULL); } -fprintf (stderr, Frame count: %d locked window %d returned // rect: %d,%d-%d,%d +LOGI(Frame count: %d locked window %d returned // rect: %d,%d-%d,%d buffer: %dx%d stride %d, format %d, bits %p\n, (int)getFrames().size(), nRet, // aRect.left, aRect.top, aRect.right, aRect.bottom, @@ -311,7 +315,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buf if (pFrame-IsVisible()) { -fprintf( stderr, render visible frame %d\n, i ); +LOGI(render visible frame %d\n, i ); #ifndef REGION_RE_RENDER BlitFrameToWindow (aOutBuffer, pFrame-getDevice()); #else @@ -341,12 +345,12 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buf } } else -fprintf (stderr, no buffer for locked window\n); +LOGI(no buffer for locked window\n); if (pBuffer pWindow) ANativeWindow_unlockAndPost(pWindow); -fprintf (stderr, done render!\n); +LOGI(done render!\n); maRedrawRegion.SetEmpty();