android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java | 48 - vcl/README | 46 vcl/android/androidinst.cxx | 463 ---------- vcl/source/app/svapp.cxx | 25 vcl/source/window/winproc.cxx | 29 5 files changed, 138 insertions(+), 473 deletions(-)
New commits: commit e669502dcf2f825842ba87ee4a14a0be26883e28 Author: Tor Lillqvist <t...@iki.fi> Date: Thu Mar 7 10:15:28 2013 +0200 Start hacking on scrolling Change-Id: I74f1d7feb935be65629bdbd7464f9882229948e5 diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java index c10df22..ace4efe 100644 --- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java +++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java @@ -50,6 +50,7 @@ public class Desktop public static native void key(char c); public static native void touch(int action, int x, int y); public static native void zoom(float scale, int x, int y); + public static native void scroll(int x, int y); /** * This class contains the state that is initialized once and never changes @@ -165,7 +166,8 @@ public class Desktop GestureDetector gestureDetector; ScaleGestureDetector scaleDetector; - boolean scalingInProgress; + boolean scrollInProgress, scalingInProgress; + float translateX = 0, translateY = 0; float accumulatedScale = 1; float pivotX = 0, pivotY = 0; @@ -179,14 +181,18 @@ public class Desktop new GestureDetector.SimpleOnGestureListener() { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - Log.i(TAG, "onFling: events:" + e1 + ", " + e2 + ", velocity: (" + velocityX + ", " + velocityY + ")"); + Log.i(TAG, "onFling: (" + velocityX + ", " + velocityY + ")"); return false; } - @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) + @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - Log.i(TAG, "onScroll: events:" + e1 + ", " + e2 + ", velocity: (" + velocityX + ", " + velocityY + ")"); - return false; + Log.i(TAG, "onScroll: (" + distanceX + ", " + distanceY + ")"); + translateX += -distanceX; + translateY += -distanceY; + scrollInProgress = true; + invalidate(); + return true; } }); @@ -202,7 +208,7 @@ public class Desktop @Override public boolean onScale(ScaleGestureDetector detector) { - accumulatedScale *= detector.getScaleFactor();; + accumulatedScale *= detector.getScaleFactor(); pivotX = detector.getFocusX(); pivotY = detector.getFocusY(); invalidate(); @@ -229,10 +235,19 @@ public class Desktop setViewSize(getWidth(), getHeight()); } renderVCL(mBitmap); - canvas.save(); - canvas.scale(accumulatedScale, accumulatedScale, pivotX, pivotY); - canvas.drawBitmap(mBitmap, 0, 0, null); - canvas.restore(); + if (scrollInProgress) { + canvas.save(); + canvas.translate(translateX, translateY); + canvas.drawBitmap(mBitmap, 0, 0, null); + canvas.restore(); + } else if (scalingInProgress) { + canvas.save(); + canvas.scale(accumulatedScale, accumulatedScale, pivotX, pivotY); + canvas.drawBitmap(mBitmap, 0, 0, null); + canvas.restore(); + } else { + canvas.drawBitmap(mBitmap, 0, 0, null); + } renderedOnce = true; } @@ -270,6 +285,19 @@ public class Desktop if (gestureDetector.onTouchEvent(event)) return true; + // There is no callback in SimpleOnGestureListener for end + // of scroll. Is this a good way to detect it? Assume that + // as long as the scrolling gesture is in progress, the + // Gesturedetector.onTouchEvent() will keep returning + // true, so if scrollInProgress is true and we get here, + // the scroll must have ended. + + if (scrollInProgress) { + Desktop.scroll((int) translateX, (int) translateY); + translateX = translateY = 0; + scrollInProgress = false; + } + // If a scaling gesture is in progress no other touch // processing should be done. if (scaleDetector.onTouchEvent(event) && scalingInProgress) diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 3dbdce1..89a8e68 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -554,4 +554,21 @@ Java_org_libreoffice_experimental_desktop_Desktop_zoom(JNIEnv * /* env */, LOGW("No focused frame to emit event on"); } +// public static native void scroll(int x, int y); +extern "C" SAL_JNI_EXPORT void JNICALL +Java_org_libreoffice_experimental_desktop_Desktop_scroll(JNIEnv * /* env */, + jobject /* clazz */, + jint x, + jint y) +{ + SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame(); + if (pFocus) { + SAL_INFO( "vcl.androidinst", "scroll: " << "(" << x << "," << y << ")" ); + ScrollEvent aEvent( x, y ); + Application::PostScrollEvent(VCLEVENT_WINDOW_SCROLL, pFocus->GetWindow(), &aEvent); + } + else + LOGW("No focused frame to emit event on"); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 2dbb2de..cba609d 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -912,6 +912,31 @@ sal_uLong Application::PostZoomEvent( sal_uLong nEvent, Window *pWin, ZoomEvent* return nEventId; } +sal_uLong Application::PostScrollEvent( sal_uLong nEvent, Window *pWin, ScrollEvent* pScrollEvent ) +{ + const SolarMutexGuard aGuard; + sal_uLong nEventId = 0; + + if( pWin && pScrollEvent ) + { + ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, *pScrollEvent ); + + PostUserEvent( nEventId, + STATIC_LINK( NULL, Application, PostEventHandler ), + pPostEventData ); + + if( nEventId ) + { + pPostEventData->mnEventId = nEventId; + aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); + } + else + delete pPostEventData; + } + + return nEventId; +} + // ----------------------------------------------------------------------------- IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData ) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 1ecbbb1..d4a6fa8 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2606,10 +2606,39 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, // Pass on the scale as a percentage of current zoom factor aSalWheelMouseEvent.mnDelta = (long) (pZoomEvent->GetScale() * 100); + // Other SalWheelMouseEvent fields ignored when the + // scaleDirectly parameter to ImplHandleWheelEvent() is + // true. nRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent, true ); } break; case SALEVENT_EXTERNALSCROLL: + { + ScrollEvent* pScrollEvent = (ScrollEvent*) pEvent; + SalWheelMouseEvent aSalWheelMouseEvent; + + aSalWheelMouseEvent.mnTime = Time::GetSystemTicks(); + aSalWheelMouseEvent.mnX = 0; // ??? + aSalWheelMouseEvent.mnY = 0; + + aSalWheelMouseEvent.mbDeltaIsPixel = sal_False; + + // First scroll vertically, then horizontally + aSalWheelMouseEvent.mnDelta = (long) pScrollEvent->GetYOffset(); + if (aSalWheelMouseEvent.mnDelta != 0) + { + aSalWheelMouseEvent.mnCode = 0; + aSalWheelMouseEvent.mbHorz = sal_False; + nRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent ); + } + aSalWheelMouseEvent.mnDelta = (long) pScrollEvent->GetXOffset(); + if (aSalWheelMouseEvent.mnDelta != 0) + { + aSalWheelMouseEvent.mnCode = 0; + aSalWheelMouseEvent.mbHorz = sal_True; + nRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent ); + } + } break; #ifdef DBG_UTIL default: commit bcbe5fe88593473ff4d12633c52e34f2f8054594 Author: Tor Lillqvist <t...@iki.fi> Date: Thu Mar 7 08:37:27 2013 +0200 Use view size for "work area" size Don't know what this affects, though. Things seem to have worked as expected even with the hardcoded bogus value? Change-Id: I945bdcd53260fc5f43cf0031dfd96637168475f0 diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index 1874450..3dbdce1 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -167,7 +167,7 @@ void AndroidSalInstance::damaged(AndroidSalFrame */* frame */) void AndroidSalInstance::GetWorkArea( Rectangle& rRect ) { rRect = Rectangle( Point( 0, 0 ), - Size( 1280, 750 ) ); + Size( viewWidth, viewHeight ) ); } /* commit 1192381595f449a383c792846ccc52a920aea84a Author: Tor Lillqvist <t...@iki.fi> Date: Thu Mar 7 08:17:17 2013 +0200 Now get rid of the #if 0 blocks Change-Id: I815cc4a703b7ca6d2894807396a06a3394b40676 diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index c353215..1874450 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -53,156 +53,6 @@ public: virtual bool ErrorTrapPop( bool ) { return false; } }; -#if 0 // Code from NativeActivity-based times left for reference inside #if 0 here and later - -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(); -} - -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); - - MAP(DPAD_UP, UP); MAP(DPAD_DOWN, DOWN); - MAP(DPAD_LEFT, LEFT); MAP(DPAD_RIGHT, RIGHT); - - 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_VOLUME_UP: - case AKEYCODE_VOLUME_DOWN: - case AKEYCODE_DPAD_CENTER: - 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: - LOGI("un-mapped keycode %d", nCode); - nCode = 0; - break; -#undef MAP_SAME -#undef MAP - } - LOGI("mapped %d -> %d", AKeyEvent_getKeyCode(event), nCode); - return nCode; -} - -#endif - static void BlitFrameRegionToWindow(ANativeWindow_Buffer *pOutBuffer, const basebmp::BitmapDeviceSharedPtr& aDev, const ARect &rSrcRect, @@ -314,107 +164,12 @@ void AndroidSalInstance::damaged(AndroidSalFrame */* frame */) m_pJNIEnv->CallStaticVoidMethod(m_nDesktopClass, m_nCallbackDamaged); } -#if 0 - -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; - } -} - -#endif - void AndroidSalInstance::GetWorkArea( Rectangle& rRect ) { rRect = Rectangle( Point( 0, 0 ), Size( 1280, 750 ) ); - -#if 0 - rRect = Rectangle( Point( 0, 0 ), - Size( ANativeWindow_getWidth( mpApp->window ), - ANativeWindow_getHeight( mpApp->window ) ) ); -#endif } -#if 0 - -void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd) -{ - LOGI("app cmd for app %p: %s", app, app_cmd_name(cmd)); - ANativeWindow *pWindow = mpApp->window; - switch (cmd) { - case APP_CMD_INIT_WINDOW: - { - ARect aRect = { 0, 0, 0, 0 }; - aRect.right = ANativeWindow_getWidth(pWindow); - aRect.bottom = ANativeWindow_getHeight(pWindow); - int nRet = ANativeWindow_setBuffersGeometry( - pWindow, ANativeWindow_getWidth(pWindow), - ANativeWindow_getHeight(pWindow), - WINDOW_FORMAT_RGBA_8888); - LOGI("we have an app window ! %p %dx%x (%d) set %d", - pWindow, aRect.right, aRect.bottom, - ANativeWindow_getFormat(pWindow), nRet); - maRedrawRegion = Region( Rectangle( 0, 0, ANativeWindow_getWidth(pWindow), - ANativeWindow_getHeight(pWindow) ) ); - mbQueueReDraw = true; - break; - } - case APP_CMD_WINDOW_RESIZED: - { - ARect aRect = { 0, 0, 0, 0 }; - aRect.right = ANativeWindow_getWidth(pWindow); - aRect.bottom = ANativeWindow_getHeight(pWindow); - LOGI("app window resized to ! %p %dx%x (%d)", - pWindow, aRect.right, aRect.bottom, - ANativeWindow_getFormat(pWindow)); - break; - } - - case APP_CMD_WINDOW_REDRAW_NEEDED: - { - LOGI("redraw needed"); - maRedrawRegion = Region( Rectangle( 0, 0, ANativeWindow_getWidth(pWindow), - ANativeWindow_getHeight(pWindow) ) ); - mbQueueReDraw = true; - break; - } - - case APP_CMD_CONTENT_RECT_CHANGED: - { - ARect aRect = mpApp->contentRect; - LOGI("content rect changed [ k/b popped up etc. ] %d,%d->%d,%d", - aRect.left, aRect.top, aRect.right, aRect.bottom); - break; - } - default: - LOGI("unhandled app cmd %d", cmd); - break; - } -} - -#endif - /* * Try too hard to get a frame, in the absence of anything better to do */ @@ -438,123 +193,6 @@ SalFrame *AndroidSalInstance::getFocusFrame() const return pFocus; } -#if 0 - -int32_t AndroidSalInstance::onInputEvent (struct android_app* app, AInputEvent* event) -{ - bool bHandled = false; - LOGI("input event for app %p, event %p type %d source %d device id %d", - 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); - LOGI("key event keycode %d '%s' %s flags (0x%x) 0x%x", - AKeyEvent_getKeyCode(event), - nAction == AKEY_EVENT_ACTION_DOWN ? "down" : - nAction == AKEY_EVENT_ACTION_UP ? "up" : "multiple", - KeyMetaStateToString(AKeyEvent_getMetaState(event)).getStr(), - AKeyEvent_getMetaState (event), - AKeyEvent_getFlags (event)); - - // 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); - - // FIXME: really we need a Java wrapper app as Mozilla has that does - // key event translation for us, and provides -much- cleaner events. - nEvent = (AKeyEvent_getAction(event) == AKEY_EVENT_ACTION_UP ? - SALEVENT_KEYUP : SALEVENT_KEYINPUT); - sal_uInt16 nCode = KeyToCode(event); - sal_uInt16 nMetaState = KeyMetaStateToCode(event); - if (nCode >= KEY_0 && nCode <= KEY_9) - aEvent.mnCharCode = '0' + nCode - KEY_0; - else if (nCode >= KEY_A && nCode <= KEY_Z) - aEvent.mnCharCode = (nMetaState & KEY_SHIFT ? 'A' : 'a') + nCode - KEY_A; - else if (nCode == KEY_SPACE) - aEvent.mnCharCode = ' '; - else if (nCode == KEY_COMMA) - aEvent.mnCharCode = ','; - else if (nCode == KEY_POINT) - aEvent.mnCharCode = '.'; - else - aEvent.mnCharCode = 0; - aEvent.mnTime = nNsTime / (1000 * 1000); - aEvent.mnCode = nMetaState | nCode; - aEvent.mnRepeat = AKeyEvent_getRepeatCount(event); - - SalFrame *pFocus = getFocusFrame(); - if (pFocus) - bHandled = pFocus->CallCallback( nEvent, &aEvent ); - else - LOGI("no focused frame to emit event on"); - - LOGI("bHandled == %s", bHandled? "true": "false" ); - break; - } - case AINPUT_EVENT_TYPE_MOTION: - { - size_t nPoints = AMotionEvent_getPointerCount(event); - LOGI("motion event %d %g,%g %d points: %s", - AMotionEvent_getAction(event), - AMotionEvent_getXOffset(event), - AMotionEvent_getYOffset(event), - (int)nPoints, - MotionEdgeFlagsToString(AMotionEvent_getEdgeFlags(event)).getStr()); - for (size_t i = 0; i < nPoints; i++) - LOGI("\t%d: %g,%g - pressure %g", - (int)i, - 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; - - if (nPoints > 0) - { - aMouseEvent.mnX = AMotionEvent_getX(event, 0); - aMouseEvent.mnY = AMotionEvent_getY(event, 0); - } else { - aMouseEvent.mnX = AMotionEvent_getXOffset(event); - aMouseEvent.mnY = AMotionEvent_getYOffset(event); - } - - int64_t nNsTime = AMotionEvent_getEventTime(event); - aMouseEvent.mnTime = nNsTime / (1000 * 1000); - aMouseEvent.mnCode = 0; // FIXME - aMouseEvent.mnButton = MOUSE_LEFT; // FIXME - - SalFrame *pFocus = getFocusFrame(); - if (pFocus) - bHandled = pFocus->CallCallback( nEvent, &aMouseEvent ); - else - LOGI("no focused frame to emit event on"); - - LOGI("bHandled == %s", bHandled? "true": "false" ); - - break; - } - default: - LOGI("unknown input event type %p %d", - event, AInputEvent_getType(event)); - break; - } - return bHandled ? 1 : 0; -} - -#endif - AndroidSalInstance *AndroidSalInstance::getInstance() { if (!ImplGetSVData()) @@ -565,22 +203,6 @@ AndroidSalInstance *AndroidSalInstance::getInstance() return static_cast<AndroidSalInstance *>(pData->m_pInstance); } -#if 0 - -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); - } -} - -#endif - AndroidSalInstance::AndroidSalInstance( SalYieldMutex *pMutex ) : SvpSalInstance( pMutex ) { @@ -611,65 +233,6 @@ void AndroidSalInstance::Wakeup() LOGI("busted - no global looper"); } -#if 0 - -void AndroidSalInstance::DoReleaseYield (int nTimeoutMS) -{ - if (!bHitIdle) - LOGI("hit idle !" ); - bHitIdle = true; - -#if 1 - // Presumably this should never be called at all except in - // NativeActivity-based apps with a GUI, where the message pump is - // run here in vcl, but we don't have any NativeActivitry-based - // apps any more. - - (void) nTimeoutMS; - - { - static bool beenhere = false; - if (!beenhere) - { - LOGI("**** Huh, %s called in non-NativeActivity app", __FUNCTION__); - beenhere = true; - } - return; - } -#else - // release yield mutex - sal_uLong nAcquireCount = ReleaseYieldMutex(); - - LOGI("DoReleaseYield #3 %d thread: %d ms", - nTimeoutMS, (int)pthread_self()); - - struct android_poll_source *pSource = NULL; - int outFd = 0, outEvents = 0; - - if (mbQueueReDraw) - nTimeoutMS = 0; - - int nRet; - nRet = ALooper_pollAll (nTimeoutMS, &outFd, &outEvents, (void**)&pSource); - LOGI("ret #6 %d %d %d %p", nRet, outFd, outEvents, pSource); - - // acquire yield mutex again - AcquireYieldMutex(nAcquireCount); - - if (nRet >= 0) - { - // Process this event. - if (pSource != NULL) - pSource->process(mpApp, pSource); - } - - if (mbQueueReDraw && mpApp && mpApp->window) - AndroidSalInstance::getInstance()->RedrawWindows (mpApp->window); -#endif -} - -#endif - bool AndroidSalInstance::AnyInput( sal_uInt16 nType ) { if( (nType & VCL_INPUT_TIMER) != 0 ) @@ -871,13 +434,6 @@ Java_org_libreoffice_experimental_desktop_Desktop_renderVCL(JNIEnv *env, return; } -#if 0 - if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) { - LOGI("Bitmap format is not RGB_565 !"); - return; - } -#endif - if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) { LOGI("AndroidBitmap_lockPixels() failed ! error=%d", ret); } commit 54d3aa2785d0fd9e8b61a27fcb451b919935bd22 Author: Tor Lillqvist <t...@iki.fi> Date: Thu Mar 7 08:12:56 2013 +0200 Improve vcl/README Change-Id: I9031ab98f263bcc32b747c85e1715b80c7059ae9 diff --git a/vcl/README b/vcl/README index effde51..a868f2a 100644 --- a/vcl/README +++ b/vcl/README @@ -1,38 +1,47 @@ Visual Components Library is responsible for the widgets (windowing, buttons, controls, file-pickers etc.) operating system abstraction, including basic rendering (e.g. the output device). -Welcome to the Visual Class Libraries (vcl) code - source/ + the main cross-platform chunk of source + inc/ - + cross-platform abstraction headers / definition + + cross-platform abstraction headers vcl/ - + external headers + + public headers ("public" to the rest of LibreOffice, that is) + generic/ - + shared helper code for backends, - actually built into vcl + + shared helper code for *some* of the backends, actually built into vcl. + headless/ + a backend renderer that draws to bitmaps + +android/ + + Android backend (work in progress, does work to some extent) + aqua/ - + OS/X backend + + OS X backend + ios/ - + skeleton Android backend + + iOS backend (work in progres, does not work, needs re-think + and re-write) + win/ - + windows backend + + Windows backend + unx/ - + unix specific platform backend code and its' sub-platforms + + X11 backend and its sub-platforms + plugadapt/ + pluggable framework to select correct unx backend gtk/ - + gtk2 support + + GTK2 support gtk3/ - + gtk3.2+ support + + GTK3.2+ support kde/ - + kde3 support + + KDE3 support kde4/ - + kde4 support + + KDE4 support generic/ - + raw X support + + raw X11 support How the platform abstraction works @@ -48,6 +57,7 @@ How the platform abstraction works Timers, the SolarMutexe, Drag&Drop and other objects, as well as the primary event loop wrapper. -Note: references to "SV" in the code are in relation to StarView, which is a -portable C++ class library for GUIs, with very old roots, that was developed -by StarDivision. +Note: references to "SV" in the code mean StarView, which was a +portable C++ class library for GUIs, with very old roots, that was +developed by StarDivision. Nowadays it is not used by anything except +LibreOffice (and OpenOffice). _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits