From 3e52b896843ae0a9e137d4728e2ef73245e7e144 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 14:45:16 +0000 Subject: android: add versionrc generation for desktop --- android/qa/desktop/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 375bb82e341b..1dd0d83797c4 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -38,6 +38,7 @@ buildrcs: echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc # - this looks useful but breaks more than it fixes ... # echo "DISABLE_EXTENSION_SYNCHRONIZATION=1" >> assets/program/lofficerc + # fundamentalrc ini ... echo "[Bootstrap]" > assets/program/fundamentalrc echo "LO_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc @@ -71,6 +72,22 @@ buildrcs: echo "ProductKey=LibreOffice 3.5" >> assets/program/bootstraprc echo "UserInstallation=file://$(APP_DATA_PATH)/files/.libreoffice" >> assets/program/bootstraprc +# versionrc ini ... + echo "[Version]" > assets/program/versionrc + echo "AllLanguages=en-US" >> assets/program/versionrc + echo "BuildVersion=" >> assets/program/versionrc + echo "buildid=dead-beef" >> assets/program/versionrc + echo "ExtensionUpdateURL=http://updateexte.libreoffice.org/ExtensionUpdateService/check.Update" >> assets/program/versionrc + echo "ProductBuildid=3" >> assets/program/versionrc + echo "ProductMajor=360" >> assets/program/versionrc + echo "ProductMinor=1" >> assets/program/versionrc + echo "ProductSource=OOO350" >> assets/program/versionrc + echo "ReferenceOOoMajorMinor=3.6" >> assets/program/versionrc + echo "UpdateID=LibreOffice_3_en-US" >> assets/program/versionrc + echo "UpdateURL=" >> assets/program/versionrc + echo "UpdateUserAgent= (${buildid}; ${_OS}; ${_ARCH}; BundledLanguages=${AllLanguages})" >> assets/program/versionrc + echo "Vendor=SelfCompiledGit" >> assets/program/versionrc + copy-stuff: buildrcs # # Copy shared libraries we need to libs/armeabi-v7a so that ant will -- cgit From fd268507704ba82af2abe4f5f777daf4c43d74fe Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 15:09:55 +0000 Subject: android: cleanup osl security code for empty home / username fields --- sal/osl/unx/security.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index d73111c8afba..96605fc1739c 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -276,7 +276,7 @@ static sal_Bool SAL_CALL osl_psz_getUserName(oslSecurity Security, sal_Char* psz { oslSecurityImpl *pSecImpl = (oslSecurityImpl *)Security; - if (pSecImpl == NULL) + if (pSecImpl == NULL || pSecImpl->m_pPasswd.pw_name == NULL) return sal_False; strncpy(pszName, pSecImpl->m_pPasswd.pw_name, nMax); @@ -364,14 +364,17 @@ static sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszD pStr = getenv("HOME"); #endif - if ((pStr != NULL) && (strlen(pStr) > 0) && - (access(pStr, 0) == 0)) + if (pStr != NULL && strlen(pStr) > 0 && access(pStr, 0) == 0) strncpy(pszDirectory, pStr, nMax); - else + else if (pSecImpl->m_pPasswd.pw_dir != NULL) strncpy(pszDirectory, pSecImpl->m_pPasswd.pw_dir, nMax); + else + return sal_False; } - else + else if (pSecImpl->m_pPasswd.pw_dir != NULL) strncpy(pszDirectory, pSecImpl->m_pPasswd.pw_dir, nMax); + else + return sal_False; return sal_True; } @@ -403,8 +406,7 @@ static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* ps { sal_Char *pStr = getenv("XDG_CONFIG_HOME"); - if ((pStr == NULL) || (strlen(pStr) == 0) || - (access(pStr, 0) != 0)) + if (pStr == NULL || strlen(pStr) == 0 || access(pStr, 0) != 0) { size_t n = 0; // a default equal to $HOME/.config should be used. @@ -460,9 +462,9 @@ sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security) return sal_False; if (pSecImpl->m_pPasswd.pw_uid != 0) - return (sal_False); + return sal_False; - return (sal_True); + return sal_True; } void SAL_CALL osl_freeSecurityHandle(oslSecurity Security) -- cgit From 5c59f1e22aaf9e495e3c0d207660cc36d3c2ac82 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 17:13:04 +0000 Subject: android: more vcl pieces, wake/yield/loop bits and test pattern --- vcl/android/androidinst.cxx | 157 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 155 insertions(+), 2 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 08c01ae4fea2..aba4b0b3ca65 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -30,8 +30,140 @@ #include #include #include +#include #include +#include #include +#include + +static rtl::OString MotionEdgeFlagsToString(int32_t nFlags) +{ + rtl::OStringBuffer aStr; + if (nFlags == AMOTION_EVENT_EDGE_FLAG_NONE) + aStr.append ("no-edge"); + if (nFlags & AMOTION_EVENT_EDGE_FLAG_TOP) + aStr.append (":top"); + if (nFlags & AMOTION_EVENT_EDGE_FLAG_BOTTOM) + aStr.append (":bottom"); + if (nFlags & AMOTION_EVENT_EDGE_FLAG_LEFT) + aStr.append (":left"); + if (nFlags & AMOTION_EVENT_EDGE_FLAG_RIGHT) + aStr.append (":right"); + return aStr.makeStringAndClear(); +} + +static rtl::OString KeyMetaStateToString(int32_t nFlags) +{ + rtl::OStringBuffer aStr; + if (nFlags == AMETA_NONE) + aStr.append ("no-meta"); + if (nFlags & AMETA_ALT_ON) + aStr.append (":alt"); + if (nFlags & AMETA_SHIFT_ON) + aStr.append (":shift"); + if (nFlags & AMETA_SYM_ON) + aStr.append (":sym"); + return aStr.makeStringAndClear(); +} + +int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); + +extern "C" { + void onAppCmd_cb (struct android_app* app, int32_t cmd) + { + fprintf (stderr, "app cmd for app %p, cmd %d\n", app, cmd); + ANativeWindow *pWindow = global_android_app->window; + switch (cmd) { + case APP_CMD_INIT_WINDOW: + { + ARect aRect = { 0, 0, 0, 0 }; + aRect.right = ANativeWindow_getWidth(pWindow); + aRect.bottom = ANativeWindow_getHeight(pWindow); + fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", + pWindow, aRect.right, aRect.bottom, + ANativeWindow_getFormat(pWindow)); + ANativeWindow_Buffer aBuffer; + memset ((void *)&aBuffer, 0, sizeof (aBuffer)); + int32_t nRet = ANativeWindow_lock(pWindow, &aBuffer, &aRect); + fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " + "buffer: %dx%d stride %d, format %d, bits %p\n", + nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, + aBuffer.width, aBuffer.height, aBuffer.stride, + aBuffer.format, aBuffer.bits); + if (aBuffer.bits) + { + // hard-code / guess at a format ... + int32_t *p = (int32_t *)aBuffer.bits; + for (int32_t y = 0; y < aBuffer.height; y++) + { + for (int32_t x = 0; x < aBuffer.stride / 4; x++) + *p++ = (y << 24) + x; + } + } + ANativeWindow_unlockAndPost(pWindow); + fprintf (stderr, "done render!\n"); + break; + } + case APP_CMD_WINDOW_RESIZED: + { + ARect aRect = { 0, 0, 0, 0 }; + aRect.right = ANativeWindow_getWidth(pWindow); + aRect.bottom = ANativeWindow_getHeight(pWindow); + fprintf (stderr, "app window resized to ! %p %dx%x (%d)\n", + pWindow, aRect.right, aRect.bottom, + ANativeWindow_getFormat(pWindow)); + break; + } + + case APP_CMD_CONTENT_RECT_CHANGED: + { + ARect aRect = global_android_app->contentRect; + fprintf (stderr, "content rect changed [ k/b popped up etc. ] %d,%d->%d,%d\n", + aRect.left, aRect.top, aRect.right, aRect.bottom); + break; + } + default: + fprintf (stderr, "unhandled app cmd %d\n", cmd); + break; + } + } + + int32_t onInputEvent_cb (struct android_app* app, AInputEvent* event) + { + fprintf (stderr, "input event for app %p, event %p type %d source %d device id %d\n", + app, event, + AInputEvent_getType(event), + AInputEvent_getSource(event), + AInputEvent_getDeviceId(event)); + + switch (AInputEvent_getType(event)) + { + case AINPUT_EVENT_TYPE_KEY: + { + int32_t nAction = AKeyEvent_getAction(event); + fprintf (stderr, "key event keycode %d '%s' %s\n", + AKeyEvent_getKeyCode(event), + nAction == AKEY_EVENT_ACTION_DOWN ? "down" : + nAction == AKEY_EVENT_ACTION_UP ? "up" : "multiple", + KeyMetaStateToString(AKeyEvent_getMetaState(event)).getStr()); + break; + } + case AINPUT_EVENT_TYPE_MOTION: + { + fprintf (stderr, "motion event %d %g %g %s\n", + AMotionEvent_getAction(event), + AMotionEvent_getXOffset(event), + AMotionEvent_getYOffset(event), + MotionEdgeFlagsToString(AMotionEvent_getEdgeFlags(event)).getStr()); + break; + } + default: + fprintf (stderr, "unknown event type %p %d\n", + event, AInputEvent_getType(event)); + } + return 1; // handled 0 for not ... + } +} AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) @@ -39,6 +171,15 @@ AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) fprintf (stderr, "created Android Sal Instance for app %p window %p\n", global_android_app, global_android_app ? global_android_app->window : NULL); + if (global_android_app) + { + pthread_mutex_lock (&global_android_app->mutex); + global_android_app->onAppCmd = onAppCmd_cb; + global_android_app->onInputEvent = onInputEvent_cb; + if (global_android_app->window != NULL) + onAppCmd_cb (global_android_app, APP_CMD_INIT_WINDOW); + pthread_mutex_unlock (&global_android_app->mutex); + } } AndroidSalInstance::~AndroidSalInstance() @@ -48,6 +189,7 @@ AndroidSalInstance::~AndroidSalInstance() void AndroidSalInstance::Wakeup() { + fprintf (stderr, "Wakeup alooper\n"); if (global_android_app && global_android_app->looper) ALooper_wake (global_android_app->looper); else @@ -58,12 +200,23 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) { // release yield mutex sal_uLong nAcquireCount = ReleaseYieldMutex(); + struct android_app *pApp = global_android_app; - fprintf (stderr, "DoReleaseYield for %d ms\n", nTimeoutMS); -// int ALooper_pollOnce(timeoutMs, int* outFd, int* outEvents, void** outData); + fprintf (stderr, "DoReleaseYield #2 %d ms\n", nTimeoutMS); + void *outData = NULL; + int outFd = 0, outEvents = 0; + int nRet = ALooper_pollAll(nTimeoutMS, &outFd, &outEvents, &outData); + fprintf (stderr, "ret %d %d %d %p\n", nRet, outFd, outEvents, outData); // acquire yield mutex again AcquireYieldMutex(nAcquireCount); + + // FIXME: this is more or less deranged: why can we not + // set a callback in the native app glue's ALooper_addFd ? + if (nRet == LOOPER_ID_MAIN) + pApp->cmdPollSource.process(pApp, &pApp->cmdPollSource); + if (nRet == LOOPER_ID_INPUT) + pApp->inputPollSource.process(pApp, &pApp->inputPollSource); } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) -- cgit From 182bd1d016c00ba207dec2dac754ef25add4cdf7 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 25 Jan 2012 13:42:06 +0200 Subject: Let's skip scp2 for non-desktop OSes for now --- postprocess/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postprocess/prj/build.lst b/postprocess/prj/build.lst index 47992b2ce6fc..aa756e528fa3 100644 --- a/postprocess/prj/build.lst +++ b/postprocess/prj/build.lst @@ -1,4 +1,4 @@ -po postprocess :: BINFILTER:binfilter CRASHREP:crashrep CT2N:ct2n embeddedobj embedserv EPM:epm extras HELP:helpcontent2 LIBRSVG:librsvg ODK:odk scp2 testtools wizards MORE_FONTS:more_fonts DICTIONARIES:dictionaries PYUNO:pyuno DESKTOP:unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder LANGUAGETOOL:languagetool SDEXT:sdext MYSQLC:mysqlc NLPSOLVER:nlpsolver STLPORT:stlport smoketest tail_build NULL +po postprocess :: BINFILTER:binfilter CRASHREP:crashrep CT2N:ct2n embeddedobj embedserv EPM:epm extras HELP:helpcontent2 LIBRSVG:librsvg ODK:odk DESKTOP:scp2 testtools wizards MORE_FONTS:more_fonts DICTIONARIES:dictionaries PYUNO:pyuno DESKTOP:unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder LANGUAGETOOL:languagetool SDEXT:sdext MYSQLC:mysqlc NLPSOLVER:nlpsolver STLPORT:stlport smoketest tail_build NULL po postprocess usr1 - all po_mkout NULL po postprocess\checkxml nmake - all po_checkxml NULL po postprocess\packconfig nmake - all po_packconfig po_checkxml NULL -- cgit From c4e35496393c73e73a297e8c5398cb6f96a35e46 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 25 Jan 2012 14:45:52 +0200 Subject: WaE: int and long confusion --- svx/source/stbctrls/zoomsliderctrl.cxx | 4 ++-- sw/source/ui/uiview/viewport.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index afab9c4dd3a0..66b5d4dc404d 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -359,11 +359,11 @@ sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) // click to - button if ( nXDiff >= nButtonLeftOffset && nXDiff <= nButtonRightOffset ) - mpImpl->mnCurrentZoom = basegfx::zoomtools::zoomOut( mpImpl->mnCurrentZoom ); + mpImpl->mnCurrentZoom = basegfx::zoomtools::zoomOut( static_cast(mpImpl->mnCurrentZoom) ); // click to + button else if ( nXDiff >= aControlRect.GetWidth() - nSliderXOffset + nButtonLeftOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset + nButtonRightOffset ) - mpImpl->mnCurrentZoom = basegfx::zoomtools::zoomIn( mpImpl->mnCurrentZoom ); + mpImpl->mnCurrentZoom = basegfx::zoomtools::zoomIn( static_cast(mpImpl->mnCurrentZoom) ); // click to slider else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset ) mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff ); diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx index ae6ef2046439..2591b507f1a1 100644 --- a/sw/source/ui/uiview/viewport.cxx +++ b/sw/source/ui/uiview/viewport.cxx @@ -1311,9 +1311,9 @@ sal_Bool SwView::HandleWheelCommands( const CommandEvent& rCEvt ) { sal_uInt16 nFact = pWrtShell->GetViewOptions()->GetZoom(); if( 0L > pWData->GetDelta() ) - nFact = static_cast< sal_uInt16 >(Max( 20, basegfx::zoomtools::zoomOut( nFact ))); + nFact = static_cast< sal_uInt16 >(Max( 20, basegfx::zoomtools::zoomOut( static_cast(nFact) ))); else - nFact = static_cast< sal_uInt16 >(Min( 600, basegfx::zoomtools::zoomIn( nFact ))); + nFact = static_cast< sal_uInt16 >(Min( 600, basegfx::zoomtools::zoomIn( static_cast(nFact) ))); SetZoom( SVX_ZOOM_PERCENT, nFact ); bOk = sal_True; -- cgit From 25f78344e8dea95cedb0b981f08865d676154e5b Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Wed, 25 Jan 2012 16:41:45 +0200 Subject: Bin global_android_app and instead use lo-bootstrap API Instead of introducing a global variable, use the already existing saved android_app pointer in lo-bootstrap.c, and just add a function to retrieve it from there. Store it in the AndroidSalInstance. Reanme osl/detail/android.h back to android_native_app_glue.h, which is the name of that file in NDK/sources. "android.h" sounded to me too grand, as if it was some universal Android header. But if we do start to modify the android_native_app_glue stuff heavily, then it indeed makes sense to call it something else. Until then, revert also some whitespace changes to android_native_app_glue.c for it to be as close as possible to the "upstream" one in the NDK, for clarity. --- sal/Package_inc.mk | 2 +- sal/android/android_native_app_glue.c | 15 +- sal/android/lo-bootstrap.c | 7 + sal/inc/osl/detail/android.h | 352 --------------------------- sal/inc/osl/detail/android_native_app_glue.h | 349 ++++++++++++++++++++++++++ solenv/inc/unxandr/lo-bootstrap.h | 2 + vcl/android/androidinst.cxx | 37 +-- vcl/inc/android/androidinst.hxx | 1 + 8 files changed, 382 insertions(+), 383 deletions(-) delete mode 100644 sal/inc/osl/detail/android.h create mode 100644 sal/inc/osl/detail/android_native_app_glue.h diff --git a/sal/Package_inc.mk b/sal/Package_inc.mk index d0520efcd757..e43de3e46388 100644 --- a/sal/Package_inc.mk +++ b/sal/Package_inc.mk @@ -64,7 +64,7 @@ $(eval $(call gb_Package_add_file,sal_inc,inc/osl/thread.hxx,osl/thread.hxx)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/time.h,osl/time.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/util.h,osl/util.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/file.h,osl/detail/file.h)) -$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android.h,osl/detail/android.h)) +$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android_native_app_glue.h,osl/detail/android_native_app_glue.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/allocator.hxx,rtl/allocator.hxx)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/alloc.h,rtl/alloc.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/bootstrap.h,rtl/bootstrap.h)) diff --git a/sal/android/android_native_app_glue.c b/sal/android/android_native_app_glue.c index efd7a4b8c38e..cf5d8e8575fd 100644 --- a/sal/android/android_native_app_glue.c +++ b/sal/android/android_native_app_glue.c @@ -22,7 +22,7 @@ #include #include -#include "osl/detail/android.h" +#include "osl/detail/android_native_app_glue.h" #include #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__)) @@ -236,14 +236,9 @@ static void* android_app_entry(void* param) { // -------------------------------------------------------------------- static struct android_app* android_app_create(ANativeActivity* activity, - void* savedState, size_t savedStateSize) -{ + void* savedState, size_t savedStateSize) { struct android_app* android_app = (struct android_app*)malloc(sizeof(struct android_app)); memset(android_app, 0, sizeof(struct android_app)); - - // get this across to VCL. - global_android_app = android_app; - android_app->activity = activity; pthread_mutex_init(&android_app->mutex, NULL); @@ -419,13 +414,9 @@ static void onInputQueueDestroyed(ANativeActivity* activity, AInputQueue* queue) android_app_set_input((struct android_app*)activity->instance, NULL); } -__attribute__ ((visibility("default"))) struct android_app *global_android_app = NULL; - __attribute__ ((visibility("default"))) void ANativeActivity_onCreate(ANativeActivity* activity, - void* savedState, size_t savedStateSize) -{ + void* savedState, size_t savedStateSize) { LOGI("Creating: %p\n", activity); - activity->callbacks->onDestroy = onDestroy; activity->callbacks->onStart = onStart; activity->callbacks->onResume = onResume; diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index bd9049432081..3cb8d3a25300 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -1469,6 +1469,13 @@ lo_get_javavm(void) return app->activity->vm; } +__attribute__ ((visibility("default"))) +struct android_app * +lo_get_app(void) +{ + return app; +} + __attribute__ ((visibility("default"))) void android_main(struct android_app* state) diff --git a/sal/inc/osl/detail/android.h b/sal/inc/osl/detail/android.h deleted file mode 100644 index beb5b1d348a3..000000000000 --- a/sal/inc/osl/detail/android.h +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef _ANDROID_NATIVE_APP_GLUE_H -#define _ANDROID_NATIVE_APP_GLUE_H - -#include -#include -#include - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Global activity to be hooked by upper layers. - */ -extern struct android_app *global_android_app; - -/** - * The native activity interface provided by - * is based on a set of application-provided callbacks that will be called - * by the Activity's main thread when certain events occur. - * - * This means that each one of this callbacks _should_ _not_ block, or they - * risk having the system force-close the application. This programming - * model is direct, lightweight, but constraining. - * - * The 'threaded_native_app' static library is used to provide a different - * execution model where the application can implement its own main event - * loop in a different thread instead. Here's how it works: - * - * 1/ The application must provide a function named "android_main()" that - * will be called when the activity is created, in a new thread that is - * distinct from the activity's main thread. - * - * 2/ android_main() receives a pointer to a valid "android_app" structure - * that contains references to other important objects, e.g. the - * ANativeActivity obejct instance the application is running in. - * - * 3/ the "android_app" object holds an ALooper instance that already - * listens to two important things: - * - * - activity lifecycle events (e.g. "pause", "resume"). See APP_CMD_XXX - * declarations below. - * - * - input events coming from the AInputQueue attached to the activity. - * - * Each of these correspond to an ALooper identifier returned by - * ALooper_pollOnce with values of LOOPER_ID_MAIN and LOOPER_ID_INPUT, - * respectively. - * - * Your application can use the same ALooper to listen to additional - * file-descriptors. They can either be callback based, or with return - * identifiers starting with LOOPER_ID_USER. - * - * 4/ Whenever you receive a LOOPER_ID_MAIN or LOOPER_ID_INPUT event, - * the returned data will point to an android_poll_source structure. You - * can call the process() function on it, and fill in android_app->onAppCmd - * and android_app->onInputEvent to be called for your own processing - * of the event. - * - * Alternatively, you can call the low-level functions to read and process - * the data directly... look at the process_cmd() and process_input() - * implementations in the glue to see how to do this. - * - * See the sample named "native-activity" that comes with the NDK with a - * full usage example. Also look at the JavaDoc of NativeActivity. - */ - -/** - * Data associated with an ALooper fd that will be returned as the "outData" - * when that source has data ready. - */ -struct android_poll_source { - // The identifier of this source. May be LOOPER_ID_MAIN or - // LOOPER_ID_INPUT. - int32_t id; - - // The android_app this ident is associated with. - struct android_app* app; - - // Function to call to perform the standard processing of data from - // this source. - void (*process)(struct android_app* app, struct android_poll_source* source); -}; - -/** - * This is the interface for the standard glue code of a threaded - * application. In this model, the application's code is running - * in its own thread separate from the main thread of the process. - * It is not required that this thread be associated with the Java - * VM, although it will need to be in order to make JNI calls any - * Java objects. - */ -struct android_app { - // The application can place a pointer to its own state object - // here if it likes. - void* userData; - - // Fill this in with the function to process main app commands (APP_CMD_*) - void (*onAppCmd)(struct android_app* app, int32_t cmd); - - // Fill this in with the function to process input events. At this point - // the event has already been pre-dispatched, and it will be finished upon - // return. Return 1 if you have handled the event, 0 for any default - // dispatching. - int32_t (*onInputEvent)(struct android_app* app, AInputEvent* event); - - // The ANativeActivity object instance that this app is running in. - ANativeActivity* activity; - - // The current configuration the app is running in. - AConfiguration* config; - - // This is the last instance's saved state, as provided at creation time. - // It is NULL if there was no state. You can use this as you need; the - // memory will remain around until you call android_app_exec_cmd() for - // APP_CMD_RESUME, at which point it will be freed and savedState set to NULL. - // These variables should only be changed when processing a APP_CMD_SAVE_STATE, - // at which point they will be initialized to NULL and you can malloc your - // state and place the information here. In that case the memory will be - // freed for you later. - void* savedState; - size_t savedStateSize; - - // The ALooper associated with the app's thread. - ALooper* looper; - - // When non-NULL, this is the input queue from which the app will - // receive user input events. - AInputQueue* inputQueue; - - // When non-NULL, this is the window surface that the app can draw in. - ANativeWindow* window; - - // Current content rectangle of the window; this is the area where the - // window's content should be placed to be seen by the user. - ARect contentRect; - - // Current state of the app's activity. May be either APP_CMD_START, - // APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP; see below. - int activityState; - - // This is non-zero when the application's NativeActivity is being - // destroyed and waiting for the app thread to complete. - int destroyRequested; - - // ------------------------------------------------- - // Below are "private" implementation of the glue code. - - pthread_mutex_t mutex; - pthread_cond_t cond; - - int msgread; - int msgwrite; - - pthread_t thread; - - struct android_poll_source cmdPollSource; - struct android_poll_source inputPollSource; - - int running; - int stateSaved; - int destroyed; - int redrawNeeded; - AInputQueue* pendingInputQueue; - ANativeWindow* pendingWindow; - ARect pendingContentRect; -}; - -enum { - /** - * Looper data ID of commands coming from the app's main thread, which - * is returned as an identifier from ALooper_pollOnce(). The data for this - * identifier is a pointer to an android_poll_source structure. - * These can be retrieved and processed with android_app_read_cmd() - * and android_app_exec_cmd(). - */ - LOOPER_ID_MAIN = 1, - - /** - * Looper data ID of events coming from the AInputQueue of the - * application's window, which is returned as an identifier from - * ALooper_pollOnce(). The data for this identifier is a pointer to an - * android_poll_source structure. These can be read via the inputQueue - * object of android_app. - */ - LOOPER_ID_INPUT = 2, - - /** - * Start of user-defined ALooper identifiers. - */ - LOOPER_ID_USER = 3, -}; - -enum { - /** - * Command from main thread: the AInputQueue has changed. Upon processing - * this command, android_app->inputQueue will be updated to the new queue - * (or NULL). - */ - APP_CMD_INPUT_CHANGED, - - /** - * Command from main thread: a new ANativeWindow is ready for use. Upon - * receiving this command, android_app->window will contain the new window - * surface. - */ - APP_CMD_INIT_WINDOW, - - /** - * Command from main thread: the existing ANativeWindow needs to be - * terminated. Upon receiving this command, android_app->window still - * contains the existing window; after calling android_app_exec_cmd - * it will be set to NULL. - */ - APP_CMD_TERM_WINDOW, - - /** - * Command from main thread: the current ANativeWindow has been resized. - * Please redraw with its new size. - */ - APP_CMD_WINDOW_RESIZED, - - /** - * Command from main thread: the system needs that the current ANativeWindow - * be redrawn. You should redraw the window before handing this to - * android_app_exec_cmd() in order to avoid transient drawing glitches. - */ - APP_CMD_WINDOW_REDRAW_NEEDED, - - /** - * Command from main thread: the content area of the window has changed, - * such as from the soft input window being shown or hidden. You can - * find the new content rect in android_app::contentRect. - */ - APP_CMD_CONTENT_RECT_CHANGED, - - /** - * Command from main thread: the app's activity window has gained - * input focus. - */ - APP_CMD_GAINED_FOCUS, - - /** - * Command from main thread: the app's activity window has lost - * input focus. - */ - APP_CMD_LOST_FOCUS, - - /** - * Command from main thread: the current device configuration has changed. - */ - APP_CMD_CONFIG_CHANGED, - - /** - * Command from main thread: the system is running low on memory. - * Try to reduce your memory use. - */ - APP_CMD_LOW_MEMORY, - - /** - * Command from main thread: the app's activity has been started. - */ - APP_CMD_START, - - /** - * Command from main thread: the app's activity has been resumed. - */ - APP_CMD_RESUME, - - /** - * Command from main thread: the app should generate a new saved state - * for itself, to restore from later if needed. If you have saved state, - * allocate it with malloc and place it in android_app.savedState with - * the size in android_app.savedStateSize. The will be freed for you - * later. - */ - APP_CMD_SAVE_STATE, - - /** - * Command from main thread: the app's activity has been paused. - */ - APP_CMD_PAUSE, - - /** - * Command from main thread: the app's activity has been stopped. - */ - APP_CMD_STOP, - - /** - * Command from main thread: the app's activity is being destroyed, - * and waiting for the app thread to clean up and exit before proceeding. - */ - APP_CMD_DESTROY, -}; - -/** - * Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next - * app command message. - */ -int8_t android_app_read_cmd(struct android_app* android_app); - -/** - * Call with the command returned by android_app_read_cmd() to do the - * initial pre-processing of the given command. You can perform your own - * actions for the command after calling this function. - */ -void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd); - -/** - * Call with the command returned by android_app_read_cmd() to do the - * final post-processing of the given command. You must have done your own - * actions for the command before calling this function. - */ -void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd); - -/** - * Dummy function you can call to ensure glue code isn't stripped. - */ -void app_dummy(); - -/** - * This is the function that application code must implement, representing - * the main entry to the app. - */ -extern void android_main(struct android_app* app); - -#ifdef __cplusplus -} -#endif - -#endif /* _ANDROID_NATIVE_APP_GLUE_H */ diff --git a/sal/inc/osl/detail/android_native_app_glue.h b/sal/inc/osl/detail/android_native_app_glue.h new file mode 100644 index 000000000000..1b8c1f10725d --- /dev/null +++ b/sal/inc/osl/detail/android_native_app_glue.h @@ -0,0 +1,349 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef _ANDROID_NATIVE_APP_GLUE_H +#define _ANDROID_NATIVE_APP_GLUE_H + +#include +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The native activity interface provided by + * is based on a set of application-provided callbacks that will be called + * by the Activity's main thread when certain events occur. + * + * This means that each one of this callbacks _should_ _not_ block, or they + * risk having the system force-close the application. This programming + * model is direct, lightweight, but constraining. + * + * The 'threaded_native_app' static library is used to provide a different + * execution model where the application can implement its own main event + * loop in a different thread instead. Here's how it works: + * + * 1/ The application must provide a function named "android_main()" that + * will be called when the activity is created, in a new thread that is + * distinct from the activity's main thread. + * + * 2/ android_main() receives a pointer to a valid "android_app" structure + * that contains references to other important objects, e.g. the + * ANativeActivity obejct instance the application is running in. + * + * 3/ the "android_app" object holds an ALooper instance that already + * listens to two important things: + * + * - activity lifecycle events (e.g. "pause", "resume"). See APP_CMD_XXX + * declarations below. + * + * - input events coming from the AInputQueue attached to the activity. + * + * Each of these correspond to an ALooper identifier returned by + * ALooper_pollOnce with values of LOOPER_ID_MAIN and LOOPER_ID_INPUT, + * respectively. + * + * Your application can use the same ALooper to listen to additional + * file-descriptors. They can either be callback based, or with return + * identifiers starting with LOOPER_ID_USER. + * + * 4/ Whenever you receive a LOOPER_ID_MAIN or LOOPER_ID_INPUT event, + * the returned data will point to an android_poll_source structure. You + * can call the process() function on it, and fill in android_app->onAppCmd + * and android_app->onInputEvent to be called for your own processing + * of the event. + * + * Alternatively, you can call the low-level functions to read and process + * the data directly... look at the process_cmd() and process_input() + * implementations in the glue to see how to do this. + * + * See the sample named "native-activity" that comes with the NDK with a + * full usage example. Also look at the JavaDoc of NativeActivity. + */ + +struct android_app; + +/** + * Data associated with an ALooper fd that will be returned as the "outData" + * when that source has data ready. + */ +struct android_poll_source { + // The identifier of this source. May be LOOPER_ID_MAIN or + // LOOPER_ID_INPUT. + int32_t id; + + // The android_app this ident is associated with. + struct android_app* app; + + // Function to call to perform the standard processing of data from + // this source. + void (*process)(struct android_app* app, struct android_poll_source* source); +}; + +/** + * This is the interface for the standard glue code of a threaded + * application. In this model, the application's code is running + * in its own thread separate from the main thread of the process. + * It is not required that this thread be associated with the Java + * VM, although it will need to be in order to make JNI calls any + * Java objects. + */ +struct android_app { + // The application can place a pointer to its own state object + // here if it likes. + void* userData; + + // Fill this in with the function to process main app commands (APP_CMD_*) + void (*onAppCmd)(struct android_app* app, int32_t cmd); + + // Fill this in with the function to process input events. At this point + // the event has already been pre-dispatched, and it will be finished upon + // return. Return 1 if you have handled the event, 0 for any default + // dispatching. + int32_t (*onInputEvent)(struct android_app* app, AInputEvent* event); + + // The ANativeActivity object instance that this app is running in. + ANativeActivity* activity; + + // The current configuration the app is running in. + AConfiguration* config; + + // This is the last instance's saved state, as provided at creation time. + // It is NULL if there was no state. You can use this as you need; the + // memory will remain around until you call android_app_exec_cmd() for + // APP_CMD_RESUME, at which point it will be freed and savedState set to NULL. + // These variables should only be changed when processing a APP_CMD_SAVE_STATE, + // at which point they will be initialized to NULL and you can malloc your + // state and place the information here. In that case the memory will be + // freed for you later. + void* savedState; + size_t savedStateSize; + + // The ALooper associated with the app's thread. + ALooper* looper; + + // When non-NULL, this is the input queue from which the app will + // receive user input events. + AInputQueue* inputQueue; + + // When non-NULL, this is the window surface that the app can draw in. + ANativeWindow* window; + + // Current content rectangle of the window; this is the area where the + // window's content should be placed to be seen by the user. + ARect contentRect; + + // Current state of the app's activity. May be either APP_CMD_START, + // APP_CMD_RESUME, APP_CMD_PAUSE, or APP_CMD_STOP; see below. + int activityState; + + // This is non-zero when the application's NativeActivity is being + // destroyed and waiting for the app thread to complete. + int destroyRequested; + + // ------------------------------------------------- + // Below are "private" implementation of the glue code. + + pthread_mutex_t mutex; + pthread_cond_t cond; + + int msgread; + int msgwrite; + + pthread_t thread; + + struct android_poll_source cmdPollSource; + struct android_poll_source inputPollSource; + + int running; + int stateSaved; + int destroyed; + int redrawNeeded; + AInputQueue* pendingInputQueue; + ANativeWindow* pendingWindow; + ARect pendingContentRect; +}; + +enum { + /** + * Looper data ID of commands coming from the app's main thread, which + * is returned as an identifier from ALooper_pollOnce(). The data for this + * identifier is a pointer to an android_poll_source structure. + * These can be retrieved and processed with android_app_read_cmd() + * and android_app_exec_cmd(). + */ + LOOPER_ID_MAIN = 1, + + /** + * Looper data ID of events coming from the AInputQueue of the + * application's window, which is returned as an identifier from + * ALooper_pollOnce(). The data for this identifier is a pointer to an + * android_poll_source structure. These can be read via the inputQueue + * object of android_app. + */ + LOOPER_ID_INPUT = 2, + + /** + * Start of user-defined ALooper identifiers. + */ + LOOPER_ID_USER = 3, +}; + +enum { + /** + * Command from main thread: the AInputQueue has changed. Upon processing + * this command, android_app->inputQueue will be updated to the new queue + * (or NULL). + */ + APP_CMD_INPUT_CHANGED, + + /** + * Command from main thread: a new ANativeWindow is ready for use. Upon + * receiving this command, android_app->window will contain the new window + * surface. + */ + APP_CMD_INIT_WINDOW, + + /** + * Command from main thread: the existing ANativeWindow needs to be + * terminated. Upon receiving this command, android_app->window still + * contains the existing window; after calling android_app_exec_cmd + * it will be set to NULL. + */ + APP_CMD_TERM_WINDOW, + + /** + * Command from main thread: the current ANativeWindow has been resized. + * Please redraw with its new size. + */ + APP_CMD_WINDOW_RESIZED, + + /** + * Command from main thread: the system needs that the current ANativeWindow + * be redrawn. You should redraw the window before handing this to + * android_app_exec_cmd() in order to avoid transient drawing glitches. + */ + APP_CMD_WINDOW_REDRAW_NEEDED, + + /** + * Command from main thread: the content area of the window has changed, + * such as from the soft input window being shown or hidden. You can + * find the new content rect in android_app::contentRect. + */ + APP_CMD_CONTENT_RECT_CHANGED, + + /** + * Command from main thread: the app's activity window has gained + * input focus. + */ + APP_CMD_GAINED_FOCUS, + + /** + * Command from main thread: the app's activity window has lost + * input focus. + */ + APP_CMD_LOST_FOCUS, + + /** + * Command from main thread: the current device configuration has changed. + */ + APP_CMD_CONFIG_CHANGED, + + /** + * Command from main thread: the system is running low on memory. + * Try to reduce your memory use. + */ + APP_CMD_LOW_MEMORY, + + /** + * Command from main thread: the app's activity has been started. + */ + APP_CMD_START, + + /** + * Command from main thread: the app's activity has been resumed. + */ + APP_CMD_RESUME, + + /** + * Command from main thread: the app should generate a new saved state + * for itself, to restore from later if needed. If you have saved state, + * allocate it with malloc and place it in android_app.savedState with + * the size in android_app.savedStateSize. The will be freed for you + * later. + */ + APP_CMD_SAVE_STATE, + + /** + * Command from main thread: the app's activity has been paused. + */ + APP_CMD_PAUSE, + + /** + * Command from main thread: the app's activity has been stopped. + */ + APP_CMD_STOP, + + /** + * Command from main thread: the app's activity is being destroyed, + * and waiting for the app thread to clean up and exit before proceeding. + */ + APP_CMD_DESTROY, +}; + +/** + * Call when ALooper_pollAll() returns LOOPER_ID_MAIN, reading the next + * app command message. + */ +int8_t android_app_read_cmd(struct android_app* android_app); + +/** + * Call with the command returned by android_app_read_cmd() to do the + * initial pre-processing of the given command. You can perform your own + * actions for the command after calling this function. + */ +void android_app_pre_exec_cmd(struct android_app* android_app, int8_t cmd); + +/** + * Call with the command returned by android_app_read_cmd() to do the + * final post-processing of the given command. You must have done your own + * actions for the command before calling this function. + */ +void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd); + +/** + * Dummy function you can call to ensure glue code isn't stripped. + */ +void app_dummy(); + +/** + * This is the function that application code must implement, representing + * the main entry to the app. + */ +extern void android_main(struct android_app* app); + +#ifdef __cplusplus +} +#endif + +#endif /* _ANDROID_NATIVE_APP_GLUE_H */ diff --git a/solenv/inc/unxandr/lo-bootstrap.h b/solenv/inc/unxandr/lo-bootstrap.h index 48b1a5c57e72..d78d88beaaab 100644 --- a/solenv/inc/unxandr/lo-bootstrap.h +++ b/solenv/inc/unxandr/lo-bootstrap.h @@ -66,6 +66,8 @@ int lo_dlcall_argc_argv(void *function, JavaVM *lo_get_javavm(void); +struct android_app *lo_get_app(void); + #ifdef __cplusplus } #endif diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index aba4b0b3ca65..e6df7fb2a8e0 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -33,7 +33,8 @@ #include #include #include -#include +#include +#include #include static rtl::OString MotionEdgeFlagsToString(int32_t nFlags) @@ -72,7 +73,7 @@ extern "C" { void onAppCmd_cb (struct android_app* app, int32_t cmd) { fprintf (stderr, "app cmd for app %p, cmd %d\n", app, cmd); - ANativeWindow *pWindow = global_android_app->window; + ANativeWindow *pWindow = app->window; switch (cmd) { case APP_CMD_INIT_WINDOW: { @@ -117,7 +118,7 @@ extern "C" { case APP_CMD_CONTENT_RECT_CHANGED: { - ARect aRect = global_android_app->contentRect; + ARect aRect = app->contentRect; fprintf (stderr, "content rect changed [ k/b popped up etc. ] %d,%d->%d,%d\n", aRect.left, aRect.top, aRect.right, aRect.bottom); break; @@ -168,17 +169,18 @@ extern "C" { AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) { + app = lo_get_app(); fprintf (stderr, "created Android Sal Instance for app %p window %p\n", - global_android_app, - global_android_app ? global_android_app->window : NULL); - if (global_android_app) + app, + app ? app->window : NULL); + if (app) { - pthread_mutex_lock (&global_android_app->mutex); - global_android_app->onAppCmd = onAppCmd_cb; - global_android_app->onInputEvent = onInputEvent_cb; - if (global_android_app->window != NULL) - onAppCmd_cb (global_android_app, APP_CMD_INIT_WINDOW); - pthread_mutex_unlock (&global_android_app->mutex); + pthread_mutex_lock (&app->mutex); + app->onAppCmd = onAppCmd_cb; + app->onInputEvent = onInputEvent_cb; + if (app->window != NULL) + onAppCmd_cb (app, APP_CMD_INIT_WINDOW); + pthread_mutex_unlock (&app->mutex); } } @@ -190,8 +192,8 @@ AndroidSalInstance::~AndroidSalInstance() void AndroidSalInstance::Wakeup() { fprintf (stderr, "Wakeup alooper\n"); - if (global_android_app && global_android_app->looper) - ALooper_wake (global_android_app->looper); + if (app && app->looper) + ALooper_wake (app->looper); else fprintf (stderr, "busted - no global looper\n"); } @@ -200,7 +202,6 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) { // release yield mutex sal_uLong nAcquireCount = ReleaseYieldMutex(); - struct android_app *pApp = global_android_app; fprintf (stderr, "DoReleaseYield #2 %d ms\n", nTimeoutMS); void *outData = NULL; @@ -214,9 +215,9 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) // FIXME: this is more or less deranged: why can we not // set a callback in the native app glue's ALooper_addFd ? if (nRet == LOOPER_ID_MAIN) - pApp->cmdPollSource.process(pApp, &pApp->cmdPollSource); + app->cmdPollSource.process(app, &app->cmdPollSource); if (nRet == LOOPER_ID_INPUT) - pApp->inputPollSource.process(pApp, &pApp->inputPollSource); + app->inputPollSource.process(app, &app->inputPollSource); } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) @@ -224,7 +225,7 @@ bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) (void) nType; // FIXME: ideally we should check the input queue to avoid being busy ... fprintf (stderr, "FIXME: AnyInput returns true\n"); - // global_android_app->inputQueue ? ... + // app->inputQueue ? ... return true; } diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index a5c69b0f419a..3b026b0d9357 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -45,6 +45,7 @@ public: virtual bool AnyInput( sal_uInt16 nType ); protected: virtual void DoReleaseYield( int nTimeoutMS ); + struct android_app *app; }; #endif // ANDROID_SALINST_H -- cgit From a6c5b24b0cb5fe42f4109a92a5a6bdc7eb03cfad Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 20:34:55 +0000 Subject: WaE: unwind possible undefined warnings --- sal/Library_lo-bootstrap.mk | 5 +++++ sal/android/lo-bootstrap.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sal/Library_lo-bootstrap.mk b/sal/Library_lo-bootstrap.mk index 995f2077c562..6d6c0d0a7022 100644 --- a/sal/Library_lo-bootstrap.mk +++ b/sal/Library_lo-bootstrap.mk @@ -37,4 +37,9 @@ $(eval $(call gb_Library_add_cobjects,lo-bootstrap,\ sal/android/lo-bootstrap \ )) +$(eval $(call gb_Library_set_include,lo-bootstrap,\ + $$(INCLUDE) \ + -I$(realpath $(SRCDIR)/sal/inc) \ +)) + # vim: set noet sw=4 ts=4: diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 3cb8d3a25300..55bc643f38ab 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -641,7 +641,8 @@ lo_dlneeds(const char *library) int i, fd; int n_needed; char **result; - char *shstrtab, *dynstr; + char *shstrtab; + char *dynstr = NULL; Elf32_Ehdr hdr; Elf32_Shdr shdr; Elf32_Dyn dyn; @@ -767,7 +768,8 @@ lo_dlneeds(const char *library) } close(fd); - free(dynstr); + if (dynstr) + free(dynstr); free(shstrtab); result[n_needed] = NULL; return result; @@ -1402,7 +1404,7 @@ extract_files(const char *prefix) apkentry = lo_apkentry(filename, &size); if (apkentry == NULL) { - LOGE("extract_files: Could not find %s in .apk", newfilename); + LOGE("extract_files: Could not find %s in .apk", filename); free(filename); continue; } -- cgit From b3904a718bbf278034afb231df3473e7138b05ac Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 21:07:24 +0000 Subject: android: move event handling to members of SalInstance rename app -> mpApp and initial handling of frames, we will need a mini window-manager in here, most likely. --- vcl/android/androidinst.cxx | 161 +++++++++++++++++++++++++++++--------------- 1 file changed, 108 insertions(+), 53 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index e6df7fb2a8e0..b4ea9e0dd84d 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -30,13 +30,19 @@ #include #include #include -#include #include -#include #include #include #include +class AndroidSalData : public SalGenericData +{ +public: + AndroidSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_ANDROID, pInstance ) {} + virtual void ErrorTrapPush() {} + virtual bool ErrorTrapPop( bool ) { return false; } +}; + static rtl::OString MotionEdgeFlagsToString(int32_t nFlags) { rtl::OStringBuffer aStr; @@ -67,13 +73,62 @@ static rtl::OString KeyMetaStateToString(int32_t nFlags) return aStr.makeStringAndClear(); } -int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); +static void BlitFrameRegionToWindow(ANativeWindow *pWindow, + const basebmp::BitmapDeviceSharedPtr& /* aDev */, + const ARect &aSrcRect, + int nDestX, int nDestY) +{ + fprintf (stderr, "Blit frame src %d,%d->%d,%d to positoon %d, %d\n", + aSrcRect.left, aSrcRect.top, aSrcRect.right, aSrcRect.bottom, + nDestX, nDestY); +#if 1 + ARect aRect; + ANativeWindow_Buffer aBuffer; + memset ((void *)&aBuffer, 0, sizeof (aBuffer)); + int32_t nRet = ANativeWindow_lock(pWindow, &aBuffer, &aRect); + fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " + "buffer: %dx%d stride %d, format %d, bits %p\n", + nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, + aBuffer.width, aBuffer.height, aBuffer.stride, + aBuffer.format, aBuffer.bits); + if (aBuffer.bits) + { + // hard-code / guess at a format ... + int32_t *p = (int32_t *)aBuffer.bits; + for (int32_t y = 0; y < aBuffer.height; y++) + { + for (int32_t x = 0; x < aBuffer.stride / 4; x++) + *p++ = (y << 24) + x; + } + } + ANativeWindow_unlockAndPost(pWindow); + fprintf (stderr, "done render!\n"); +#endif -extern "C" { - void onAppCmd_cb (struct android_app* app, int32_t cmd) +} + +void AndroidSalInstance::BlitFrameToWindow(ANativeWindow *pWindow, + const basebmp::BitmapDeviceSharedPtr& aDev) +{ + basegfx::B2IVector aDevSize = aDev->getSize(); + ARect aWhole = { 0, 0, aDevSize.getX(), aDevSize.getY() }; + BlitFrameRegionToWindow(pWindow, aDev, aWhole, 0, 0); +} + +void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) +{ + std::list< SalFrame* >::const_iterator it; + for ( it = getFrames().begin(); it != getFrames().end(); it++ ) { + SvpSalFrame *pFrame = static_cast(*it); + BlitFrameToWindow (pWindow, pFrame->getDevice()); + } +} + +void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) +{ fprintf (stderr, "app cmd for app %p, cmd %d\n", app, cmd); - ANativeWindow *pWindow = app->window; + ANativeWindow *pWindow = mpApp->window; switch (cmd) { case APP_CMD_INIT_WINDOW: { @@ -83,26 +138,8 @@ extern "C" { fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - ANativeWindow_Buffer aBuffer; - memset ((void *)&aBuffer, 0, sizeof (aBuffer)); - int32_t nRet = ANativeWindow_lock(pWindow, &aBuffer, &aRect); - fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " - "buffer: %dx%d stride %d, format %d, bits %p\n", - nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, - aBuffer.width, aBuffer.height, aBuffer.stride, - aBuffer.format, aBuffer.bits); - if (aBuffer.bits) - { - // hard-code / guess at a format ... - int32_t *p = (int32_t *)aBuffer.bits; - for (int32_t y = 0; y < aBuffer.height; y++) - { - for (int32_t x = 0; x < aBuffer.stride / 4; x++) - *p++ = (y << 24) + x; - } - } - ANativeWindow_unlockAndPost(pWindow); - fprintf (stderr, "done render!\n"); + + RedrawWindows(pWindow); break; } case APP_CMD_WINDOW_RESIZED: @@ -113,12 +150,19 @@ extern "C" { fprintf (stderr, "app window resized to ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); + RedrawWindows(pWindow); + break; + } + + case APP_CMD_WINDOW_REDRAW_NEEDED: + { + RedrawWindows(pWindow); break; } case APP_CMD_CONTENT_RECT_CHANGED: { - ARect aRect = app->contentRect; + ARect aRect = mpApp->contentRect; fprintf (stderr, "content rect changed [ k/b popped up etc. ] %d,%d->%d,%d\n", aRect.left, aRect.top, aRect.right, aRect.bottom); break; @@ -127,10 +171,10 @@ extern "C" { fprintf (stderr, "unhandled app cmd %d\n", cmd); break; } - } +} - int32_t onInputEvent_cb (struct android_app* app, AInputEvent* event) - { +int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* event) +{ fprintf (stderr, "input event for app %p, event %p type %d source %d device id %d\n", app, event, AInputEvent_getType(event), @@ -163,24 +207,43 @@ extern "C" { event, AInputEvent_getType(event)); } return 1; // handled 0 for not ... +} + +AndroidSalInstance *AndroidSalInstance::getInstance() +{ + AndroidSalData *pData = static_cast(ImplGetSVData()->mpSalData); + if (!pData) + return NULL; + return static_cast(pData->m_pInstance); +} + +extern "C" { + void onAppCmd_cb (struct android_app* app, int32_t cmd) + { + AndroidSalInstance::getInstance()->onAppCmd(app, cmd); + } + + int32_t onInputEvent_cb (struct android_app* app, AInputEvent* event) + { + return AndroidSalInstance::getInstance()->onInputEvent(app, event); } } AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) { - app = lo_get_app(); + mpApp = lo_get_app(); fprintf (stderr, "created Android Sal Instance for app %p window %p\n", - app, - app ? app->window : NULL); - if (app) + mpApp, + mpApp ? mpApp->window : NULL); + if (mpApp) { - pthread_mutex_lock (&app->mutex); - app->onAppCmd = onAppCmd_cb; - app->onInputEvent = onInputEvent_cb; - if (app->window != NULL) - onAppCmd_cb (app, APP_CMD_INIT_WINDOW); - pthread_mutex_unlock (&app->mutex); + pthread_mutex_lock (&mpApp->mutex); + mpApp->onAppCmd = onAppCmd_cb; + mpApp->onInputEvent = onInputEvent_cb; + if (mpApp->window != NULL) + onAppCmd_cb (mpApp, APP_CMD_INIT_WINDOW); + pthread_mutex_unlock (&mpApp->mutex); } } @@ -192,8 +255,8 @@ AndroidSalInstance::~AndroidSalInstance() void AndroidSalInstance::Wakeup() { fprintf (stderr, "Wakeup alooper\n"); - if (app && app->looper) - ALooper_wake (app->looper); + if (mpApp && mpApp->looper) + ALooper_wake (mpApp->looper); else fprintf (stderr, "busted - no global looper\n"); } @@ -215,9 +278,9 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) // FIXME: this is more or less deranged: why can we not // set a callback in the native app glue's ALooper_addFd ? if (nRet == LOOPER_ID_MAIN) - app->cmdPollSource.process(app, &app->cmdPollSource); + mpApp->cmdPollSource.process(mpApp, &mpApp->cmdPollSource); if (nRet == LOOPER_ID_INPUT) - app->inputPollSource.process(app, &app->inputPollSource); + mpApp->inputPollSource.process(mpApp, &mpApp->inputPollSource); } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) @@ -225,7 +288,7 @@ bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) (void) nType; // FIXME: ideally we should check the input queue to avoid being busy ... fprintf (stderr, "FIXME: AnyInput returns true\n"); - // app->inputQueue ? ... + // mpApp->inputQueue ? ... return true; } @@ -251,14 +314,6 @@ SalSystem *AndroidSalInstance::CreateSalSystem() return new AndroidSalSystem(); } -class AndroidSalData : public SalGenericData -{ -public: - AndroidSalData( SalInstance *pInstance ) : SalGenericData( SAL_DATA_ANDROID, pInstance ) {} - virtual void ErrorTrapPush() {} - virtual bool ErrorTrapPop( bool ) { return false; } -}; - // All the interesting stuff is slaved from the AndroidSalInstance void InitSalData() {} void DeInitSalData() {} -- cgit From 32af4e15048e53b223294ad33ac428f992bfd0eb Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 21:13:36 +0000 Subject: android: missing header pieces --- vcl/inc/android/androidinst.hxx | 13 ++++++++++++- vcl/inc/headless/svpframe.hxx | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index 3b026b0d9357..aec273553df9 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -30,22 +30,33 @@ #ifndef ANDROID_SALINST_H #define ANDROID_SALINST_H +#include +#include #include +#include class AndroidSalInstance : public SvpSalInstance { + void RedrawWindows(ANativeWindow *pWindow); + void BlitFrameToWindow(ANativeWindow *pWindow, + const basebmp::BitmapDeviceSharedPtr& aDev); public: AndroidSalInstance( SalYieldMutex *pMutex ); virtual ~AndroidSalInstance(); + static AndroidSalInstance *getInstance(); virtual SalSystem* CreateSalSystem(); // mainloop pieces virtual void Wakeup(); virtual bool AnyInput( sal_uInt16 nType ); + + // incoming android event handlers: + void onAppCmd (struct android_app* app, int32_t cmd); + int32_t onInputEvent (struct android_app* app, AInputEvent* event); protected: virtual void DoReleaseYield( int nTimeoutMS ); - struct android_app *app; + struct android_app *mpApp; }; #endif // ANDROID_SALINST_H diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 5f88e64df3e1..37e0ae98b95d 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -41,9 +41,9 @@ class SvpSalGraphics; class SvpSalFrame : public SalFrame, public SvpElement { SvpSalInstance* m_pInstance; - SvpSalFrame* m_pParent; // pointer to parent frame + SvpSalFrame* m_pParent; // pointer to parent frame std::list< SvpSalFrame* > m_aChildren; // List of child frames - sal_uLong m_nStyle; + sal_uLong m_nStyle; bool m_bVisible; long m_nMinWidth; long m_nMinHeight; -- cgit From 0def387f351b7e67c2f45474105333c4cb4f55dc Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 22:09:39 +0000 Subject: android: add first cut of frame contents blitting, and error dialog --- vcl/android/androidinst.cxx | 103 ++++++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 27 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index b4ea9e0dd84d..4772a74a306d 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -74,44 +74,70 @@ static rtl::OString KeyMetaStateToString(int32_t nFlags) } static void BlitFrameRegionToWindow(ANativeWindow *pWindow, - const basebmp::BitmapDeviceSharedPtr& /* aDev */, - const ARect &aSrcRect, + const basebmp::BitmapDeviceSharedPtr& aDev, + const ARect &rSrcRect, int nDestX, int nDestY) { - fprintf (stderr, "Blit frame src %d,%d->%d,%d to positoon %d, %d\n", - aSrcRect.left, aSrcRect.top, aSrcRect.right, aSrcRect.bottom, + fprintf (stderr, "Blit frame src %d,%d->%d,%d to position %d, %d\n", + rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom, nDestX, nDestY); -#if 1 ARect aRect; - ANativeWindow_Buffer aBuffer; - memset ((void *)&aBuffer, 0, sizeof (aBuffer)); - int32_t nRet = ANativeWindow_lock(pWindow, &aBuffer, &aRect); + ANativeWindow_Buffer aOutBuffer; + memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); + int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " "buffer: %dx%d stride %d, format %d, bits %p\n", nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, - aBuffer.width, aBuffer.height, aBuffer.stride, - aBuffer.format, aBuffer.bits); - if (aBuffer.bits) + aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride, + aOutBuffer.format, aOutBuffer.bits); + if (aOutBuffer.bits == NULL) { - // hard-code / guess at a format ... - int32_t *p = (int32_t *)aBuffer.bits; - for (int32_t y = 0; y < aBuffer.height; y++) + fprintf (stderr, "no buffer for locked window\n"); + ANativeWindow_unlockAndPost(pWindow); + return; + } + + // FIXME: do some cropping goodness on aSrcRect to ensure no overflows etc. + ARect aSrcRect = rSrcRect; + sal_Int32 nStride = aDev->getScanlineStride(); + basebmp::RawMemorySharedArray aSrcData = aDev->getBuffer(); + unsigned char *pSrc = aSrcData.get(); + + for (unsigned int y = 0; y < (unsigned int)(aSrcRect.bottom - aSrcRect.top); y++) + { + unsigned char *sp = ( pSrc + nStride * (y + aSrcRect.top) + + aSrcRect.left * 3 /* src pixel size */ ); + unsigned char *dp = ( (unsigned char *)aOutBuffer.bits + + aOutBuffer.stride * (y + nDestY) + + nDestX * 4 /* dest pixel size */ ); + for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) { - for (int32_t x = 0; x < aBuffer.stride / 4; x++) - *p++ = (y << 24) + x; + dp[x*4 + 0] = sp[x*3 + 0]; // B + dp[x*4 + 1] = sp[x*3 + 1]; // G + dp[x*4 + 2] = sp[x*3 + 2]; // R + dp[x*4 + 3] = 255; // A } } - ANativeWindow_unlockAndPost(pWindow); - fprintf (stderr, "done render!\n"); + fprintf (stderr, "done blit!\n"); +#if 0 + // hard-code / guess at a format ... + int32_t *p = (int32_t *)aBuffer.bits; + for (int32_t y = 0; y < aBuffer.height; y++) + { + for (int32_t x = 0; x < aBuffer.stride / 4; x++) + *p++ = (y << 24) + x; + } #endif + ANativeWindow_unlockAndPost(pWindow); + fprintf (stderr, "done render!\n"); } void AndroidSalInstance::BlitFrameToWindow(ANativeWindow *pWindow, const basebmp::BitmapDeviceSharedPtr& aDev) { basegfx::B2IVector aDevSize = aDev->getSize(); - ARect aWhole = { 0, 0, aDevSize.getX(), aDevSize.getY() }; + ARect aWhole = { 0, 0, 400, 400 }; // FIXME: aDevSize.getX(), aDevSize.getY() }; BlitFrameRegionToWindow(pWindow, aDev, aWhole, 0, 0); } @@ -211,6 +237,8 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* AndroidSalInstance *AndroidSalInstance::getInstance() { + if (!ImplGetSVData()) + return NULL; AndroidSalData *pData = static_cast(ImplGetSVData()->mpSalData); if (!pData) return NULL; @@ -299,14 +327,7 @@ public: virtual int ShowNativeDialog( const rtl::OUString& rTitle, const rtl::OUString& rMessage, const std::list< rtl::OUString >& rButtons, - int nDefButton ) - { - (void)rButtons; (void)nDefButton; - __android_log_print(ANDROID_LOG_INFO, "LibreOffice - dialog '%s': '%s'", - rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(), - rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr()); - return 0; - } + int nDefButton ); }; SalSystem *AndroidSalInstance::CreateSalSystem() @@ -355,6 +376,7 @@ SalData::~SalData() // This is our main entry point: SalInstance *CreateSalInstance() { + fprintf (stderr, "Android: CreateSalInstance!\n"); AndroidSalInstance* pInstance = new AndroidSalInstance( new SalYieldMutex() ); new AndroidSalData( pInstance ); return pInstance; @@ -366,4 +388,31 @@ void DestroySalInstance( SalInstance *pInst ) delete pInst; } +#include + +int AndroidSalSystem::ShowNativeDialog( const rtl::OUString& rTitle, + const rtl::OUString& rMessage, + const std::list< rtl::OUString >& rButtons, + int nDefButton ) +{ + (void)rButtons; (void)nDefButton; + fprintf (stderr, "LibreOffice native dialog '%s': '%s'\n", + rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(), + rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr()); + __android_log_print(ANDROID_LOG_INFO, "LibreOffice - dialog '%s': '%s'", + rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(), + rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr()); + + if (AndroidSalInstance::getInstance() != NULL) + { + // Does Android have a native dialog ? if not,. we have to do this ... + ErrorBox aVclErrBox( NULL, WB_OK, rTitle ); + aVclErrBox.SetText( rMessage ); + aVclErrBox.Execute(); + } + else + fprintf (stderr, "VCL not initialized\n"); + return 0; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit From 0f32f98564f8e0e66bc2d2ee5c55406930007044 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 25 Jan 2012 22:41:41 +0000 Subject: android: add missing deployment component --- android/qa/desktop/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 1dd0d83797c4..876c4325578b 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -109,6 +109,7 @@ copy-stuff: buildrcs bootstrap.uno \ comphelpgcc3 \ configmgr.uno \ + deployment \ deploymentmisclo \ fileacc \ fontconfig \ -- cgit From 7c4c1832ccd4830f903d7d647466f96aa6755711 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 26 Jan 2012 10:29:38 +0000 Subject: android: move lo-bootstrap to osl/detail, Attach threads as created --- .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 2 +- sal/Package_inc.mk | 1 + sal/android/lo-bootstrap.c | 2 +- sal/inc/osl/detail/android-bootstrap.h | 80 ++++++++++++++++++++++ sal/osl/unx/file.cxx | 2 +- sal/osl/unx/file_misc.cxx | 4 +- sal/osl/unx/module.c | 2 +- sal/osl/unx/process_impl.cxx | 2 +- sal/osl/unx/thread.c | 18 +++++ sal/osl/unx/uunxapi.cxx | 2 +- solenv/inc/unxandr/lo-bootstrap.h | 77 --------------------- vcl/android/androidinst.cxx | 26 ++++--- vcl/inc/android/androidinst.hxx | 1 + 13 files changed, 126 insertions(+), 93 deletions(-) create mode 100644 sal/inc/osl/detail/android-bootstrap.h delete mode 100644 solenv/inc/unxandr/lo-bootstrap.h diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index a8d82581d16e..f28882186ba9 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -65,7 +65,7 @@ #include "diagnostics.h" #ifdef ANDROID -#include +#include #endif #if defined HAVE_VALGRIND_H diff --git a/sal/Package_inc.mk b/sal/Package_inc.mk index e43de3e46388..304ab9d68797 100644 --- a/sal/Package_inc.mk +++ b/sal/Package_inc.mk @@ -65,6 +65,7 @@ $(eval $(call gb_Package_add_file,sal_inc,inc/osl/time.h,osl/time.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/util.h,osl/util.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/file.h,osl/detail/file.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android_native_app_glue.h,osl/detail/android_native_app_glue.h)) +$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android-bootstrap.h,osl/detail/android-bootstrap.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/allocator.hxx,rtl/allocator.hxx)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/alloc.h,rtl/alloc.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/bootstrap.h,rtl/bootstrap.h)) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 55bc643f38ab..98db089c2d7d 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -48,7 +48,7 @@ #include "uthash.h" -#include "lo-bootstrap.h" +#include "osl/detail/android-bootstrap.h" #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" diff --git a/sal/inc/osl/detail/android-bootstrap.h b/sal/inc/osl/detail/android-bootstrap.h new file mode 100644 index 000000000000..65396873ac93 --- /dev/null +++ b/sal/inc/osl/detail/android-bootstrap.h @@ -0,0 +1,80 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http: *www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2011 Tor Lillqvist (initial developer) + * Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef ANDROID_BOOSTRAP_H +#define ANDROID_BOOSTRAP_H +#if defined(ANDROID) + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lo_apk_dir lo_apk_dir; + +char **lo_dlneeds(const char *library); + +void *lo_dlopen(const char *library); + +void *lo_dlsym(void *handle, + const char *symbol); + +int lo_dladdr(void *addr, + Dl_info *info); + +void *lo_apkentry(const char *filename, + size_t *size); + +lo_apk_dir *lo_apk_opendir(const char *dirname); + +struct dirent *lo_apk_readdir(lo_apk_dir *dirp); + +int lo_apk_closedir(lo_apk_dir *dirp); + +int lo_apk_lstat(const char *path, struct stat *statp); + +int lo_dlcall_argc_argv(void *function, + int argc, + const char **argv); + +JavaVM *lo_get_javavm(void); + +struct android_app *lo_get_app(void); + +#ifdef __cplusplus +} +#endif + +#endif // ANDROID +#endif // ANDROID_BOOTSTRAP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 63e9775fa25e..b8a851f5a84d 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -59,7 +59,7 @@ #endif /* MACOSX */ #ifdef ANDROID -#include +#include #endif #ifdef DEBUG_OSL_FILE diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 260b711ee1da..962d7bf3701a 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -55,7 +55,7 @@ #include #ifdef ANDROID -#include +#include #endif /************************************************************************ @@ -774,7 +774,7 @@ static oslFileError osl_psz_removeFile( const sal_Char* pszPath ) int nRet=0; struct stat aStat; - nRet = lstat(pszPath,&aStat); + nRet = lstat_c(pszPath,&aStat); if ( nRet < 0 ) { nRet=errno; diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 2889a7723a91..792f0cd81207 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -44,7 +44,7 @@ #endif #ifdef ANDROID -#include +#include #endif /* implemented in file.c */ diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 83c5c8872dbe..d90fdea310ff 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -60,7 +60,7 @@ #include "uunxapi.h" #ifdef ANDROID -#include +#include #endif /*************************************** diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 4128d08f0d63..59a0514b322b 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -37,6 +37,10 @@ #include #include #include +#ifdef ANDROID +#include +#include +#endif #if defined LINUX && ! defined __FreeBSD_kernel__ #include @@ -288,8 +292,22 @@ static void* osl_thread_start_Impl (void* pData) if (!terminate) { +#ifdef ANDROID + { + JNIEnv* env = 0; + int res = (*lo_get_javavm())->AttachCurrentThread(lo_get_javavm(), &env, NULL); // res == 0 + fprintf (stderr, "new sal thread started and attached %d!\n", res); + } +#endif /* call worker function */ pImpl->m_WorkerFunction(pImpl->m_pData); + +#ifdef ANDROID + { + int res = (*lo_get_javavm())->DetachCurrentThread(lo_get_javavm()); + fprintf (stderr, "detached finished sal thread %d!\n", res); + } +#endif } /* call cleanup handler and leave */ diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 8abe57f3b2f7..270f5c33513a 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -48,7 +48,7 @@ #endif #ifdef ANDROID - #include + #include #endif //########################### diff --git a/solenv/inc/unxandr/lo-bootstrap.h b/solenv/inc/unxandr/lo-bootstrap.h deleted file mode 100644 index d78d88beaaab..000000000000 --- a/solenv/inc/unxandr/lo-bootstrap.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http: *www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2011 Tor Lillqvist (initial developer) - * Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer) - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#if defined(ANDROID) - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct lo_apk_dir lo_apk_dir; - -char **lo_dlneeds(const char *library); - -void *lo_dlopen(const char *library); - -void *lo_dlsym(void *handle, - const char *symbol); - -int lo_dladdr(void *addr, - Dl_info *info); - -void *lo_apkentry(const char *filename, - size_t *size); - -lo_apk_dir *lo_apk_opendir(const char *dirname); - -struct dirent *lo_apk_readdir(lo_apk_dir *dirp); - -int lo_apk_closedir(lo_apk_dir *dirp); - -int lo_apk_lstat(const char *path, struct stat *statp); - -int lo_dlcall_argc_argv(void *function, - int argc, - const char **argv); - -JavaVM *lo_get_javavm(void); - -struct android_app *lo_get_app(void); - -#ifdef __cplusplus -} -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 4772a74a306d..d867fa817e19 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -29,9 +29,10 @@ #include #include #include +#include #include #include -#include +#include #include #include @@ -78,12 +79,13 @@ static void BlitFrameRegionToWindow(ANativeWindow *pWindow, const ARect &rSrcRect, int nDestX, int nDestY) { - fprintf (stderr, "Blit frame src %d,%d->%d,%d to position %d, %d\n", + fprintf (stderr, "Blit frame #2 src %d,%d->%d,%d to position %d, %d\n", rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom, nDestX, nDestY); ARect aRect; ANativeWindow_Buffer aOutBuffer; memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); + fprintf (stderr, "pre lock\n"); int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " "buffer: %dx%d stride %d, format %d, bits %p\n", @@ -110,6 +112,7 @@ static void BlitFrameRegionToWindow(ANativeWindow *pWindow, unsigned char *dp = ( (unsigned char *)aOutBuffer.bits + aOutBuffer.stride * (y + nDestY) + nDestX * 4 /* dest pixel size */ ); + fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) { dp[x*4 + 0] = sp[x*3 + 0]; // B @@ -164,8 +167,7 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - - RedrawWindows(pWindow); + mbQueueReDraw = true; break; } case APP_CMD_WINDOW_RESIZED: @@ -176,13 +178,13 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "app window resized to ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - RedrawWindows(pWindow); + mbQueueReDraw = true; break; } case APP_CMD_WINDOW_REDRAW_NEEDED: { - RedrawWindows(pWindow); + mbQueueReDraw = true; break; } @@ -259,6 +261,8 @@ extern "C" { AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) + , mpApp( NULL ) + , mbQueueReDraw( false ) { mpApp = lo_get_app(); fprintf (stderr, "created Android Sal Instance for app %p window %p\n", @@ -297,8 +301,12 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) fprintf (stderr, "DoReleaseYield #2 %d ms\n", nTimeoutMS); void *outData = NULL; int outFd = 0, outEvents = 0; + + if (mbQueueReDraw) + nTimeoutMS = 0; + int nRet = ALooper_pollAll(nTimeoutMS, &outFd, &outEvents, &outData); - fprintf (stderr, "ret %d %d %d %p\n", nRet, outFd, outEvents, outData); + fprintf (stderr, "ret #3 %d %d %d %p\n", nRet, outFd, outEvents, outData); // acquire yield mutex again AcquireYieldMutex(nAcquireCount); @@ -307,8 +315,10 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) // set a callback in the native app glue's ALooper_addFd ? if (nRet == LOOPER_ID_MAIN) mpApp->cmdPollSource.process(mpApp, &mpApp->cmdPollSource); - if (nRet == LOOPER_ID_INPUT) + else if (nRet == LOOPER_ID_INPUT) mpApp->inputPollSource.process(mpApp, &mpApp->inputPollSource); + else if (mbQueueReDraw) + RedrawWindows (mpApp->window); } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index aec273553df9..e39f1478c4bc 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -57,6 +57,7 @@ public: protected: virtual void DoReleaseYield( int nTimeoutMS ); struct android_app *mpApp; + bool mbQueueReDraw; }; #endif // ANDROID_SALINST_H -- cgit From 85f0cd34dbfc0dcc81da5ac0a046812673b40bb6 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 26 Jan 2012 12:42:29 +0200 Subject: Move the sleep earlier, and log it --- sal/android/lo-bootstrap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 98db089c2d7d..59960b31e1c6 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -1482,9 +1482,15 @@ __attribute__ ((visibility("default"))) void android_main(struct android_app* state) { + JNIEnv *env; struct engine engine; Dl_info lo_main_info; + if (sleep_time != 0) { + LOGI("android_main: Sleeping for %d seconds, start ndk-gdb NOW if that is your intention", sleep_time); + sleep(sleep_time); + } + app = state; memset(&engine, 0, sizeof(engine)); @@ -1495,9 +1501,6 @@ android_main(struct android_app* state) lo_main_argv[0] = lo_main_info.dli_fname; } - if (sleep_time != 0) - sleep(sleep_time); - patch_libgnustl_shared(); extract_files(UNPACK_TREE); -- cgit From 052fe1a7700e834d9363be6da88d3fea71e879c3 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 26 Jan 2012 12:45:42 +0200 Subject: Call the JavaVM's AttachCurrentThread(), can't hurt... --- sal/android/lo-bootstrap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 59960b31e1c6..9c2c3da8de15 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -1491,6 +1491,8 @@ android_main(struct android_app* state) sleep(sleep_time); } + (*(*state->activity->vm)->AttachCurrentThread)(state->activity->vm, &env, 0); + app = state; memset(&engine, 0, sizeof(engine)); -- cgit From 0c2de3df0982b0c77987c640a9af38d310325a55 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 26 Jan 2012 14:36:25 +0000 Subject: android: get at least something onto the screen --- vcl/android/androidinst.cxx | 17 +++++++++++------ vcl/inc/android/androidinst.hxx | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index d867fa817e19..d8ba0b050c47 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -152,6 +152,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) SvpSalFrame *pFrame = static_cast(*it); BlitFrameToWindow (pWindow, pFrame->getDevice()); } + mbQueueReDraw = false; } void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) @@ -167,7 +168,6 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - mbQueueReDraw = true; break; } case APP_CMD_WINDOW_RESIZED: @@ -178,12 +178,12 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "app window resized to ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); - mbQueueReDraw = true; break; } case APP_CMD_WINDOW_REDRAW_NEEDED: { + fprintf (stderr, "redraw needed\n"); mbQueueReDraw = true; break; } @@ -248,15 +248,21 @@ AndroidSalInstance *AndroidSalInstance::getInstance() } extern "C" { - void onAppCmd_cb (struct android_app* app, int32_t cmd) + void onAppCmd_cb (struct android_app *app, int32_t cmd) { AndroidSalInstance::getInstance()->onAppCmd(app, cmd); } - int32_t onInputEvent_cb (struct android_app* app, AInputEvent* event) + int32_t onInputEvent_cb (struct android_app *app, AInputEvent *event) { return AndroidSalInstance::getInstance()->onInputEvent(app, event); } + void onNativeWindowRedrawNeeded_cb(ANativeActivity * /* activity */, + ANativeWindow *pWindow) + { + fprintf (stderr, "onNativeWindowRedrawNeeded_cb\n"); + AndroidSalInstance::getInstance()->RedrawWindows (pWindow); + } } AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) @@ -275,6 +281,7 @@ AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) mpApp->onInputEvent = onInputEvent_cb; if (mpApp->window != NULL) onAppCmd_cb (mpApp, APP_CMD_INIT_WINDOW); + mpApp->activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded_cb; pthread_mutex_unlock (&mpApp->mutex); } } @@ -317,8 +324,6 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) mpApp->cmdPollSource.process(mpApp, &mpApp->cmdPollSource); else if (nRet == LOOPER_ID_INPUT) mpApp->inputPollSource.process(mpApp, &mpApp->inputPollSource); - else if (mbQueueReDraw) - RedrawWindows (mpApp->window); } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index e39f1478c4bc..8efb96383faa 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -37,7 +37,6 @@ class AndroidSalInstance : public SvpSalInstance { - void RedrawWindows(ANativeWindow *pWindow); void BlitFrameToWindow(ANativeWindow *pWindow, const basebmp::BitmapDeviceSharedPtr& aDev); public: @@ -54,6 +53,7 @@ public: // incoming android event handlers: void onAppCmd (struct android_app* app, int32_t cmd); int32_t onInputEvent (struct android_app* app, AInputEvent* event); + void RedrawWindows(ANativeWindow *pWindow); protected: virtual void DoReleaseYield( int nTimeoutMS ); struct android_app *mpApp; -- cgit From 612fc199c3884b48770740acf8b441f3506b47e1 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 26 Jan 2012 17:45:00 +0200 Subject: Include the separate tag argument in the __android_log_print() calls It's the *third* argument that is the printf-style format string. --- vcl/android/androidinst.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index d8ba0b050c47..82356033e48b 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -363,7 +363,7 @@ void SalAbort( const rtl::OUString& rErrorText, bool bDumpCore ) aError = rtl::OUString::createFromAscii("Unknown application error"); ::fprintf( stderr, "%s\n", rtl::OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() ); - __android_log_print(ANDROID_LOG_INFO, "SalAbort: '%s'", + __android_log_print(ANDROID_LOG_INFO, "LibreOffice", "SalAbort: '%s'", rtl::OUStringToOString(aError, RTL_TEXTENCODING_ASCII_US).getStr()); if( bDumpCore ) abort(); @@ -414,7 +414,7 @@ int AndroidSalSystem::ShowNativeDialog( const rtl::OUString& rTitle, fprintf (stderr, "LibreOffice native dialog '%s': '%s'\n", rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(), rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr()); - __android_log_print(ANDROID_LOG_INFO, "LibreOffice - dialog '%s': '%s'", + __android_log_print(ANDROID_LOG_INFO, "LibreOffice", "Dialog '%s': '%s'", rtl::OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(), rtl::OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr()); -- cgit From d044d38d32e86fae0184890e19de3dbcb2ab477d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 26 Jan 2012 18:10:25 +0200 Subject: Add reply to question in comment;) --- vcl/android/androidinst.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 82356033e48b..9791dbfcf255 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -421,6 +421,13 @@ int AndroidSalSystem::ShowNativeDialog( const rtl::OUString& rTitle, if (AndroidSalInstance::getInstance() != NULL) { // Does Android have a native dialog ? if not,. we have to do this ... + + // Of course it has. android.app.AlertDialog seems like a good + // choice, it even has one, two or three buttons. Naturally, + // it intended to be used from Java, so some verbose JNI + // horror would be needed to use it directly here. Probably we + // want some easier to use magic wrapper, hmm. + ErrorBox aVclErrBox( NULL, WB_OK, rTitle ); aVclErrBox.SetText( rMessage ); aVclErrBox.Execute(); -- cgit From 04fbc6be65cce5f91f753eabb1a74877a2e6ebf8 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 26 Jan 2012 21:25:06 +0200 Subject: Use lo-bootstrap as the log tag --- sal/android/android_native_app_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sal/android/android_native_app_glue.c b/sal/android/android_native_app_glue.c index cf5d8e8575fd..cacc3bb5879a 100644 --- a/sal/android/android_native_app_glue.c +++ b/sal/android/android_native_app_glue.c @@ -25,7 +25,7 @@ #include "osl/detail/android_native_app_glue.h" #include -#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "threaded_app", __VA_ARGS__)) +#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "lo-bootstrap", __VA_ARGS__)) static void free_saved_state(struct android_app* android_app) { pthread_mutex_lock(&android_app->mutex); -- cgit From d396ec82510f8a871d9d7310a4ce53180278fa37 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 26 Jan 2012 21:32:48 +0200 Subject: Add APP_CMD_FOO symbolic printout --- vcl/android/androidinst.cxx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 9791dbfcf255..5adc35755e64 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -155,9 +155,35 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) mbQueueReDraw = false; } +static const char *app_cmd_name(int cmd) +{ + switch (cmd) { + case APP_CMD_INPUT_CHANGED: return "INPUT_CHANGED"; + case APP_CMD_INIT_WINDOW: return "INIT_WINDOW"; + case APP_CMD_TERM_WINDOW: return "TERM_WINDOW"; + case APP_CMD_WINDOW_RESIZED: return "WINDOW_RESIZED"; + case APP_CMD_WINDOW_REDRAW_NEEDED: return "WINDOW_REDRAW_NEEDED"; + case APP_CMD_CONTENT_RECT_CHANGED: return "CONTENT_RECT_CHANGED"; + case APP_CMD_GAINED_FOCUS: return "GAINED_FOCUS"; + case APP_CMD_LOST_FOCUS: return "LOST_FOCUS"; + case APP_CMD_CONFIG_CHANGED: return "CONFIG_CHANGED"; + case APP_CMD_LOW_MEMORY: return "LOW_MEMORY"; + case APP_CMD_START: return "START"; + case APP_CMD_RESUME: return "RESUME"; + case APP_CMD_SAVE_STATE: return "SAVE_STATE"; + case APP_CMD_PAUSE: return "PAUSE"; + case APP_CMD_STOP: return "STOP"; + case APP_CMD_DESTROY: return "DESTROY"; + default: + static char buf[10]; + sprintf(buf, "%d", cmd); + return buf; + } +} + void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) { - fprintf (stderr, "app cmd for app %p, cmd %d\n", app, cmd); + fprintf (stderr, "app cmd for app %p: %s\n", app, app_cmd_name(cmd)); ANativeWindow *pWindow = mpApp->window; switch (cmd) { case APP_CMD_INIT_WINDOW: -- cgit From 76bdcb53a57234cbd2d05acc557935e8175c7884 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 27 Jan 2012 14:48:55 +0000 Subject: android: push the redraw-needed command into the app thread & wait --- sal/android/android_native_app_glue.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sal/android/android_native_app_glue.c b/sal/android/android_native_app_glue.c index cacc3bb5879a..c01db3b46e71 100644 --- a/sal/android/android_native_app_glue.c +++ b/sal/android/android_native_app_glue.c @@ -22,6 +22,7 @@ #include #include +#include "osl/detail/android-bootstrap.h" #include "osl/detail/android_native_app_glue.h" #include @@ -143,6 +144,12 @@ void android_app_post_exec_cmd(struct android_app* android_app, int8_t cmd) { pthread_cond_broadcast(&android_app->cond); pthread_mutex_unlock(&android_app->mutex); break; + case APP_CMD_WINDOW_REDRAW_NEEDED: + LOGI("APP_CMD_WINDOW_REDRAW_NEEDED - post\n"); + pthread_mutex_lock(&android_app->mutex); + pthread_cond_broadcast(&android_app->cond); + pthread_mutex_unlock(&android_app->mutex); + break; case APP_CMD_SAVE_STATE: LOGI("APP_CMD_SAVE_STATE\n"); @@ -303,6 +310,17 @@ static void android_app_set_window(struct android_app* android_app, ANativeWindo pthread_mutex_unlock(&android_app->mutex); } +static void android_app_window_redraw_needed(struct android_app* android_app, ANativeWindow* window) { + pthread_mutex_lock(&android_app->mutex); + if (window != NULL) { + android_app_write_cmd(android_app, APP_CMD_WINDOW_REDRAW_NEEDED); + } + while (android_app->window != android_app->pendingWindow) { + pthread_cond_wait(&android_app->cond, &android_app->mutex); + } + pthread_mutex_unlock(&android_app->mutex); +} + static void android_app_set_activity_state(struct android_app* android_app, int8_t cmd) { pthread_mutex_lock(&android_app->mutex); android_app_write_cmd(android_app, cmd); @@ -404,6 +422,11 @@ static void onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* wi android_app_set_window((struct android_app*)activity->instance, NULL); } +static void onNativeWindowRedrawNeeded(ANativeActivity* activity, ANativeWindow* window) { + LOGI("onNativeWindowRedrawNeeded: %p -- %p\n", activity, window); + android_app_window_redraw_needed((struct android_app*)activity->instance, window); +} + static void onInputQueueCreated(ANativeActivity* activity, AInputQueue* queue) { LOGI("InputQueueCreated: %p -- %p\n", activity, queue); android_app_set_input((struct android_app*)activity->instance, queue); @@ -428,6 +451,7 @@ __attribute__ ((visibility("default"))) void ANativeActivity_onCreate(ANativeAct activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; + activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; activity->callbacks->onInputQueueCreated = onInputQueueCreated; activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed; -- cgit From 51741668593d23a1b35beb6971e92ba648974f31 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 27 Jan 2012 14:50:21 +0000 Subject: android: attach as daemon with given JNI version, and don't exit. --- sal/android/lo-bootstrap.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 9c2c3da8de15..eee5f1f07cef 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -47,7 +47,7 @@ #include #include "uthash.h" - +#include #include "osl/detail/android-bootstrap.h" #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" @@ -1482,16 +1482,25 @@ __attribute__ ((visibility("default"))) void android_main(struct android_app* state) { - JNIEnv *env; + jint nRet; + JNIEnv *pEnv = NULL; struct engine engine; Dl_info lo_main_info; + JavaVMAttachArgs aArgs = { + JNI_VERSION_1_2, + "LibreOfficeThread", + NULL + }; + + fprintf (stderr, "android_main in thread: %d\n", (int)pthread_self()); if (sleep_time != 0) { LOGI("android_main: Sleeping for %d seconds, start ndk-gdb NOW if that is your intention", sleep_time); sleep(sleep_time); } - (*(*state->activity->vm)->AttachCurrentThread)(state->activity->vm, &env, 0); + nRet = (*(*state->activity->vm)->AttachCurrentThreadAsDaemon)(state->activity->vm, &pEnv, &aArgs); + fprintf (stderr, "attach thread returned %d %p\n", nRet, pEnv); app = state; @@ -1508,8 +1517,7 @@ android_main(struct android_app* state) extract_files(UNPACK_TREE); lo_main(lo_main_argc, lo_main_argv); - - exit(0); + fprintf (stderr, "exit android_main\n"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit From 7acf7c1fd5cddb5aa6210e178bfab924570667c7 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 27 Jan 2012 14:51:40 +0000 Subject: android: add EGL and pixel redrawing modes + start of 565 conversion --- vcl/Library_vcl.mk | 1 + vcl/android/androidinst.cxx | 226 +++++++++++++++++++++++++++++----------- vcl/inc/android/androidinst.hxx | 10 +- 3 files changed, 178 insertions(+), 59 deletions(-) diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index fa6093ee6eca..169107d8a14f 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -434,6 +434,7 @@ ifeq ($(GUIBASE),android) $(eval $(call gb_Library_add_libs,vcl,\ -llog \ -landroid \ + -lEGL -lGLESv1_CM \ -llo-bootstrap \ )) $(eval $(call gb_Library_add_defs,vcl,\ diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 5adc35755e64..f01185862a0c 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -36,6 +36,9 @@ #include #include +#undef ANDROID_EGL +#define ANDROID_PIXELS + class AndroidSalData : public SalGenericData { public: @@ -74,7 +77,7 @@ static rtl::OString KeyMetaStateToString(int32_t nFlags) return aStr.makeStringAndClear(); } -static void BlitFrameRegionToWindow(ANativeWindow *pWindow, +static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, const basebmp::BitmapDeviceSharedPtr& aDev, const ARect &rSrcRect, int nDestX, int nDestY) @@ -82,22 +85,6 @@ static void BlitFrameRegionToWindow(ANativeWindow *pWindow, fprintf (stderr, "Blit frame #2 src %d,%d->%d,%d to position %d, %d\n", rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom, nDestX, nDestY); - ARect aRect; - ANativeWindow_Buffer aOutBuffer; - memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); - fprintf (stderr, "pre lock\n"); - int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); - fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " - "buffer: %dx%d stride %d, format %d, bits %p\n", - nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, - aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride, - aOutBuffer.format, aOutBuffer.bits); - if (aOutBuffer.bits == NULL) - { - fprintf (stderr, "no buffer for locked window\n"); - ANativeWindow_unlockAndPost(pWindow); - return; - } // FIXME: do some cropping goodness on aSrcRect to ensure no overflows etc. ARect aSrcRect = rSrcRect; @@ -105,53 +92,125 @@ static void BlitFrameRegionToWindow(ANativeWindow *pWindow, basebmp::RawMemorySharedArray aSrcData = aDev->getBuffer(); unsigned char *pSrc = aSrcData.get(); + // FIXME: we have WINDOW_FORMAT_RGB_565 = 4 ... + for (unsigned int y = 0; y < (unsigned int)(aSrcRect.bottom - aSrcRect.top); y++) { unsigned char *sp = ( pSrc + nStride * (y + aSrcRect.top) + aSrcRect.left * 3 /* src pixel size */ ); - unsigned char *dp = ( (unsigned char *)aOutBuffer.bits + - aOutBuffer.stride * (y + nDestY) + - nDestX * 4 /* dest pixel size */ ); - fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); - for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) + + switch (pOutBuffer->format) { + case WINDOW_FORMAT_RGBA_8888: + case WINDOW_FORMAT_RGBX_8888: + { + unsigned char *dp = ( (unsigned char *)pOutBuffer->bits + + pOutBuffer->stride * 4 * (y + nDestY) + + nDestX * 4 /* dest pixel size */ ); + fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); + for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) + { + dp[x*4 + 0] = sp[x*3 + 0]; // B + dp[x*4 + 1] = sp[x*3 + 1]; // G + dp[x*4 + 2] = sp[x*3 + 2]; // R + dp[x*4 + 3] = 255; // A + } + break; + } + case WINDOW_FORMAT_RGB_565: { - dp[x*4 + 0] = sp[x*3 + 0]; // B - dp[x*4 + 1] = sp[x*3 + 1]; // G - dp[x*4 + 2] = sp[x*3 + 2]; // R - dp[x*4 + 3] = 255; // A + unsigned char *dp = ( (unsigned char *)pOutBuffer->bits + + pOutBuffer->stride * 2 * (y + nDestY) + + nDestX * 2 /* dest pixel size */ ); + fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); + for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) + { + unsigned char b = sp[x*3 + 0]; // B + unsigned char g = sp[x*3 + 1]; // G + unsigned char r = sp[x*3 + 2]; // R + dp[x*2 + 0] = (r & 0xf8) | (g >> 5); + dp[x*2 + 1] = ((g & 0x1c) << 5) | ((b & 0xf8) >> 3); + } + break; + } + default: + fprintf (stderr, "unknown pixel format %d !\n", pOutBuffer->format); + break; } } fprintf (stderr, "done blit!\n"); -#if 0 - // hard-code / guess at a format ... - int32_t *p = (int32_t *)aBuffer.bits; - for (int32_t y = 0; y < aBuffer.height; y++) - { - for (int32_t x = 0; x < aBuffer.stride / 4; x++) - *p++ = (y << 24) + x; - } -#endif - - ANativeWindow_unlockAndPost(pWindow); - fprintf (stderr, "done render!\n"); } -void AndroidSalInstance::BlitFrameToWindow(ANativeWindow *pWindow, +void AndroidSalInstance::BlitFrameToWindow(ANativeWindow_Buffer *pOutBuffer, const basebmp::BitmapDeviceSharedPtr& aDev) { basegfx::B2IVector aDevSize = aDev->getSize(); - ARect aWhole = { 0, 0, 400, 400 }; // FIXME: aDevSize.getX(), aDevSize.getY() }; - BlitFrameRegionToWindow(pWindow, aDev, aWhole, 0, 0); + ARect aWhole = { 0, 0, aDevSize.getX(), aDevSize.getY() }; + BlitFrameRegionToWindow(pOutBuffer, aDev, aWhole, 0, 0); } void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) { - std::list< SalFrame* >::const_iterator it; - for ( it = getFrames().begin(); it != getFrames().end(); it++ ) + (void)pWindow; +#ifdef ANDROID_PIXELS + ARect aRect; + ANativeWindow_Buffer aOutBuffer; + memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); + fprintf (stderr, "pre lock #3\n"); +#endif + +#ifdef ANDROID_EGL + if (mxDisplay == EGL_NO_DISPLAY) + { + fprintf (stderr, "wait for the setup\n"); + return; + } + + EGLBoolean nRet = eglMakeCurrent(mxDisplay, mxSurface, mxSurface, mxContext); + fprintf (stderr, "make current context %d\n", nRet); + + // Just fill the screen with a color. + static int a = 0; + a++; + glClearColor((a & 0x1) ? 1.0 : 0.0, (a & 0x2) ? 1.0 : 0.0, 0.0, 1); + glClear(GL_COLOR_BUFFER_BIT); + + eglSwapBuffers(mxDisplay, mxSurface); +#endif // ANDROID_EGL + +#ifdef ANDROID_PIXELS + int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); + fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " + "buffer: %dx%d stride %d, format %d, bits %p\n", + nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, + aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride, + aOutBuffer.format, aOutBuffer.bits); + +#if 1 // pre-'clean' the buffer with cruft: + // hard-code / guess at a format ... + int32_t *p = (int32_t *)aOutBuffer.bits; + for (int32_t y = 0; y < aOutBuffer.height; y++) { - SvpSalFrame *pFrame = static_cast(*it); - BlitFrameToWindow (pWindow, pFrame->getDevice()); + for (int32_t x = 0; x < aOutBuffer.stride / 2; x++) + *p++ = (y << 24) + x; } +#endif + + if (aOutBuffer.bits != NULL) + { + std::list< SalFrame* >::const_iterator it; + for ( it = getFrames().begin(); it != getFrames().end(); it++ ) + { + SvpSalFrame *pFrame = static_cast(*it); + BlitFrameToWindow (&aOutBuffer, pFrame->getDevice()); + } + } + else + fprintf (stderr, "no buffer for locked window\n"); + + ANativeWindow_unlockAndPost(pWindow); + fprintf (stderr, "done render!\n"); +#endif // ANDROID_PIXELS + mbQueueReDraw = false; } @@ -194,6 +253,61 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); + +#ifdef ANDROID_EGL + const EGLint attribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_BLUE_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_RED_SIZE, 8, + EGL_NONE + }; + EGLint w, h, format; + EGLint numConfigs; + EGLConfig config; + EGLSurface surface; + EGLContext context; + + EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); + + eglInitialize(display, 0, 0); + + /* Here, the application chooses the configuration it desires. In this + * sample, we have a very simplified selection process, where we pick + * the first EGLConfig that matches our criteria */ + eglChooseConfig(display, attribs, &config, 1, &numConfigs); + + /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is + * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). + * As soon as we picked a EGLConfig, we can safely reconfigure the + * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */ + eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format); + + ANativeWindow_setBuffersGeometry(mpApp->window, 0, 0, format); + + surface = eglCreateWindowSurface(display, config, mpApp->window, NULL); + context = eglCreateContext(display, config, NULL, NULL); + + if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) { + fprintf(stderr, "Unable to eglMakeCurrent"); + break; + } + + eglQuerySurface(display, surface, EGL_WIDTH, &w); + eglQuerySurface(display, surface, EGL_HEIGHT, &h); + + mxDisplay = display; + mxContext = context; + mxSurface = surface; + + // Initialize GL state: + // FIXME: surely all this glContext - **per-thread** - ! + + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + glEnable(GL_CULL_FACE); + glShadeModel(GL_SMOOTH); + glDisable(GL_DEPTH_TEST); +#endif break; } case APP_CMD_WINDOW_RESIZED: @@ -210,7 +324,7 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) case APP_CMD_WINDOW_REDRAW_NEEDED: { fprintf (stderr, "redraw needed\n"); - mbQueueReDraw = true; + AndroidSalInstance::getInstance()->RedrawWindows (pWindow); break; } @@ -283,31 +397,26 @@ extern "C" { { return AndroidSalInstance::getInstance()->onInputEvent(app, event); } - void onNativeWindowRedrawNeeded_cb(ANativeActivity * /* activity */, - ANativeWindow *pWindow) - { - fprintf (stderr, "onNativeWindowRedrawNeeded_cb\n"); - AndroidSalInstance::getInstance()->RedrawWindows (pWindow); - } } AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) , mpApp( NULL ) , mbQueueReDraw( false ) + , mxDisplay( EGL_NO_DISPLAY ) + , mxSurface( EGL_NO_SURFACE ) + , mxContext( EGL_NO_CONTEXT ) { mpApp = lo_get_app(); - fprintf (stderr, "created Android Sal Instance for app %p window %p\n", + fprintf (stderr, "created Android Sal Instance for app %p window %p thread: %d\n", mpApp, - mpApp ? mpApp->window : NULL); + mpApp ? mpApp->window : NULL, + (int)pthread_self()); if (mpApp) { pthread_mutex_lock (&mpApp->mutex); mpApp->onAppCmd = onAppCmd_cb; mpApp->onInputEvent = onInputEvent_cb; - if (mpApp->window != NULL) - onAppCmd_cb (mpApp, APP_CMD_INIT_WINDOW); - mpApp->activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded_cb; pthread_mutex_unlock (&mpApp->mutex); } } @@ -331,7 +440,8 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) // release yield mutex sal_uLong nAcquireCount = ReleaseYieldMutex(); - fprintf (stderr, "DoReleaseYield #2 %d ms\n", nTimeoutMS); + fprintf (stderr, "DoReleaseYield #2 %d thread: %d ms\n", + nTimeoutMS, (int)pthread_self()); void *outData = NULL; int outFd = 0, outEvents = 0; diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index 8efb96383faa..7372f755c5e2 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -30,6 +30,9 @@ #ifndef ANDROID_SALINST_H #define ANDROID_SALINST_H +#include +#include + #include #include #include @@ -37,7 +40,7 @@ class AndroidSalInstance : public SvpSalInstance { - void BlitFrameToWindow(ANativeWindow *pWindow, + void BlitFrameToWindow(ANativeWindow_Buffer *pOutBuffer, const basebmp::BitmapDeviceSharedPtr& aDev); public: AndroidSalInstance( SalYieldMutex *pMutex ); @@ -58,6 +61,11 @@ protected: virtual void DoReleaseYield( int nTimeoutMS ); struct android_app *mpApp; bool mbQueueReDraw; + +private: + EGLDisplay mxDisplay; + EGLSurface mxSurface; + EGLContext mxContext; }; #endif // ANDROID_SALINST_H -- cgit From ab95c0753cc3693571e125742593d54185d39699 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 27 Jan 2012 16:34:46 +0000 Subject: android: un-successful attempt to use eglLockSurfaceKHR is this method even implemented for android, seems to be a no-op. --- vcl/android/androidinst.cxx | 72 ++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index f01185862a0c..e9707839d392 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -32,12 +32,14 @@ #include #include #include +#define EGL_EGLEXT_PROTOTYPES +#include #include #include #include -#undef ANDROID_EGL -#define ANDROID_PIXELS +#define ANDROID_EGL +#undef ANDROID_PIXELS class AndroidSalData : public SalGenericData { @@ -151,12 +153,8 @@ void AndroidSalInstance::BlitFrameToWindow(ANativeWindow_Buffer *pOutBuffer, void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) { (void)pWindow; -#ifdef ANDROID_PIXELS - ARect aRect; ANativeWindow_Buffer aOutBuffer; memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); - fprintf (stderr, "pre lock #3\n"); -#endif #ifdef ANDROID_EGL if (mxDisplay == EGL_NO_DISPLAY) @@ -171,32 +169,59 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) // Just fill the screen with a color. static int a = 0; a++; - glClearColor((a & 0x1) ? 1.0 : 0.0, (a & 0x2) ? 1.0 : 0.0, 0.0, 1); - glClear(GL_COLOR_BUFFER_BIT); + // glClearColor((a & 0x1) ? 1.0 : 0.0, (a & 0x2) ? 1.0 : 0.0, 0.0, 1); + // glClear(GL_COLOR_BUFFER_BIT); + + const EGLint aAttribs[] = { + EGL_MAP_PRESERVE_PIXELS_KHR, EGL_FALSE, + EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR, + EGL_NONE + }; + fprintf (stderr, "pre-egl-lock\n"); + nRet = eglLockSurfaceKHR(mxDisplay, mxSurface, aAttribs); + fprintf (stderr, "eglLockSurface %d\n", nRet); + nRet = eglQuerySurface(mxDisplay, mxSurface, + EGL_BITMAP_POINTER_KHR, (EGLint *)&aOutBuffer.bits); + fprintf (stderr, "get bytes %p : %d\n", aOutBuffer.bits, nRet); + EGLint nStride = 0; + nRet = eglQuerySurface(mxDisplay, mxSurface, + EGL_BITMAP_PITCH_KHR, &nStride); + fprintf (stderr, "get stride %ld : %d\n", (long)nStride, nRet); + + EGLint nWidth = 0, nHeight = 0; + eglQuerySurface(mxDisplay, mxSurface, EGL_WIDTH, &nWidth); + eglQuerySurface(mxDisplay, mxSurface, EGL_HEIGHT, &nHeight); + fprintf (stderr, "get width height %ld,%ld\n", (long)nWidth, (long)nHeight); + + aOutBuffer.stride = nStride / 2; // FIXME - assuming 565 + aOutBuffer.width = nWidth; + aOutBuffer.height = nHeight; - eglSwapBuffers(mxDisplay, mxSurface); #endif // ANDROID_EGL #ifdef ANDROID_PIXELS + ARect aRect; + fprintf (stderr, "pre lock #3\n"); int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " "buffer: %dx%d stride %d, format %d, bits %p\n", nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride, aOutBuffer.format, aOutBuffer.bits); +#endif // ANDROID_PIXELS -#if 1 // pre-'clean' the buffer with cruft: - // hard-code / guess at a format ... - int32_t *p = (int32_t *)aOutBuffer.bits; - for (int32_t y = 0; y < aOutBuffer.height; y++) + if (aOutBuffer.bits != NULL) { - for (int32_t x = 0; x < aOutBuffer.stride / 2; x++) - *p++ = (y << 24) + x; - } +#if 1 // pre-'clean' the buffer with cruft: + // hard-code / guess at a format ... + int32_t *p = (int32_t *)aOutBuffer.bits; + for (int32_t y = 0; y < aOutBuffer.height; y++) + { + for (int32_t x = 0; x < aOutBuffer.stride / 2; x++) + *p++ = (y << 24) + x; + } #endif - if (aOutBuffer.bits != NULL) - { std::list< SalFrame* >::const_iterator it; for ( it = getFrames().begin(); it != getFrames().end(); it++ ) { @@ -207,10 +232,17 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) else fprintf (stderr, "no buffer for locked window\n"); +#ifdef ANDROID_PIXELS ANativeWindow_unlockAndPost(pWindow); - fprintf (stderr, "done render!\n"); -#endif // ANDROID_PIXELS +#endif + +#ifdef ANDROID_EGL + nRet = eglUnlockSurfaceKHR(mxDisplay, mxSurface); + fprintf (stderr, "eGL unlock %d\n", nRet); + eglSwapBuffers(mxDisplay, mxSurface); +#endif + fprintf (stderr, "done render!\n"); mbQueueReDraw = false; } -- cgit From 9220f05f73d428a0d5415a45f786040c9ef9f74e Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 27 Jan 2012 18:07:15 +0000 Subject: android: try blitting a big texture to the screen instead; fails. --- vcl/android/androidinst.cxx | 76 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 7 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index e9707839d392..cf9314560cf1 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -39,6 +39,7 @@ #include #define ANDROID_EGL +#undef ANDROID_EGL_LOCK #undef ANDROID_PIXELS class AndroidSalData : public SalGenericData @@ -88,12 +89,68 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, rSrcRect.left, rSrcRect.top, rSrcRect.right, rSrcRect.bottom, nDestX, nDestY); - // FIXME: do some cropping goodness on aSrcRect to ensure no overflows etc. - ARect aSrcRect = rSrcRect; - sal_Int32 nStride = aDev->getScanlineStride(); basebmp::RawMemorySharedArray aSrcData = aDev->getBuffer(); + basegfx::B2IVector aDevSize = aDev->getSize(); + sal_Int32 nStride = aDev->getScanlineStride(); unsigned char *pSrc = aSrcData.get(); +#ifdef ANDROID_EGL + (void)pOutBuffer; + GLuint nTexture; + glGenTextures (1, &nTexture); + glBindTexture(GL_TEXTURE_2D,nTexture); + // Pixels to texture: + fprintf (stderr, "before create texure '%d'\n", glGetError()); + glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGB, + nStride / 3, aDevSize.getY(), + 0 /* border */, GL_RGB, GL_UNSIGNED_BYTE, + pSrc); + fprintf (stderr, "created texure '%d'\n", glGetError()); + + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); + + glEnable(GL_TEXTURE_2D); + + glDisable(GL_DEPTH_TEST); + glEnable(GL_BLEND); + glBlendFunc(GL_ZERO, GL_SRC_COLOR); + glDisable(GL_LIGHTING); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + glViewport(0, 0, aDevSize.getX(), aDevSize.getY()); + + glBindTexture(GL_TEXTURE_2D,nTexture); + + GLfloat aVertices[] = { 0, 0, + 0, aDevSize.getY(), + aDevSize.getX(), aDevSize.getY(), + aDevSize.getX(), 0 }; + glVertexPointer(2, GL_FLOAT, 0, aVertices); + fprintf (stderr, "after set vertex '%d'\n", glGetError()); + glEnableClientState(GL_VERTEX_ARRAY); + glColor4f(0.5f, 0.5f, 1.0f, 1.0f); + glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); +// glTexCoordPointer(2, GL_FLOAT, 0, aVertices); + fprintf (stderr, "after draw arrays '%d'\n", glGetError()); + +// glDisable(GL_TEXTURE_2D); + + // free the texture +// glDeleteTextures(1,&nTexture); +#endif + +#ifdef ANDROID_PIXELS + // FIXME: do some cropping goodness on aSrcRect to ensure no overflows etc. + ARect aSrcRect = rSrcRect; + // FIXME: we have WINDOW_FORMAT_RGB_565 = 4 ... for (unsigned int y = 0; y < (unsigned int)(aSrcRect.bottom - aSrcRect.top); y++) @@ -139,6 +196,7 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, break; } } +#endif // ANDROID_PIXELS fprintf (stderr, "done blit!\n"); } @@ -172,6 +230,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) // glClearColor((a & 0x1) ? 1.0 : 0.0, (a & 0x2) ? 1.0 : 0.0, 0.0, 1); // glClear(GL_COLOR_BUFFER_BIT); +#ifdef ANDROID_EGL_LOCK // failed to do anything ! const EGLint aAttribs[] = { EGL_MAP_PRESERVE_PIXELS_KHR, EGL_FALSE, EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR, @@ -196,6 +255,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) aOutBuffer.stride = nStride / 2; // FIXME - assuming 565 aOutBuffer.width = nWidth; aOutBuffer.height = nHeight; +#endif #endif // ANDROID_EGL @@ -208,10 +268,10 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride, aOutBuffer.format, aOutBuffer.bits); -#endif // ANDROID_PIXELS - if (aOutBuffer.bits != NULL) { +#endif // ANDROID_PIXELS + #if 1 // pre-'clean' the buffer with cruft: // hard-code / guess at a format ... int32_t *p = (int32_t *)aOutBuffer.bits; @@ -228,17 +288,19 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) SvpSalFrame *pFrame = static_cast(*it); BlitFrameToWindow (&aOutBuffer, pFrame->getDevice()); } + +#ifdef ANDROID_PIXELS } else fprintf (stderr, "no buffer for locked window\n"); - -#ifdef ANDROID_PIXELS ANativeWindow_unlockAndPost(pWindow); #endif #ifdef ANDROID_EGL +#ifdef ANDROID_EGL_LOCK nRet = eglUnlockSurfaceKHR(mxDisplay, mxSurface); fprintf (stderr, "eGL unlock %d\n", nRet); +#endif eglSwapBuffers(mxDisplay, mxSurface); #endif -- cgit From 0a1fb4b618ad56fe11071a60105dbf70cc38892e Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 27 Jan 2012 11:32:22 +0200 Subject: Tweak the st_mode returned by lo_apk_lstat() to match reality better --- sal/android/lo-bootstrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index eee5f1f07cef..5813138f3c81 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -1081,7 +1081,7 @@ new_stat(const char *path, struct tm tm; memset(statp, 0, sizeof(*statp)); - statp->st_mode = mode | S_IRUSR | S_IRGRP | S_IROTH; + statp->st_mode = mode | S_IRUSR; statp->st_nlink = 1; statp->st_uid = getuid(); @@ -1133,7 +1133,7 @@ lo_apk_lstat(const char *path, if (*pn == '/') { pn++; if (!pn[0]) - return new_stat(path, statp, NULL, S_IFDIR, 1); + return new_stat(path, statp, NULL, S_IFDIR | S_IXUSR, 1); } name_size = strlen(pn); @@ -1149,7 +1149,7 @@ lo_apk_lstat(const char *path, if (letoh16(entry->filename_size) == name_size) return new_stat(path, statp, entry, S_IFREG, cdir_entries - count + 1); else - return new_stat(path, statp, entry, S_IFDIR, cdir_entries - count + 1); + return new_stat(path, statp, entry, S_IFDIR | S_IXUSR, cdir_entries - count + 1); } errno = ENOENT; -- cgit From f0e5ca4d0be13e8494ad2de4c97a192537388ec5 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 27 Jan 2012 12:15:14 +0200 Subject: We don't use Library_vclplug_svp on Android any more --- vcl/Module_vcl.mk | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 47da575b960c..0a91f8795cc8 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -79,10 +79,4 @@ $(eval $(call gb_Module_add_targets,vcl,\ )) endif -ifeq ($(GUIBASE),android) -$(eval $(call gb_Module_add_targets,vcl,\ - Library_vclplug_svp \ -)) -endif - # vim: set noet sw=4 ts=4: -- cgit From 513e187c431ef1b7e0e2504263c12cc9083252d3 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 27 Jan 2012 18:35:21 +0200 Subject: Drop accidental #include --- sal/android/lo-bootstrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 5813138f3c81..b5a0a051f0e0 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -47,7 +47,7 @@ #include #include "uthash.h" -#include + #include "osl/detail/android-bootstrap.h" #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" -- cgit From f231418c5ba9bed32a4058ba0a9cdcfb16bb2ee4 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Sat, 28 Jan 2012 00:02:35 +0000 Subject: android: unwind horrific event dispatching bug causing all the grief. --- vcl/android/androidinst.cxx | 240 +++++++++--------------------------------- vcl/headless/svpframe.cxx | 3 +- vcl/headless/svpinst.cxx | 2 +- vcl/inc/headless/svpframe.hxx | 3 +- vcl/source/app/svmain.cxx | 5 + 5 files changed, 60 insertions(+), 193 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index cf9314560cf1..a12d7ac646ba 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -32,15 +32,16 @@ #include #include #include -#define EGL_EGLEXT_PROTOTYPES -#include #include #include #include -#define ANDROID_EGL -#undef ANDROID_EGL_LOCK -#undef ANDROID_PIXELS +extern void VCL_DLLPUBLIC plasma_now(const char *msg); + +void plasma_now(const char *msg) +{ + fprintf (stderr, "Skipped plasma '%s' !\n", msg); +} class AndroidSalData : public SalGenericData { @@ -94,60 +95,6 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, sal_Int32 nStride = aDev->getScanlineStride(); unsigned char *pSrc = aSrcData.get(); -#ifdef ANDROID_EGL - (void)pOutBuffer; - GLuint nTexture; - glGenTextures (1, &nTexture); - glBindTexture(GL_TEXTURE_2D,nTexture); - // Pixels to texture: - fprintf (stderr, "before create texure '%d'\n", glGetError()); - glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGB, - nStride / 3, aDevSize.getY(), - 0 /* border */, GL_RGB, GL_UNSIGNED_BYTE, - pSrc); - fprintf (stderr, "created texure '%d'\n", glGetError()); - - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); - - glEnable(GL_TEXTURE_2D); - - glDisable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glBlendFunc(GL_ZERO, GL_SRC_COLOR); - glDisable(GL_LIGHTING); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glViewport(0, 0, aDevSize.getX(), aDevSize.getY()); - - glBindTexture(GL_TEXTURE_2D,nTexture); - - GLfloat aVertices[] = { 0, 0, - 0, aDevSize.getY(), - aDevSize.getX(), aDevSize.getY(), - aDevSize.getX(), 0 }; - glVertexPointer(2, GL_FLOAT, 0, aVertices); - fprintf (stderr, "after set vertex '%d'\n", glGetError()); - glEnableClientState(GL_VERTEX_ARRAY); - glColor4f(0.5f, 0.5f, 1.0f, 1.0f); - glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); -// glTexCoordPointer(2, GL_FLOAT, 0, aVertices); - fprintf (stderr, "after draw arrays '%d'\n", glGetError()); - -// glDisable(GL_TEXTURE_2D); - - // free the texture -// glDeleteTextures(1,&nTexture); -#endif - -#ifdef ANDROID_PIXELS // FIXME: do some cropping goodness on aSrcRect to ensure no overflows etc. ARect aSrcRect = rSrcRect; @@ -165,7 +112,6 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, unsigned char *dp = ( (unsigned char *)pOutBuffer->bits + pOutBuffer->stride * 4 * (y + nDestY) + nDestX * 4 /* dest pixel size */ ); - fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) { dp[x*4 + 0] = sp[x*3 + 0]; // B @@ -180,7 +126,6 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, unsigned char *dp = ( (unsigned char *)pOutBuffer->bits + pOutBuffer->stride * 2 * (y + nDestY) + nDestX * 2 /* dest pixel size */ ); - fprintf (stderr, "y %d, sp %p dp %p\n", y, sp, dp); for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) { unsigned char b = sp[x*3 + 0]; // B @@ -196,7 +141,6 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, break; } } -#endif // ANDROID_PIXELS fprintf (stderr, "done blit!\n"); } @@ -214,63 +158,16 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) ANativeWindow_Buffer aOutBuffer; memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); -#ifdef ANDROID_EGL - if (mxDisplay == EGL_NO_DISPLAY) - { - fprintf (stderr, "wait for the setup\n"); - return; - } - - EGLBoolean nRet = eglMakeCurrent(mxDisplay, mxSurface, mxSurface, mxContext); - fprintf (stderr, "make current context %d\n", nRet); - - // Just fill the screen with a color. - static int a = 0; - a++; - // glClearColor((a & 0x1) ? 1.0 : 0.0, (a & 0x2) ? 1.0 : 0.0, 0.0, 1); - // glClear(GL_COLOR_BUFFER_BIT); - -#ifdef ANDROID_EGL_LOCK // failed to do anything ! - const EGLint aAttribs[] = { - EGL_MAP_PRESERVE_PIXELS_KHR, EGL_FALSE, - EGL_LOCK_USAGE_HINT_KHR, EGL_WRITE_SURFACE_BIT_KHR, - EGL_NONE - }; - fprintf (stderr, "pre-egl-lock\n"); - nRet = eglLockSurfaceKHR(mxDisplay, mxSurface, aAttribs); - fprintf (stderr, "eglLockSurface %d\n", nRet); - nRet = eglQuerySurface(mxDisplay, mxSurface, - EGL_BITMAP_POINTER_KHR, (EGLint *)&aOutBuffer.bits); - fprintf (stderr, "get bytes %p : %d\n", aOutBuffer.bits, nRet); - EGLint nStride = 0; - nRet = eglQuerySurface(mxDisplay, mxSurface, - EGL_BITMAP_PITCH_KHR, &nStride); - fprintf (stderr, "get stride %ld : %d\n", (long)nStride, nRet); - - EGLint nWidth = 0, nHeight = 0; - eglQuerySurface(mxDisplay, mxSurface, EGL_WIDTH, &nWidth); - eglQuerySurface(mxDisplay, mxSurface, EGL_HEIGHT, &nHeight); - fprintf (stderr, "get width height %ld,%ld\n", (long)nWidth, (long)nHeight); - - aOutBuffer.stride = nStride / 2; // FIXME - assuming 565 - aOutBuffer.width = nWidth; - aOutBuffer.height = nHeight; -#endif - -#endif // ANDROID_EGL - -#ifdef ANDROID_PIXELS - ARect aRect; +// ARect aRect; fprintf (stderr, "pre lock #3\n"); - int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, &aRect); - fprintf (stderr, "locked window %d returned rect: %d,%d->%d,%d " + int32_t nRet = ANativeWindow_lock(pWindow, &aOutBuffer, NULL); + fprintf (stderr, "locked window %d returned " // rect: %d,%d->%d,%d " "buffer: %dx%d stride %d, format %d, bits %p\n", - nRet, aRect.left, aRect.top, aRect.right, aRect.bottom, + nRet, // aRect.left, aRect.top, aRect.right, aRect.bottom, aOutBuffer.width, aOutBuffer.height, aOutBuffer.stride, aOutBuffer.format, aOutBuffer.bits); if (aOutBuffer.bits != NULL) { -#endif // ANDROID_PIXELS #if 1 // pre-'clean' the buffer with cruft: // hard-code / guess at a format ... @@ -286,26 +183,23 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) for ( it = getFrames().begin(); it != getFrames().end(); it++ ) { SvpSalFrame *pFrame = static_cast(*it); - BlitFrameToWindow (&aOutBuffer, pFrame->getDevice()); - } -#ifdef ANDROID_PIXELS + if (pFrame->IsVisible()) + { + // FIXME: force a re-draw - this appears not to happen much otherwis + pFrame->PostPaint(true); + BlitFrameToWindow (&aOutBuffer, pFrame->getDevice()); + } + else // Sucky the frame is invisible - why !? + fprintf (stderr, "invisible frame\n"); + } } else fprintf (stderr, "no buffer for locked window\n"); ANativeWindow_unlockAndPost(pWindow); -#endif - -#ifdef ANDROID_EGL -#ifdef ANDROID_EGL_LOCK - nRet = eglUnlockSurfaceKHR(mxDisplay, mxSurface); - fprintf (stderr, "eGL unlock %d\n", nRet); -#endif - eglSwapBuffers(mxDisplay, mxSurface); -#endif fprintf (stderr, "done render!\n"); - mbQueueReDraw = false; + mbQueueReDraw = true; // keep at it ! false; } static const char *app_cmd_name(int cmd) @@ -348,60 +242,6 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) pWindow, aRect.right, aRect.bottom, ANativeWindow_getFormat(pWindow)); -#ifdef ANDROID_EGL - const EGLint attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_BLUE_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_RED_SIZE, 8, - EGL_NONE - }; - EGLint w, h, format; - EGLint numConfigs; - EGLConfig config; - EGLSurface surface; - EGLContext context; - - EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - - eglInitialize(display, 0, 0); - - /* Here, the application chooses the configuration it desires. In this - * sample, we have a very simplified selection process, where we pick - * the first EGLConfig that matches our criteria */ - eglChooseConfig(display, attribs, &config, 1, &numConfigs); - - /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is - * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). - * As soon as we picked a EGLConfig, we can safely reconfigure the - * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */ - eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format); - - ANativeWindow_setBuffersGeometry(mpApp->window, 0, 0, format); - - surface = eglCreateWindowSurface(display, config, mpApp->window, NULL); - context = eglCreateContext(display, config, NULL, NULL); - - if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) { - fprintf(stderr, "Unable to eglMakeCurrent"); - break; - } - - eglQuerySurface(display, surface, EGL_WIDTH, &w); - eglQuerySurface(display, surface, EGL_HEIGHT, &h); - - mxDisplay = display; - mxContext = context; - mxSurface = surface; - - // Initialize GL state: - // FIXME: surely all this glContext - **per-thread** - ! - - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - glEnable(GL_CULL_FACE); - glShadeModel(GL_SMOOTH); - glDisable(GL_DEPTH_TEST); -#endif break; } case APP_CMD_WINDOW_RESIZED: @@ -418,7 +258,7 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) case APP_CMD_WINDOW_REDRAW_NEEDED: { fprintf (stderr, "redraw needed\n"); - AndroidSalInstance::getInstance()->RedrawWindows (pWindow); + mbQueueReDraw = true; break; } @@ -536,24 +376,43 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) fprintf (stderr, "DoReleaseYield #2 %d thread: %d ms\n", nTimeoutMS, (int)pthread_self()); - void *outData = NULL; +#ifndef PLASMA + + struct android_poll_source *pSource = NULL; int outFd = 0, outEvents = 0; if (mbQueueReDraw) nTimeoutMS = 0; - int nRet = ALooper_pollAll(nTimeoutMS, &outFd, &outEvents, &outData); - fprintf (stderr, "ret #3 %d %d %d %p\n", nRet, outFd, outEvents, outData); + int nRet; + while ((nRet = ALooper_pollAll (nTimeoutMS, &outFd, &outEvents, (void**)&pSource)) >= 0) + { + fprintf (stderr, "ret #5 %d %d %d %p\n", nRet, outFd, outEvents, pSource); + // acquire yield mutex again + AcquireYieldMutex(nAcquireCount); + + // Process this event. + if (pSource != NULL) + pSource->process(mpApp, pSource); + + nAcquireCount = ReleaseYieldMutex(); + } // acquire yield mutex again AcquireYieldMutex(nAcquireCount); - // FIXME: this is more or less deranged: why can we not - // set a callback in the native app glue's ALooper_addFd ? - if (nRet == LOOPER_ID_MAIN) - mpApp->cmdPollSource.process(mpApp, &mpApp->cmdPollSource); - else if (nRet == LOOPER_ID_INPUT) - mpApp->inputPollSource.process(mpApp, &mpApp->inputPollSource); + if (mbQueueReDraw) + AndroidSalInstance::getInstance()->RedrawWindows (mpApp->window); + +#else + static int nPlasma = 0; + char buffer[128]; + sprintf (buffer, "yield %d", nPlasma++); + plasma_now(buffer); + + // acquire yield mutex again + AcquireYieldMutex(nAcquireCount); +#endif } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) @@ -667,4 +526,5 @@ int AndroidSalSystem::ShowNativeDialog( const rtl::OUString& rTitle, return 0; } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 56869c245c8f..89744ae3679f 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -150,11 +150,12 @@ sal_Bool SvpSalFrame::PostEvent( void* pData ) return sal_True; } -void SvpSalFrame::PostPaint() const +void SvpSalFrame::PostPaint(bool bImmediate) const { if( m_bVisible ) { SalPaintEvent aPEvt(0, 0, maGeometry.nWidth, maGeometry.nHeight); + aPEvt.mbImmediateUpdate = bImmediate; CallCallback( SALEVENT_PAINT, &aPEvt ); } } diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 56ea818af6bc..e330dcbc469d 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -301,7 +301,7 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { // this would be a good time to post a paint const SvpSalFrame* pSvpFrame = static_cast(it->m_pFrame); - pSvpFrame->PostPaint(); + pSvpFrame->PostPaint(false); } } } diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 37e0ae98b95d..8de405450dbc 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -65,7 +65,7 @@ public: void GetFocus(); void LoseFocus(); - void PostPaint() const; + void PostPaint(bool bImmediate) const; // SvpElement virtual const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aFrame; } @@ -126,6 +126,7 @@ public: /*TODO: functional implementation */ virtual void SetScreenNumber( unsigned int nScreen ) { (void)nScreen; } virtual void SetApplicationID(const rtl::OUString &rApplicationID) { (void) rApplicationID; } + bool IsVisible() { return m_bVisible; } }; #endif // _SVP_SVPFRAME_HXX diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index cf98fb8a0b6a..4db7b122a292 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -155,12 +155,16 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo } +extern void VCL_DLLPUBLIC plasma_now(const char *msg); + // ======================================================================= int ImplSVMain() { // The 'real' SVMain() RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::SVMain" ); +// plasma_now("top"); - works here + ImplSVData* pSVData = ImplGetSVData(); DBG_ASSERT( pSVData->mpApp, "no instance of class Application" ); @@ -175,6 +179,7 @@ int ImplSVMain() { // Application-Main rufen pSVData->maAppData.mbInAppMain = sal_True; +// plasma_now("after vcl init"); - works here nReturn = pSVData->mpApp->Main(); pSVData->maAppData.mbInAppMain = sal_False; } -- cgit From a6e06bdbd3d22ce995c2bc8e4d2dd82a3854f1c4 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Sat, 28 Jan 2012 00:03:11 +0000 Subject: android: add debug hooks through app.cxx, comment chunks and add a dialog without the dialog, the main window never appears to get shown. --- desktop/source/app/app.cxx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 91c7531ef0e5..61018271bd5a 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -102,6 +102,8 @@ #include #endif +extern void VCL_DLLPUBLIC plasma_now(const char *msg); + #define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) #define U2S(STRING) ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8) @@ -1503,12 +1505,16 @@ int Desktop::Main() ResMgr::SetReadStringHook( ReplaceStringHookProc ); +// ::plasma_now("after desktoppy bits"); - fine to here ... + // Startup screen RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main { OpenSplashScreen" ); OpenSplashScreen(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main } OpenSplashScreen" ); SetSplashScreenProgress(10); + +// ::plasma_now("after splash open"); { UserInstall::UserInstallError instErr_fin = UserInstall::finalize(); if ( instErr_fin != UserInstall::E_None) @@ -1536,6 +1542,8 @@ int Desktop::Main() { RegisterServices( xSMgr ); +// ::plasma_now("registered services"); + SetSplashScreenProgress(25); #ifndef UNX @@ -1580,6 +1588,8 @@ int Desktop::Main() if ( !InitializeConfiguration() ) return EXIT_FAILURE; +// ::plasma_now("init configuration"); + SetSplashScreenProgress(30); // set static variable to enabled/disable crash reporter @@ -1597,6 +1607,8 @@ int Desktop::Main() String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String(); delete pLabelResMgr; +// ::plasma_now("after title string"); + #ifdef DBG_UTIL //include version ID in non product builds ::rtl::OUString aDefault(RTL_CONSTASCII_USTRINGPARAM("development")); @@ -1613,6 +1625,8 @@ int Desktop::Main() SetSplashScreenProgress(40); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" ); +// ::plasma_now("unrestricted folders"); -- got this. + // Check special env variable std::vector< String > aUnrestrictedFolders; svt::getUnrestrictedFolders( aUnrestrictedFolders ); @@ -1633,6 +1647,8 @@ int Desktop::Main() ( xSMgr->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY ); + ::plasma_now("done global event broadcaster"); + /* ensure existance of a default window that messages can be dispatched to This is for the benefit of testtool which uses PostUserEvent extensively and else can deadlock while creating this window from another tread while @@ -1640,6 +1656,7 @@ int Desktop::Main() */ Application::GetDefaultDevice(); +#ifndef ANDROID // Check if bundled or shared extensions were added /removed // and process those extensions (has to be done before checking // the extension dependencies! @@ -1657,6 +1674,7 @@ int Desktop::Main() pExecGlobals->bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); Migration::migrateSettingsIfNecessary(); +#endif // keep a language options instance... pExecGlobals->pLanguageOptions.reset( new SvtLanguageOptions(sal_True)); @@ -1668,6 +1686,8 @@ int Desktop::Main() pExecGlobals->xGlobalBroadcaster->notifyEvent(aEvent); } + ::plasma_now("invoked OnStartupApp"); + SetSplashScreenProgress(50); // Backing Component @@ -1697,6 +1717,8 @@ int Desktop::Main() aMiscOptions.SetUseSystemFileDialog( sal_False ); } + ::plasma_now("nearly there !"); + if ( !pExecGlobals->bRestartRequested ) { if ((!rCmdLineArgs.WantsToLoadDocument() && !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsQuickstart()) && @@ -1766,6 +1788,8 @@ int Desktop::Main() aOptions.SetVCLSettings(); SetSplashScreenProgress(60); + ::plasma_now("setup appearance !"); + if ( !pExecGlobals->bRestartRequested ) { Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) ); @@ -1799,6 +1823,8 @@ int Desktop::Main() // Release solar mutex just before we wait for our client to connect int nAcquireCount = Application::ReleaseSolarMutex(); + ::plasma_now("wait client connect !"); + // Post user event to startup first application component window // We have to send this OpenClients message short before execute() to // minimize the risk that this message overtakes type detection contruction!! @@ -1817,6 +1843,8 @@ int Desktop::Main() // call Application::Execute to process messages in vcl message loop RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" ); + ::plasma_now("before java foo !"); + try { // The JavaContext contains an interaction handler which is used when @@ -1832,6 +1860,15 @@ int Desktop::Main() // if this run of the office is triggered by restart, some additional actions should be done DoRestartActionsIfNecessary( !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsNoQuickstart() ); + ::plasma_now("pre hit execute!"); + + // For some reason we're not getting a desktop frame or component [odd] + ErrorBox aKickStartVCL( NULL, WB_OK, rtl::OUString::createFromAscii("Title!") ); + aKickStartVCL.SetText( rtl::OUString::createFromAscii("Foo") ); + aKickStartVCL.Execute(); + + ::plasma_now("hit execute!"); + Execute(); } } -- cgit From 4f989ddb0dc644c46dee97f4656a03fd24813d00 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 30 Jan 2012 13:52:50 +0000 Subject: android: ask for RGBA visual, and flip images the right way up. --- vcl/android/androidinst.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index a12d7ac646ba..31b1560005ac 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -102,7 +102,7 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, for (unsigned int y = 0; y < (unsigned int)(aSrcRect.bottom - aSrcRect.top); y++) { - unsigned char *sp = ( pSrc + nStride * (y + aSrcRect.top) + + unsigned char *sp = ( pSrc + nStride * (aSrcRect.bottom - aSrcRect.top - y - 1) + aSrcRect.left * 3 /* src pixel size */ ); switch (pOutBuffer->format) { @@ -238,10 +238,13 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) ARect aRect = { 0, 0, 0, 0 }; aRect.right = ANativeWindow_getWidth(pWindow); aRect.bottom = ANativeWindow_getHeight(pWindow); - fprintf (stderr, "we have an app window ! %p %dx%x (%d)\n", + int nRet = ANativeWindow_setBuffersGeometry( + pWindow, ANativeWindow_getWidth(pWindow), + ANativeWindow_getHeight(pWindow), + WINDOW_FORMAT_RGBA_8888); + fprintf (stderr, "we have an app window ! %p %dx%x (%d) set %d\n", pWindow, aRect.right, aRect.bottom, - ANativeWindow_getFormat(pWindow)); - + ANativeWindow_getFormat(pWindow), nRet); break; } case APP_CMD_WINDOW_RESIZED: -- cgit From 7c6cc25249f708805c4073399b09a17ec7ac32f7 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 30 Jan 2012 16:21:04 +0000 Subject: android: add start of keycode mapping --- vcl/android/androidinst.cxx | 214 +++++++++++++++++++++++++++++++++------- vcl/inc/android/androidinst.hxx | 7 +- 2 files changed, 183 insertions(+), 38 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 31b1560005ac..081f11ba0042 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -81,6 +81,123 @@ static rtl::OString KeyMetaStateToString(int32_t nFlags) return aStr.makeStringAndClear(); } +static sal_uInt16 KeyMetaStateToCode(AInputEvent *event) +{ + sal_uInt16 nCode = 0; + int32_t nFlags = AKeyEvent_getMetaState(event); + if (nFlags & AMETA_SHIFT_ON) + nCode |= KEY_SHIFT; + if (nFlags & AMETA_SYM_ON) + nCode |= KEY_MOD1; + if (nFlags & AMETA_ALT_ON) + nCode |= KEY_MOD2; + return nCode; +} + +static sal_uInt16 KeyToCode(AInputEvent *event) +{ + sal_uInt16 nCode = 0; + switch (AKeyEvent_getKeyCode(event)) { +#define MAP(a,b) \ + case AKEYCODE_##a: nCode = KEY_##b; break +#define MAP_SAME(a) MAP(a,a) + + MAP_SAME(HOME); + MAP_SAME(0); MAP_SAME(1); MAP_SAME(2); MAP_SAME(3); MAP_SAME(4); + MAP_SAME(5); MAP_SAME(6); MAP_SAME(7); MAP_SAME(8); MAP_SAME(9); + + MAP_SAME(A); MAP_SAME(B); MAP_SAME(C); MAP_SAME(D); + MAP_SAME(E); MAP_SAME(F); MAP_SAME(G); MAP_SAME(H); + MAP_SAME(I); MAP_SAME(J); MAP_SAME(K); MAP_SAME(L); + MAP_SAME(M); MAP_SAME(N); MAP_SAME(O); MAP_SAME(P); + MAP_SAME(Q); MAP_SAME(R); MAP_SAME(S); MAP_SAME(T); + MAP_SAME(U); MAP_SAME(V); MAP_SAME(W); MAP_SAME(X); + MAP_SAME(Y); MAP_SAME(Z); + + MAP_SAME(TAB); MAP_SAME(SPACE); MAP_SAME(COMMA); + + MAP(ENTER,RETURN); + MAP(PAGE_UP, PAGEUP); + MAP(PAGE_DOWN, PAGEDOWN); + MAP(DEL, DELETE); + MAP(PERIOD, POINT); + + case AKEYCODE_BACK: // escape ? + case AKEYCODE_UNKNOWN: + case AKEYCODE_SOFT_LEFT: + case AKEYCODE_SOFT_RIGHT: + case AKEYCODE_CALL: + case AKEYCODE_ENDCALL: + case AKEYCODE_STAR: + case AKEYCODE_POUND: + case AKEYCODE_DPAD_UP: + case AKEYCODE_DPAD_DOWN: + case AKEYCODE_DPAD_LEFT: + case AKEYCODE_DPAD_RIGHT: + case AKEYCODE_DPAD_CENTER: + case AKEYCODE_VOLUME_UP: + case AKEYCODE_VOLUME_DOWN: + case AKEYCODE_POWER: + case AKEYCODE_CAMERA: + case AKEYCODE_CLEAR: + case AKEYCODE_ALT_LEFT: + case AKEYCODE_ALT_RIGHT: + case AKEYCODE_SHIFT_LEFT: + case AKEYCODE_SHIFT_RIGHT: + case AKEYCODE_SYM: + case AKEYCODE_EXPLORER: + case AKEYCODE_ENVELOPE: + case AKEYCODE_GRAVE: + case AKEYCODE_MINUS: + case AKEYCODE_EQUALS: + case AKEYCODE_LEFT_BRACKET: + case AKEYCODE_RIGHT_BRACKET: + case AKEYCODE_BACKSLASH: + case AKEYCODE_SEMICOLON: + case AKEYCODE_APOSTROPHE: + case AKEYCODE_SLASH: + case AKEYCODE_AT: + case AKEYCODE_NUM: + case AKEYCODE_HEADSETHOOK: + case AKEYCODE_FOCUS: // not widget, but camera focus + case AKEYCODE_PLUS: + case AKEYCODE_MENU: + case AKEYCODE_NOTIFICATION: + case AKEYCODE_SEARCH: + case AKEYCODE_MEDIA_PLAY_PAUSE: + case AKEYCODE_MEDIA_STOP: + case AKEYCODE_MEDIA_NEXT: + case AKEYCODE_MEDIA_PREVIOUS: + case AKEYCODE_MEDIA_REWIND: + case AKEYCODE_MEDIA_FAST_FORWARD: + case AKEYCODE_MUTE: + case AKEYCODE_PICTSYMBOLS: + case AKEYCODE_SWITCH_CHARSET: + case AKEYCODE_BUTTON_A: + case AKEYCODE_BUTTON_B: + case AKEYCODE_BUTTON_C: + case AKEYCODE_BUTTON_X: + case AKEYCODE_BUTTON_Y: + case AKEYCODE_BUTTON_Z: + case AKEYCODE_BUTTON_L1: + case AKEYCODE_BUTTON_R1: + case AKEYCODE_BUTTON_L2: + case AKEYCODE_BUTTON_R2: + case AKEYCODE_BUTTON_THUMBL: + case AKEYCODE_BUTTON_THUMBR: + case AKEYCODE_BUTTON_START: + case AKEYCODE_BUTTON_SELECT: + case AKEYCODE_BUTTON_MODE: + fprintf (stderr, "un-mapped keycode %d\n", nCode); + nCode = 0; + break; +#undef MAP_SAME +#undef MAP + } + fprintf (stderr, "mapped %d -> %d\n", AKeyEvent_getKeyCode(event), nCode); + return nCode; +} + static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, const basebmp::BitmapDeviceSharedPtr& aDev, const ARect &rSrcRect, @@ -174,8 +291,8 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) int32_t *p = (int32_t *)aOutBuffer.bits; for (int32_t y = 0; y < aOutBuffer.height; y++) { - for (int32_t x = 0; x < aOutBuffer.stride / 2; x++) - *p++ = (y << 24) + x; + for (int32_t x = 0; x < aOutBuffer.stride; x++) + *p++ = (y << 24) + (x << 10) + 0xff ; } #endif @@ -199,7 +316,12 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) ANativeWindow_unlockAndPost(pWindow); fprintf (stderr, "done render!\n"); - mbQueueReDraw = true; // keep at it ! false; + mbQueueReDraw = false; +} + +SalFrame *AndroidSalInstance::getFocusFrame() const +{ + return !getFrames().empty() ? *getFrames().begin() : NULL; } static const char *app_cmd_name(int cmd) @@ -280,38 +402,60 @@ void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* event) { - fprintf (stderr, "input event for app %p, event %p type %d source %d device id %d\n", - app, event, - AInputEvent_getType(event), - AInputEvent_getSource(event), - AInputEvent_getDeviceId(event)); - - switch (AInputEvent_getType(event)) - { - case AINPUT_EVENT_TYPE_KEY: - { - int32_t nAction = AKeyEvent_getAction(event); - fprintf (stderr, "key event keycode %d '%s' %s\n", - AKeyEvent_getKeyCode(event), - nAction == AKEY_EVENT_ACTION_DOWN ? "down" : - nAction == AKEY_EVENT_ACTION_UP ? "up" : "multiple", - KeyMetaStateToString(AKeyEvent_getMetaState(event)).getStr()); - break; - } - case AINPUT_EVENT_TYPE_MOTION: - { - fprintf (stderr, "motion event %d %g %g %s\n", - AMotionEvent_getAction(event), - AMotionEvent_getXOffset(event), - AMotionEvent_getYOffset(event), - MotionEdgeFlagsToString(AMotionEvent_getEdgeFlags(event)).getStr()); - break; - } - default: - fprintf (stderr, "unknown event type %p %d\n", - event, AInputEvent_getType(event)); - } - return 1; // handled 0 for not ... + bool bHandled; + fprintf (stderr, "input event for app %p, event %p type %d source %d device id %d\n", + app, event, + AInputEvent_getType(event), + AInputEvent_getSource(event), + AInputEvent_getDeviceId(event)); + + switch (AInputEvent_getType(event)) + { + case AINPUT_EVENT_TYPE_KEY: + { + int32_t nAction = AKeyEvent_getAction(event); + fprintf (stderr, "key event keycode %d '%s' %s\n", + AKeyEvent_getKeyCode(event), + nAction == AKEY_EVENT_ACTION_DOWN ? "down" : + nAction == AKEY_EVENT_ACTION_UP ? "up" : "multiple", + KeyMetaStateToString(AKeyEvent_getMetaState(event)).getStr()); + + // FIXME: the whole SALEVENT_KEYMODCHANGE stuff is going to be interesting + // can we really emit that ? no input method madness required though. + sal_uInt16 nEvent; + SalKeyEvent aEvent; + int64_t nNsTime = AKeyEvent_getEventTime(event); + + nEvent = (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_UP ? + SALEVENT_KEYUP : SALEVENT_KEYINPUT); + aEvent.mnTime = nNsTime / (1000 * 1000); + aEvent.mnCode = KeyToCode(event); + aEvent.mnCode |= KeyMetaStateToCode(event); + aEvent.mnCharCode = 'a'; // the unicode of it all ... + aEvent.mnRepeat = AKeyEvent_getRepeatCount(event); + + SalFrame *pFocus = getFocusFrame(); + if (pFocus) + bHandled = pFocus->CallCallback( nEvent, &aEvent ); + else + fprintf (stderr, "no focused frame to emit event on\n"); + break; + } + case AINPUT_EVENT_TYPE_MOTION: + { + fprintf (stderr, "motion event %d %g %g %s\n", + AMotionEvent_getAction(event), + AMotionEvent_getXOffset(event), + AMotionEvent_getYOffset(event), + MotionEdgeFlagsToString(AMotionEvent_getEdgeFlags(event)).getStr()); + break; + } + default: + fprintf (stderr, "unknown input event type %p %d\n", + event, AInputEvent_getType(event)); + break; + } + return bHandled ? 1 : 0; } AndroidSalInstance *AndroidSalInstance::getInstance() diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index 7372f755c5e2..e947737a68ae 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -54,9 +54,10 @@ public: virtual bool AnyInput( sal_uInt16 nType ); // incoming android event handlers: - void onAppCmd (struct android_app* app, int32_t cmd); - int32_t onInputEvent (struct android_app* app, AInputEvent* event); - void RedrawWindows(ANativeWindow *pWindow); + void onAppCmd (struct android_app* app, int32_t cmd); + int32_t onInputEvent (struct android_app* app, AInputEvent* event); + void RedrawWindows(ANativeWindow *pWindow); + SalFrame *getFocusFrame() const; protected: virtual void DoReleaseYield( int nTimeoutMS ); struct android_app *mpApp; -- cgit From 299fa646833c1e00448a039f57510a76c6cbb250 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 13:53:12 +0200 Subject: No need to wait for debugger here on Android, this code does seem to work --- sal/osl/unx/file_misc.cxx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 962d7bf3701a..edd4eecbead6 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -1055,14 +1055,6 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD int DestFileFD=0; int nRet=0; -#ifdef ANDROID - volatile int beenhere = 0; - if (!beenhere) { - beenhere++; - fprintf(stderr, "Sleeping NOW, start ndk-gdb!\n"); - ::sleep(20); - } -#endif if (osl_openFilePath(pszSourceFileName, &SourceFileFH, osl_File_OpenFlag_Read|osl_File_OpenFlag_NoLock|osl_File_OpenFlag_NoExcl) != osl_File_E_None) -- cgit From 427edef2c780b40513af0491d5cbe865233d0650 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 13:57:11 +0200 Subject: putenv() does seem to be process-wide --- android/Bootstrap/src/org/libreoffice/android/Bootstrap.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java index 9e210565f7ca..a51315bc4abd 100644 --- a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java +++ b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java @@ -136,10 +136,7 @@ public class Bootstrap extends NativeActivity String[] argv = CommandLine.split(cmdLine); - // Handle env var assignments in the command line. Actually - // not sure if this works, are environments per-thread in - // Android? This code runs in a different thread than that in - // which lo_main etc will run. + // Handle env var assignments in the command line. while (argv.length > 0 && argv[0].matches("[A-Z_]+=.*")) { putenv(argv[0]); -- cgit From 73a47ed3750bde3de1f8abcf0005ee068b1ed96e Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 14:06:37 +0200 Subject: Set TMPDIR for osl_getTempDirURL() --- android/Bootstrap/src/org/libreoffice/android/Bootstrap.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java index a51315bc4abd..ac5d027cb52a 100644 --- a/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java +++ b/android/Bootstrap/src/org/libreoffice/android/Bootstrap.java @@ -143,6 +143,9 @@ public class Bootstrap extends NativeActivity argv = Arrays.copyOfRange(argv, 1, argv.length-1); } + // TMPDIR is used by osl_getTempDirURL() + putenv("TMPDIR=" + getCacheDir().getAbsolutePath()); + // argv[0] will be replaced by android_main() in lo-bootstrap.c by the // pathname of the mainLibrary. String[] newargv = new String[argv.length + 1]; -- cgit From 6e2e4c4c674ad2b6d1b3aa3759c7c838a0b16728 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 15:24:06 +0200 Subject: Log time taken by dlopen() --- sal/android/lo-bootstrap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index b5a0a051f0e0..b9ed8dcd01ae 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -815,6 +816,8 @@ lo_dlopen(const char *library) int i; int found; + struct timeval tv0, tv1, tvdiff; + rover = loaded_libraries; while (rover != NULL && strcmp(rover->name, library) != 0) @@ -869,8 +872,13 @@ lo_dlopen(const char *library) } free_ptrarray((void **) needed); + gettimeofday(&tv0, NULL); p = dlopen(full_name, RTLD_LOCAL); - LOGI("dlopen(%s) = %p", full_name, p); + gettimeofday(&tv1, NULL); + timersub(&tv1, &tv0, &tvdiff); + LOGI("dlopen(%s) = %p, %ld.%03lds", + full_name, p, + (long) tvdiff.tv_sec, (long) tvdiff.tv_usec / 1000); free(full_name); if (p == NULL) LOGE("lo_dlopen: Error from dlopen(%s): %s", library, dlerror()); -- cgit From 2c11a8fed62ed6b3aefc2a00cc0ae9c40e9b4a94 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 16:19:17 +0200 Subject: Add lo_dlclose() --- sal/android/lo-bootstrap.c | 13 +++++++++++++ sal/inc/osl/detail/android-bootstrap.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index b9ed8dcd01ae..1140515fb4f2 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -959,6 +959,19 @@ lo_dladdr(void *addr, return result; } +__attribute__ ((visibility("default"))) +int +lo_dlclose(void *handle) +{ + /* As we don't know when the reference count for a dlopened shared + * object drops to zero, we wouldn't know when to remove it from + * our list, so we can't call dlclose(). + */ + LOGI("lo_dlclose(%p)", handle); + + return 0; +} + __attribute__ ((visibility("default"))) void * lo_apkentry(const char *filename, diff --git a/sal/inc/osl/detail/android-bootstrap.h b/sal/inc/osl/detail/android-bootstrap.h index 65396873ac93..bd453b3475dd 100644 --- a/sal/inc/osl/detail/android-bootstrap.h +++ b/sal/inc/osl/detail/android-bootstrap.h @@ -51,6 +51,8 @@ void *lo_dlsym(void *handle, int lo_dladdr(void *addr, Dl_info *info); +int lo_dlclose(void *handle); + void *lo_apkentry(const char *filename, size_t *size); -- cgit From b8ea7cff48e4d10e51bec8f2d595323982d8f51b Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 16:20:14 +0200 Subject: Call lo_dlclose() on Android --- sal/osl/unx/module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 792f0cd81207..d600bb8c5cde 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -236,7 +236,11 @@ void SAL_CALL osl_unloadModule(oslModule hModule) if (hModule) { #ifndef NO_DL_FUNCTIONS +#ifdef ANDROID + int nRet = lo_dlclose(hModule); +#else int nRet = dlclose(hModule); +#endif #if OSL_DEBUG_LEVEL > 1 if (nRet != 0) -- cgit From 2b4ceff9384198352df8540df4835379ed8cc23c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 16:21:32 +0200 Subject: filters_test needs more libraries now when it proceeds further --- android/qa/sc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index 0412f334f6e8..84341ab24503 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -53,11 +53,13 @@ copy-stuff: # Libs and UNO components that the tests need. # for F in $(strip \ + analysislo \ basebmplo \ basegfxlo \ bootstrap.uno \ comphelpgcc3 \ configmgr.uno \ + expwrap.uno \ fileacc \ fontconfig \ forlo \ @@ -84,6 +86,7 @@ copy-stuff: mergedlo \ msfilterlo \ ooxlo \ + reflection.uno \ reg \ saxlo \ sblo \ @@ -115,6 +118,7 @@ copy-stuff: xcrlo \ xml2 \ xmlreader \ + xstor \ ); do \ $(call COPY,$(OUTDIR)/lib/lib$${F}.so); \ done -- cgit From a322022d9a73c31eb26f0752b528e9e866ce6140 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 31 Jan 2012 17:28:52 +0200 Subject: Move assertions before use --- sc/qa/unit/filters-test.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 2a0b3e2edd85..8314c8c2e28e 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -291,9 +291,11 @@ void ScFiltersTest::testRangeName() rtl::OUString aFilterType(aFileFormats[i].pTypeName, strlen(aFileFormats[i].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[i].pName << " Test" << std::endl; ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[i].nFormatType); - xDocSh->DoHardRecalc(true); CPPUNIT_ASSERT_MESSAGE("Failed to load named-ranges-globals.*", xDocSh.Is()); + + xDocSh->DoHardRecalc(true); + ScDocument* pDoc = xDocSh->GetDocument(); testRangeNameImpl(pDoc); @@ -357,9 +359,11 @@ void ScFiltersTest::testContent() rtl::OUString aFilterType(aFileFormats[i].pTypeName, strlen(aFileFormats[i].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[i].pName << " Test" << std::endl; ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[i].nFormatType); - xDocSh->DoHardRecalc(true); CPPUNIT_ASSERT_MESSAGE("Failed to load universal-content.*", xDocSh.Is()); + + xDocSh->DoHardRecalc(true); + ScDocument* pDoc = xDocSh->GetDocument(); testContentImpl(pDoc); xDocSh->DoClose(); -- cgit From 498fc0b198f81e4f2aa2e69f60b7877f6db3dd0c Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 17:22:20 +0000 Subject: android: package more components needed for writer --- android/qa/desktop/Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 876c4325578b..347524880b14 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -104,13 +104,19 @@ copy-stuff: buildrcs # Libs and UNO components that we need. # for F in $(strip \ + analysislo \ + avmedialo \ basebmplo \ basegfxlo \ bootstrap.uno \ + canvastoolslo \ comphelpgcc3 \ configmgr.uno \ + cppcanvaslo \ deployment \ deploymentmisclo \ + drawinglayerlo \ + editenglo \ fileacc \ fontconfig \ forlo \ @@ -139,6 +145,7 @@ copy-stuff: buildrcs msfilterlo \ ooxlo \ package2 \ + reflection.uno \ reg \ saxlo \ sblo \ @@ -150,6 +157,8 @@ copy-stuff: buildrcs store \ svllo \ svtlo \ + svxlo \ + svxcorelo \ test \ tklo \ tllo \ @@ -170,6 +179,11 @@ copy-stuff: buildrcs xcrlo \ xml2 \ xmlreader \ + xolo \ + xstor \ + \ + swlo \ + swdlo \ ); do \ $(call COPY,$(OUTDIR)/lib/lib$${F}.so); \ done -- cgit From 96445c9520a252fdb41c934cc77764c200c086af Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 17:30:27 +0000 Subject: android: try to get skeletal fonts into fontconfig setup --- android/qa/desktop/fonts.conf | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/android/qa/desktop/fonts.conf b/android/qa/desktop/fonts.conf index 0e92c5d78d38..64d714cf95c7 100644 --- a/android/qa/desktop/fonts.conf +++ b/android/qa/desktop/fonts.conf @@ -7,6 +7,27 @@ /system/fonts + + serif + + DroidSerif + Roboto + + + + sans-serif + + Roboto + DroidSerif + + + + monospace + + DroidSansMono + + + -- cgit From 755227bf6dd5d8061869e68f5c970780a5e3b53b Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 17:32:09 +0000 Subject: android: get non-modal message dialog up, and continue to main app execute --- desktop/source/app/app.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 61018271bd5a..966bebb5fa47 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1863,9 +1863,9 @@ int Desktop::Main() ::plasma_now("pre hit execute!"); // For some reason we're not getting a desktop frame or component [odd] - ErrorBox aKickStartVCL( NULL, WB_OK, rtl::OUString::createFromAscii("Title!") ); - aKickStartVCL.SetText( rtl::OUString::createFromAscii("Foo") ); - aKickStartVCL.Execute(); + ErrorBox aKickStartVCL( NULL, WB_OK, rtl::OUString::createFromAscii("My very own title!") ); + aKickStartVCL.SetText( rtl::OUString::createFromAscii("Delphic Utterance") ); + aKickStartVCL.Show(); // don't execute - just leave it lying around .... ::plasma_now("hit execute!"); -- cgit From 9634eec8e123c0860f2716039570dd91a9839943 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 17:33:40 +0000 Subject: android: debug / dump multi-touch events --- vcl/android/androidinst.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 081f11ba0042..02219c816cb1 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -443,11 +443,19 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* } case AINPUT_EVENT_TYPE_MOTION: { - fprintf (stderr, "motion event %d %g %g %s\n", + size_t nPoints = AMotionEvent_getPointerCount(event); + fprintf (stderr, "motion event %d %g,%g %d points: %s\n", AMotionEvent_getAction(event), AMotionEvent_getXOffset(event), AMotionEvent_getYOffset(event), + (int)nPoints, MotionEdgeFlagsToString(AMotionEvent_getEdgeFlags(event)).getStr()); + for (size_t i = 0; i < nPoints; i++) + fprintf(stderr, "\t%d: %g,%g - pressure %g\n", + (int)i, + AMotionEvent_getX(event, i), + AMotionEvent_getY(event, i), + AMotionEvent_getPressure(event, i)); break; } default: -- cgit From c2aab432b172e0d1974139e62f64e36aa3dbfb85 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 17:39:05 +0000 Subject: android: get BGR to RGB swap right in conversion --- vcl/android/androidinst.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 02219c816cb1..b20d7c4b9300 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -231,9 +231,9 @@ static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, nDestX * 4 /* dest pixel size */ ); for (unsigned int x = 0; x < (unsigned int)(aSrcRect.right - aSrcRect.left); x++) { - dp[x*4 + 0] = sp[x*3 + 0]; // B + dp[x*4 + 0] = sp[x*3 + 2]; // R dp[x*4 + 1] = sp[x*3 + 1]; // G - dp[x*4 + 2] = sp[x*3 + 2]; // R + dp[x*4 + 2] = sp[x*3 + 0]; // B dp[x*4 + 3] = 255; // A } break; -- cgit From 436e2f870144342aa6bcc28a3a5cea32680eaacf Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 19:53:49 +0000 Subject: android: undo broken AnyInput method causing app startup to fail. --- vcl/android/androidinst.cxx | 10 +++++----- vcl/inc/headless/svpframe.hxx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index b20d7c4b9300..dfb885518560 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -572,11 +572,11 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) { - (void) nType; - // FIXME: ideally we should check the input queue to avoid being busy ... - fprintf (stderr, "FIXME: AnyInput returns true\n"); - // mpApp->inputQueue ? ... - return true; + if( (nType & VCL_INPUT_TIMER) != 0 ) + return CheckTimeout( false ); + // FIXME: ideally we should check our input queue here ... + fprintf (stderr, "FIXME: AnyInput returns false\n"); + return false; } class AndroidSalSystem : public SvpSalSystem { diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 8de405450dbc..fc923af5a203 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -74,7 +74,7 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual sal_Bool PostEvent( void* pData ); + virtual sal_Bool PostEvent( void* pData ); virtual void SetTitle( const rtl::OUString& rTitle ); virtual void SetIcon( sal_uInt16 nIcon ); -- cgit From c94c9dbdcfc8435f0df61fd326dc25d39d3c44cb Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Jan 2012 22:24:08 +0000 Subject: android: package missing libraries, and shell branding - we get a shell. --- android/qa/desktop/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 347524880b14..553aefe3a676 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -113,10 +113,9 @@ copy-stuff: buildrcs comphelpgcc3 \ configmgr.uno \ cppcanvaslo \ - deployment \ - deploymentmisclo \ drawinglayerlo \ editenglo \ + expwrap.uno \ fileacc \ fontconfig \ forlo \ @@ -125,6 +124,7 @@ copy-stuff: buildrcs fwelo \ fwilo \ fwklo \ + fsstorage.uno \ gcc3_uno \ i18nisolang1gcc3 \ i18npaperlo \ @@ -187,6 +187,9 @@ copy-stuff: buildrcs ); do \ $(call COPY,$(OUTDIR)/lib/lib$${F}.so); \ done +# deployment \ +# deploymentmisclo \ + # # Then the shared GNU C++ library $(call COPY,$(ANDROID_NDK_HOME)/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so) @@ -218,6 +221,8 @@ copy-stuff: buildrcs mkdir -p assets/presets/$$D ; \ echo "content" > assets/presets/$$D/stamp; \ done +# shell / splash images + cp -r $(SRC_ROOT)/icon-themes/galaxy/brand/* assets/program # Then assets that are unpacked at run-time into the app's data directory. mkdir -p assets/unpack/etc/fonts cp fonts.conf assets/unpack/etc/fonts -- cgit From d663871cc701926a42fd3465e44fd4fc894fc30e Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 1 Feb 2012 12:16:30 +0000 Subject: android: queue redraw on keypress (for now), and get the ALooper loop right --- vcl/android/androidinst.cxx | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index dfb885518560..6d70471e035f 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -271,7 +271,9 @@ void AndroidSalInstance::BlitFrameToWindow(ANativeWindow_Buffer *pOutBuffer, void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) { - (void)pWindow; + if (!pWindow) + return; + ANativeWindow_Buffer aOutBuffer; memset ((void *)&aOutBuffer, 0, sizeof (aOutBuffer)); @@ -439,6 +441,9 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* bHandled = pFocus->CallCallback( nEvent, &aEvent ); else fprintf (stderr, "no focused frame to emit event on\n"); + + // FIXME: queueing full re-draw on key events ... + mbQueueReDraw = true; break; } case AINPUT_EVENT_TYPE_MOTION: @@ -529,9 +534,8 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) // release yield mutex sal_uLong nAcquireCount = ReleaseYieldMutex(); - fprintf (stderr, "DoReleaseYield #2 %d thread: %d ms\n", + fprintf (stderr, "DoReleaseYield #3 %d thread: %d ms\n", nTimeoutMS, (int)pthread_self()); -#ifndef PLASMA struct android_poll_source *pSource = NULL; int outFd = 0, outEvents = 0; @@ -540,34 +544,21 @@ void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) nTimeoutMS = 0; int nRet; - while ((nRet = ALooper_pollAll (nTimeoutMS, &outFd, &outEvents, (void**)&pSource)) >= 0) - { - fprintf (stderr, "ret #5 %d %d %d %p\n", nRet, outFd, outEvents, pSource); - // acquire yield mutex again - AcquireYieldMutex(nAcquireCount); + nRet = ALooper_pollAll (nTimeoutMS, &outFd, &outEvents, (void**)&pSource); + fprintf (stderr, "ret #6 %d %d %d %p\n", nRet, outFd, outEvents, pSource); + // acquire yield mutex again + AcquireYieldMutex(nAcquireCount); + + if (nRet >= 0) + { // Process this event. if (pSource != NULL) pSource->process(mpApp, pSource); - - nAcquireCount = ReleaseYieldMutex(); } - // acquire yield mutex again - AcquireYieldMutex(nAcquireCount); - - if (mbQueueReDraw) + if (mbQueueReDraw && mpApp->window) AndroidSalInstance::getInstance()->RedrawWindows (mpApp->window); - -#else - static int nPlasma = 0; - char buffer[128]; - sprintf (buffer, "yield %d", nPlasma++); - plasma_now(buffer); - - // acquire yield mutex again - AcquireYieldMutex(nAcquireCount); -#endif } bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) -- cgit From e8555dce94c12307f2aeff9fb1543749b97cf41c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 12:22:43 +0200 Subject: Add --with-android-sdk and --with-ant-home to the Android from Linux sample --- README.cross | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.cross b/README.cross index f3c62b2be570..3c9b4f7e3215 100644 --- a/README.cross +++ b/README.cross @@ -339,6 +339,8 @@ And here is an autogen.lastrun for Android when cross-compiling from Linux: CC_FOR_BUILD=ccache gcc CXX_FOR_BUILD=ccache g++ --with-android-ndk=/home/tml/android-ndk-r7 +--with-android-sdk=/home/tml/android-sdk-linux_x86 +--with-ant-home=/opt/apache-ant-1.8.2 --build=x86_64-unknown-linux-gnu --disable-zenity --with-distro=LibreOfficeAndroid -- cgit From 0bed666e281467c4ddd956e95ae1dbe65a60c238 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 12:44:46 +0200 Subject: Need liblnglo too --- android/qa/desktop/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 553aefe3a676..d5e93be4c6c9 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -136,6 +136,7 @@ copy-stuff: buildrcs icuuclo \ jvmaccessgcc3 \ jvmfwk \ + lnglo \ localebe1.uno \ localedata_en \ localedata_es \ -- cgit From b2aafed24427b8a803892020b5a260404ade0074 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 12:46:19 +0200 Subject: Use $ANT --- android/qa/desktop/Makefile | 6 +++--- android/qa/sc/Makefile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index d5e93be4c6c9..ec568b6258a5 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -235,11 +235,11 @@ copy-stuff: buildrcs build-ant: copy-stuff - unset JAVA_HOME && ant debug + unset JAVA_HOME && $ANT debug install: copy-stuff adb shell rm -r $(APP_DATA_PATH) - unset JAVA_HOME && ant debug install + unset JAVA_HOME && $ANT debug install @echo @echo 'Run it with "make run"' @echo @@ -260,6 +260,6 @@ stop-start-cycle: adb shell stop && adb shell start && sleep 10 clean: - ant clean + $ANT clean rm -rf assets $(SODEST) $(OBJLOCAL) diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index 84341ab24503..ad07d28d872a 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -165,10 +165,10 @@ copy-stuff: build-ant: copy-stuff - unset JAVA_HOME && ant debug + unset JAVA_HOME && $ANT debug install: copy-stuff - unset JAVA_HOME && ant debug install + unset JAVA_HOME && $ANT debug install @echo @echo 'Run it with "make run"' @echo @@ -199,6 +199,6 @@ redirect-stdio: adb shell stop && adb shell setprop log.redirect-stdio true && adb shell start clean: - ant clean + $ANT clean rm -rf assets $(SODEST) $(OBJLOCAL) -- cgit From 10d74d9afe286aeb9a19a9943dbeaa17a499e202 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 12:47:05 +0200 Subject: Need also android/Bootstrap/local.properties --- android/Bootstrap/local.properties.in | 2 ++ configure.in | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 android/Bootstrap/local.properties.in diff --git a/android/Bootstrap/local.properties.in b/android/Bootstrap/local.properties.in new file mode 100644 index 000000000000..27c8eb5f4dac --- /dev/null +++ b/android/Bootstrap/local.properties.in @@ -0,0 +1,2 @@ +# Location of the SDK. This is only used by Ant. +sdk.dir=@ANDROID_SDK_HOME@ diff --git a/configure.in b/configure.in index 9a348e3278b4..3e6ba1c8c1d9 100644 --- a/configure.in +++ b/configure.in @@ -2960,6 +2960,7 @@ if test "$cross_compiling" = "yes"; then tar cf - \ bin/repo-list.in \ build_env.in \ + android/Bootstrap/local.properties.in \ android/qa/sc/local.properties.in \ android/qa/desktop/local.properties.in \ config.guess \ @@ -10486,7 +10487,7 @@ else echo > set_soenv.last fi -AC_CONFIG_FILES([config_host.mk ooo.lst set_soenv bin/repo-list build_env android/qa/sc/local.properties android/qa/desktop/local.properties]) +AC_CONFIG_FILES([config_host.mk ooo.lst set_soenv bin/repo-list build_env android/Bootstrap/local.properties android/qa/sc/local.properties android/qa/desktop/local.properties]) AC_OUTPUT # touch the config timestamp file set_soenv.stamp -- cgit From db1ade41bf6c878753801ed241d6bd1d94466e12 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 13:11:03 +0200 Subject: Fix braino --- android/qa/desktop/Makefile | 6 +++--- android/qa/sc/Makefile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index ec568b6258a5..3d113628fa73 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -235,11 +235,11 @@ copy-stuff: buildrcs build-ant: copy-stuff - unset JAVA_HOME && $ANT debug + unset JAVA_HOME && $(ANT) debug install: copy-stuff adb shell rm -r $(APP_DATA_PATH) - unset JAVA_HOME && $ANT debug install + unset JAVA_HOME && $(ANT) debug install @echo @echo 'Run it with "make run"' @echo @@ -260,6 +260,6 @@ stop-start-cycle: adb shell stop && adb shell start && sleep 10 clean: - $ANT clean + $(ANT) clean rm -rf assets $(SODEST) $(OBJLOCAL) diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index ad07d28d872a..59ad5fb8fb81 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -165,10 +165,10 @@ copy-stuff: build-ant: copy-stuff - unset JAVA_HOME && $ANT debug + unset JAVA_HOME && $(ANT) debug install: copy-stuff - unset JAVA_HOME && $ANT debug install + unset JAVA_HOME && $(ANT) debug install @echo @echo 'Run it with "make run"' @echo @@ -199,6 +199,6 @@ redirect-stdio: adb shell stop && adb shell setprop log.redirect-stdio true && adb shell start clean: - $ANT clean + $(ANT) clean rm -rf assets $(SODEST) $(OBJLOCAL) -- cgit From 8f248885d39d0f06f8f0da7fcc798bc91bfca59a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 13:50:33 +0200 Subject: Use $(ANDROID_SDK_HOME) for adb instead of assuming it is in $PATH --- android/qa/desktop/Makefile | 10 +++++----- android/qa/sc/Makefile | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 3d113628fa73..8e1811d6c98c 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -238,26 +238,26 @@ build-ant: copy-stuff unset JAVA_HOME && $(ANT) debug install: copy-stuff - adb shell rm -r $(APP_DATA_PATH) + $(ANDROID_SDK_HOME)/platform-tools/adb shell rm -r $(APP_DATA_PATH) unset JAVA_HOME && $(ANT) debug install @echo @echo 'Run it with "make run"' @echo uninstall: - adb uninstall $(APP_PACKAGE) + $(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE) run: echo "FONTCONFIG_FILE=$(APP_DATA_PATH)/etc/fonts/fonts.conf -env:INIFILENAME=file:///assets/program/sofficerc" > cmdline - adb push cmdline $(APP_DATA_PATH)/cmdline - adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libmergedlo -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" + $(ANDROID_SDK_HOME)/platform-tools/adb push cmdline $(APP_DATA_PATH)/cmdline + $(ANDROID_SDK_HOME)/platform-tools/adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libmergedlo -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" # add -e lo-strace yes # if you want that # If you reinstall an app several times, even if you uninstall it # between, disk space seems to leak that won't get recycled until you # stop and start... stop-start-cycle: - adb shell stop && adb shell start && sleep 10 + $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10 clean: $(ANT) clean diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index 59ad5fb8fb81..997bcf7a38e8 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -174,17 +174,17 @@ install: copy-stuff @echo uninstall: - adb uninstall $(APP_PACKAGE) + $(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE) run_ucalc: echo "STAR_RESOURCEPATH=/assets/bin FONTCONFIG_FILE=$(APP_DATA_PATH)/etc/fonts/fonts.conf $(APP_DATA_PATH)/lib/libtest_sc_ucalc.so --headless --protector libunoexceptionprotector.so unoexceptionprotector '-env:CONFIGURATION_LAYERS=xcsxcu:file:///assets/xml/registry' '-env:UNO_TYPES=file:///assets/bin/udkapi.rdb file:///assets/bin/types.rdb' '-env:UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/ComponentTarget/framework/util/fwk.component file:///assets/ComponentTarget/i18npool/util/i18npool.component file:///assets/ComponentTarget/sfx2/util/sfx.component file:///assets/ComponentTarget/unoxml/source/service/unoxml.component file:///assets/ComponentTarget/configmgr/source/configmgr.component file:///assets/ComponentTarget/ucb/source/core/ucb1.component file:///assets/ComponentTarget/ucb/source/ucp/file/ucpfile1.component' -env:URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib -env:LO_LIB_DIR=file://$(APP_DATA_PATH)/lib" >cmdline - adb push cmdline $(APP_DATA_PATH)/cmdline - adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libcppunittester -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" + $(ANDROID_SDK_HOME)/platform-tools/adb push cmdline $(APP_DATA_PATH)/cmdline + $(ANDROID_SDK_HOME)/platform-tools/adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libcppunittester -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" run_filters_test: echo "STAR_RESOURCEPATH=/assets/bin FONTCONFIG_FILE=$(APP_DATA_PATH)/etc/fonts/fonts.conf $(APP_DATA_PATH)/lib/libtest_sc_filters_test.so --headless --protector libunoexceptionprotector.so unoexceptionprotector '-env:CONFIGURATION_LAYERS=xcsxcu:file:///assets/xml/registry module:file:///assets/xml/registry/spool' '-env:UNO_TYPES=file:///assets/bin/udkapi.rdb file:///assets/bin/types.rdb' '-env:UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/ComponentTarget/basic/util/sb.component file:///assets/ComponentTarget/chart2/source/controller/chartcontroller.component file:///assets/ComponentTarget/chart2/source/tools/charttools.component file:///assets/ComponentTarget/chart2/source/model/chartmodel.component file:///assets/ComponentTarget/comphelper/util/comphelp.component file:///assets/ComponentTarget/dbaccess/util/dba.component file:///assets/ComponentTarget/eventattacher/source/evtatt.component file:///assets/ComponentTarget/fileaccess/source/fileacc.component file:///assets/ComponentTarget/filter/source/config/cache/filterconfig1.component file:///assets/ComponentTarget/forms/util/frm.component file:///assets/ComponentTarget/oox/util/oox.component file:///assets/ComponentTarget/package/source/xstor/xstor.component file:///assets/ComponentTarget/package/util/package2.component file:///assets/ComponentTarget/sax/source/expatwrap/expwrap.component file:///assets/ComponentTarget/sax/source/fastparser/fastsax.component file:///assets/ComponentTarget/sc/util/sc.component file:///assets/ComponentTarget/sc/util/scfilt.component file:///assets/ComponentTarget/scaddins/source/analysis/analysis.component file:///assets/ComponentTarget/scaddins/source/datefunc/date.component file:///assets/ComponentTarget/sot/util/sot.component file:///assets/ComponentTarget/svl/util/svl.component file:///assets/ComponentTarget/toolkit/util/tk.component file:///assets/ComponentTarget/ucb/source/ucp/tdoc/ucptdoc1.component file:///assets/ComponentTarget/unotools/util/utl.component file:///assets/ComponentTarget/unoxml/source/rdf/unordf.component file:///assets/ComponentTarget/framework/util/fwk.component file:///assets/ComponentTarget/i18npool/util/i18npool.component file:///assets/ComponentTarget/sfx2/util/sfx.component file:///assets/ComponentTarget/unoxml/source/service/unoxml.component file:///assets/ComponentTarget/configmgr/source/configmgr.component file:///assets/ComponentTarget/ucb/source/core/ucb1.component file:///assets/ComponentTarget/ucb/source/ucp/file/ucpfile1.component' -env:URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib -env:LO_LIB_DIR=file://$(APP_DATA_PATH)/lib" >cmdline - adb push cmdline $(APP_DATA_PATH)/cmdline - adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libcppunittester -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" + $(ANDROID_SDK_HOME)/platform-tools/adb push cmdline $(APP_DATA_PATH)/cmdline + $(ANDROID_SDK_HOME)/platform-tools/adb shell am start -n $(APP_PACKAGE)/$(BOOTSTRAP) -e lo-main-library libcppunittester -e lo-main-indirect-cmdline "$(APP_DATA_PATH)/cmdline" run: run_ucalc run_filters_test @@ -192,11 +192,11 @@ run: run_ucalc run_filters_test # between, disk space seems to leak that won't get recycled until you # stop and start... stop-start-cycle: - adb shell stop && adb shell start && sleep 10 + $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10 # Too hard to remember this stuff;) redirect-stdio: - adb shell stop && adb shell setprop log.redirect-stdio true && adb shell start + $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell setprop log.redirect-stdio true && $(ANDROID_SDK_HOME)/platform-tools/adb shell start clean: $(ANT) clean -- cgit From d87b6165b4f020fc223c2e771967698a7cb69c02 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 15:15:58 +0200 Subject: Add remark about ccache --- configure.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.in b/configure.in index 3e6ba1c8c1d9..a0e46a92dcab 100644 --- a/configure.in +++ b/configure.in @@ -109,6 +109,8 @@ if test -n "$with_android_ndk"; then test -z "$STRIP" && STRIP=$ANDROID_ABI_PREBUILT_BIN/arm-linux-androideabi-strip ANDROIDCFLAGS="-march=armv7-a -mfloat-abi=softfp -mthumb -mfpu=neon -Wl,--fix-cortex-a8 --sysroot $ANDROID_NDK_HOME/platforms/android-9/arch-arm -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a" + + # Note that letting this set CC and CXX means ccache won't be used test -z "$CC" && CC="$ANDROID_ABI_PREBUILT_BIN/arm-linux-androideabi-gcc $ANDROIDCFLAGS" test -z "$CXX" && CXX="$ANDROID_ABI_PREBUILT_BIN/arm-linux-androideabi-g++ $ANDROIDCFLAGS -I $ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include -fexceptions -frtti" fi -- cgit From 83f2bc57c480dcb6190bef040b721e6f1f8df1cc Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 16:28:26 +0200 Subject: Drop libs that are in libmerged --- android/qa/desktop/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 8e1811d6c98c..a657fe1527c6 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -114,7 +114,6 @@ copy-stuff: buildrcs configmgr.uno \ cppcanvaslo \ drawinglayerlo \ - editenglo \ expwrap.uno \ fileacc \ fontconfig \ @@ -158,8 +157,6 @@ copy-stuff: buildrcs store \ svllo \ svtlo \ - svxlo \ - svxcorelo \ test \ tklo \ tllo \ @@ -180,7 +177,6 @@ copy-stuff: buildrcs xcrlo \ xml2 \ xmlreader \ - xolo \ xstor \ \ swlo \ -- cgit From 1b48979a27f280a87087ee99e012285050522b95 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 3 Feb 2012 17:04:40 +0200 Subject: services.rdb is in $(OUTDIR)/xml/ure as far as I can see --- android/qa/desktop/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index a657fe1527c6..4b8a832427fa 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -202,7 +202,7 @@ copy-stuff: buildrcs # uno types & services cp $(OUTDIR)/bin/types.rdb assets/program/types/ cp $(OUTDIR)/bin/ure/types.rdb assets/ure/share/misc/ - cp $(OUTDIR)/xml/services.rdb assets/program/services + cp $(OUTDIR)/xml/ure/services.rdb assets/program/services cp $(OUTDIR)/xml/ure/services.rdb assets/ure/share/misc/ # config cp -R $(OUTDIR)/xml/*.xcd assets/share/registry/ -- cgit From 29aa585b2ee2af0680eb39749d1797f52e190a3a Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 3 Feb 2012 18:49:59 +0100 Subject: android: get the focus window from SvpSalFrame --- vcl/android/androidinst.cxx | 7 +------ vcl/inc/generic/geninst.h | 6 +++--- vcl/inc/headless/svpframe.hxx | 3 +++ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 6d70471e035f..50a3040da0c6 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -321,11 +321,6 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow) mbQueueReDraw = false; } -SalFrame *AndroidSalInstance::getFocusFrame() const -{ - return !getFrames().empty() ? *getFrames().begin() : NULL; -} - static const char *app_cmd_name(int cmd) { switch (cmd) { @@ -436,7 +431,7 @@ int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* aEvent.mnCharCode = 'a'; // the unicode of it all ... aEvent.mnRepeat = AKeyEvent_getRepeatCount(event); - SalFrame *pFocus = getFocusFrame(); + SalFrame *pFocus = SvpSalFrame::GetFocusFrame(); if (pFocus) bHandled = pFocus->CallCallback( nEvent, &aEvent ); else diff --git a/vcl/inc/generic/geninst.h b/vcl/inc/generic/geninst.h index 471b6307c38f..240ebe676e0b 100644 --- a/vcl/inc/generic/geninst.h +++ b/vcl/inc/generic/geninst.h @@ -103,7 +103,7 @@ public: virtual void GetPrinterQueueInfo ( ImplPrnQueueList* pList ); virtual void GetPrinterQueueState ( SalPrinterQueueInfo* pInfo ); virtual void DeletePrinterQueueInfo ( SalPrinterQueueInfo* pInfo ); - virtual rtl::OUString GetDefaultPrinter(); + virtual rtl::OUString GetDefaultPrinter(); virtual void PostPrintersChanged() = 0; virtual void updatePrinterUpdate(); virtual void jobStartedPrinterUpdate(); @@ -117,8 +117,8 @@ public: protected: void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter, - SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pSetupData ); + SalPrinterQueueInfo* pQueueInfo, + ImplJobSetup* pSetupData ); }; inline SalGenericInstance *GetGenericInstance() diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index fc923af5a203..8c30e23d439f 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -127,6 +127,9 @@ public: virtual void SetScreenNumber( unsigned int nScreen ) { (void)nScreen; } virtual void SetApplicationID(const rtl::OUString &rApplicationID) { (void) rApplicationID; } bool IsVisible() { return m_bVisible; } + + static SvpSalFrame* GetFocusFrame() { return s_pFocusFrame; } + }; #endif // _SVP_SVPFRAME_HXX -- cgit From f076254c6db77a999d4ad0aecc6b7df7b43b4c32 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 3 Feb 2012 20:37:37 +0100 Subject: android: Source env. before trying to run it. --- README.Android | 1 + 1 file changed, 1 insertion(+) diff --git a/README.Android b/README.Android index b5e32c7db716..e96597e98fd0 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 -- cgit From 898e88edc1a55e4825399d8d962f7f77cc3831ac Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 3 Feb 2012 20:39:39 +0100 Subject: android: An attempt to handle mouse events. --- vcl/android/androidinst.cxx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 50a3040da0c6..ec38cec9792a 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: -- cgit From 5d933f259d7cdc9d600d921d51ef9d4187dbd701 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 3 Feb 2012 21:14:13 +0100 Subject: Revert "services.rdb is in $(OUTDIR)/xml/ure as far as I can see" There are two services.rdbs - one has UNO services, the other program ones This reverts commit 1b48979a27f280a87087ee99e012285050522b95. --- android/qa/desktop/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index 4b8a832427fa..a657fe1527c6 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -202,7 +202,7 @@ copy-stuff: buildrcs # uno types & services cp $(OUTDIR)/bin/types.rdb assets/program/types/ cp $(OUTDIR)/bin/ure/types.rdb assets/ure/share/misc/ - cp $(OUTDIR)/xml/ure/services.rdb assets/program/services + cp $(OUTDIR)/xml/services.rdb assets/program/services cp $(OUTDIR)/xml/ure/services.rdb assets/ure/share/misc/ # config cp -R $(OUTDIR)/xml/*.xcd assets/share/registry/ -- cgit From 5cd1d6740cc9e85b5ed3730800dff4717cb7e1ae Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 3 Feb 2012 22:02:01 +0100 Subject: android: implement theming to get default font set, 1st cut at GetWorkArea --- vcl/android/androidinst.cxx | 72 +++++++++++++++++++++++++++++++++++++++++ vcl/inc/android/androidinst.hxx | 6 ++++ 2 files changed, 78 insertions(+) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index ec38cec9792a..16a512551c33 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -347,6 +347,18 @@ static const char *app_cmd_name(int cmd) } } +void AndroidSalInstance::GetWorkArea( Rectangle& rRect ) +{ + ANativeWindow *pWindow = mpApp->window; + if (!pWindow) + rRect = Rectangle( Point( 0, 0 ), + Size( 800, 600 ) ); + else + rRect = Rectangle( Point( 0, 0 ), + Size( ANativeWindow_getWidth( pWindow ), + ANativeWindow_getHeight( pWindow ) ) ); +} + void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) { fprintf (stderr, "app cmd for app %p: %s\n", app, app_cmd_name(cmd)); @@ -603,6 +615,66 @@ SalSystem *AndroidSalInstance::CreateSalSystem() return new AndroidSalSystem(); } +class AndroidSalFrame : public SvpSalFrame +{ +public: + AndroidSalFrame( AndroidSalInstance *pInstance, + SalFrame *pParent, + sal_uLong nSalFrameStyle, + SystemParentData *pSysParent ) + : SvpSalFrame( pInstance, pParent, nSalFrameStyle, pSysParent ) + { + } + + virtual void GetWorkArea( Rectangle& rRect ) + { + AndroidSalInstance::getInstance()->GetWorkArea( rRect ); + } + + virtual void UpdateSettings( AllSettings &rSettings ) + { + // Clobber the UI fonts +#if 0 + psp::FastPrintFontInfo aInfo; + aInfo.m_aFamilyName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Roboto" ) ); + aInfo.m_eItalic = ITALIC_NORMAL; + aInfo.m_eWeight = WEIGHT_NORMAL; + aInfo.m_eWidth = WIDTH_NORMAL; + psp::PrintFontManager::get().matchFont( aInfo, rSettings.GetUILocale() ); +#endif + + // FIXME: is 12 point enough ? + Font aFont( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Roboto" ) ), + Size( 0, 14 ) ); + + StyleSettings aStyleSet = rSettings.GetStyleSettings(); + aStyleSet.SetAppFont( aFont ); + aStyleSet.SetHelpFont( aFont ); + aStyleSet.SetMenuFont( aFont ); + aStyleSet.SetToolFont( aFont ); + aStyleSet.SetLabelFont( aFont ); + aStyleSet.SetInfoFont( aFont ); + aStyleSet.SetRadioCheckFont( aFont ); + aStyleSet.SetPushButtonFont( aFont ); + aStyleSet.SetFieldFont( aFont ); + aStyleSet.SetIconFont( aFont ); + aStyleSet.SetGroupFont( aFont ); + + rSettings.SetStyleSettings( aStyleSet ); + } +}; + +SalFrame *AndroidSalInstance::CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ) +{ + return new AndroidSalFrame( this, NULL, nStyle, pParent ); +} + +SalFrame *AndroidSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nStyle ) +{ + return new AndroidSalFrame( this, pParent, nStyle, NULL ); +} + + // All the interesting stuff is slaved from the AndroidSalInstance void InitSalData() {} void DeInitSalData() {} diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index e947737a68ae..10d17c53b8b5 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -49,6 +49,11 @@ public: virtual SalSystem* CreateSalSystem(); + // frame management + void GetWorkArea( Rectangle& rRect ); + SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle ); + SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle ); + // mainloop pieces virtual void Wakeup(); virtual bool AnyInput( sal_uInt16 nType ); @@ -58,6 +63,7 @@ public: int32_t onInputEvent (struct android_app* app, AInputEvent* event); void RedrawWindows(ANativeWindow *pWindow); SalFrame *getFocusFrame() const; + protected: virtual void DoReleaseYield( int nTimeoutMS ); struct android_app *mpApp; -- cgit From 0caced5cd1cf537c6576ec6c147f40373b2eac6a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 6 Feb 2012 15:52:00 +0200 Subject: libpackage2 is also in libmergedlo --- android/qa/desktop/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/android/qa/desktop/Makefile b/android/qa/desktop/Makefile index a657fe1527c6..efe0040524d6 100644 --- a/android/qa/desktop/Makefile +++ b/android/qa/desktop/Makefile @@ -144,7 +144,6 @@ copy-stuff: buildrcs mergedlo \ msfilterlo \ ooxlo \ - package2 \ reflection.uno \ reg \ saxlo \ -- cgit From 7edb4c739332432b11b5d31df9dc7bba3761f4f1 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 9 Feb 2012 22:31:30 +0200 Subject: Add fw* and sfx to libmerged --- Library_merged.mk | 10 ++++++++-- sfx2/source/appl/appbas.cxx | 17 +++++++++++++++++ solenv/gbuild/extensions/pre_MergedLibsList.mk | 6 ++++++ solenv/gbuild/platform/com_GCC_defs.mk | 5 +++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Library_merged.mk b/Library_merged.mk index b2e49b067d96..ac55cdc2e9f4 100644 --- a/Library_merged.mk +++ b/Library_merged.mk @@ -28,14 +28,12 @@ $(eval $(call gb_Library_add_linked_libs,merged,\ comphelper \ cppu \ cppuhelper \ - fwe \ i18nisolang1 \ i18npaper \ sal \ salhelper \ sax \ sb \ - sfx \ sot \ svl \ svt \ @@ -50,6 +48,7 @@ $(eval $(call gb_Library_add_linked_libs,merged,\ $(eval $(call gb_Library_use_externals,merged,\ icuuc \ + libxml2 \ zlib \ )) @@ -76,4 +75,11 @@ $(eval $(call gb_Library_add_linked_libs,merged,\ )) endif +ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_add_linked_libs,merged,\ + objc \ + Cocoa \ +)) +endif + # vim: set noet sw=4 ts=4: diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 1f28ec8b0344..8516a9053058 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -86,10 +86,27 @@ #include #include +#ifdef LIBO_MERGELIBS +/* Avoid clash with the ones from svx/source/form/typemap.cxx */ +#define aSfxBoolItem_Impl sfx2_source_appl_appbas_aSfxBoolItem_Impl +#define aSfxStringItem_Impl sfx2_source_appl_appbas_aSfxStringItem_Impl +#define aSfxUInt16Item_Impl sfx2_source_appl_appbas_aSfxUInt16Item_Impl +#define aSfxUInt32Item_Impl sfx2_source_appl_appbas_aSfxUInt32Item_Impl +#define aSfxVoidItem_Impl sfx2_source_appl_appbas_aSfxVoidtem_Impl +#endif + #define SFX_TYPEMAP #define Selection #include "sfxslots.hxx" +#ifdef LIBO_MERGELIBS +#undef aSfxBoolItem_Impl +#undef aSfxStringItem_Impl +#undef aSfxUInt16Item_Impl +#undef aSfxUInt32Item_Impl +#undef aSfxVoidItem_Impl +#endif + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; diff --git a/solenv/gbuild/extensions/pre_MergedLibsList.mk b/solenv/gbuild/extensions/pre_MergedLibsList.mk index e39e6f428cb0..ebd70a3462be 100644 --- a/solenv/gbuild/extensions/pre_MergedLibsList.mk +++ b/solenv/gbuild/extensions/pre_MergedLibsList.mk @@ -36,8 +36,14 @@ gb_MERGEDLIBS := \ drawinglayer \ editeng \ filterconfig \ + fwe \ + fwi \ + fwk \ + fwl \ + fwm \ lng \ package2 \ + sfx \ sofficeapp \ spl \ svx \ diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index f2bf866e7046..80ed26c8ebdf 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -107,6 +107,11 @@ gb_CFLAGS_WERROR := -Werror -DLIBO_WERROR gb_CXXFLAGS_WERROR := -Werror -DLIBO_WERROR endif +ifeq ($(MERGELIBS),TRUE) +gb_CFLAGS_COMMON += -DLIBO_MERGELIBS +gb_CXXFLAGS_COMMON += -DLIBO_MERGELIBS +endif + ifeq ($(ENABLE_LTO),TRUE) gb_Library_LTOFLAGS := -flto endif -- cgit From 2b455134b0bc9b2632f095503b87ec90158b24b5 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 9 Feb 2012 15:22:30 +0200 Subject: Need also libintrospection.uno --- android/qa/sc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index 997bcf7a38e8..aa8f59f41f4c 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -77,6 +77,7 @@ copy-stuff: icui18nlo \ iculelo \ icuuclo \ + introspection.uno \ jvmaccessgcc3 \ jvmfwk \ localedata_en \ -- cgit From 49675b89cc08cb065fe4dc7bd53dd9422ae4e8d4 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 13 Feb 2012 13:57:42 +0200 Subject: Need libdatelo --- android/qa/sc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index aa8f59f41f4c..a55083cebae2 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -59,6 +59,7 @@ copy-stuff: bootstrap.uno \ comphelpgcc3 \ configmgr.uno \ + datelo \ expwrap.uno \ fileacc \ fontconfig \ -- cgit From 71fb61b77a548ac8b0b499f7c6039e197c994842 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 13 Feb 2012 15:55:46 +0200 Subject: Need libfastsax.uno --- android/qa/sc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/android/qa/sc/Makefile b/android/qa/sc/Makefile index a55083cebae2..a57ecab04f52 100644 --- a/android/qa/sc/Makefile +++ b/android/qa/sc/Makefile @@ -61,6 +61,7 @@ copy-stuff: configmgr.uno \ datelo \ expwrap.uno \ + fastsax.uno \ fileacc \ fontconfig \ forlo \ -- cgit