[Libreoffice-commits] core.git: 9 commits - android/experimental desktop/source vcl/android vcl/inc vcl/source

Tor Lillqvist tml at iki.fi
Thu Feb 28 12:34:46 PST 2013


 android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java |    2 
 desktop/source/app/app.cxx                                                         |    7 
 desktop/source/app/sofficemain.cxx                                                 |   11 -
 vcl/android/androidinst.cxx                                                        |   81 ++--------
 vcl/inc/android/androidinst.hxx                                                    |    3 
 vcl/source/app/dbggui.cxx                                                          |    1 
 vcl/source/gdi/virdev.cxx                                                          |    4 
 7 files changed, 34 insertions(+), 75 deletions(-)

New commits:
commit 0109a5b04ec4fc3a31d941faa9ea7c9f37590c49
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 22:29:31 2013 +0200

    Drop unuse maRedrawRegion
    
    I saw crashes or getting stuck in a loop in the Region code for some unknown
    reason. Below in the backtrace was the call to Region::Union() in
    AndroidSalInstance::damaged(). As the maRedrawRegion wasn't actually used for
    anything, let's bin it then for now... No crashes now, knock on wood.
    
    I still don't know whether the switch from SalFooEvents and CallCallback() to
    FooEvents and PostFooEvent() helped anything or not.
    
    Change-Id: Iba867daa37a206953cdb765905fa5eb3fca4d08e

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index b9ca23f..4b7b5ae 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -316,33 +316,7 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buf
 
             if (pFrame->IsVisible())
             {
-#ifndef REGION_RE_RENDER // (It isn't defined, don't know where it
-                         // would/could bem so this branch is the one
-                         // that is used)
                 BlitFrameToWindow (&aOutBuffer, pFrame->getDevice());
-#else
-                // Sadly it seems that due to double buffering, we don't
-                // get back in our buffer what we had there last time - so we cannot
-                // do incremental rendering. Presumably this will require us to
-                // render to a bitmap, and keep that updated instead in future.
-
-                // Intersect re-rendering region with this frame
-                Region aClipped( maRedrawRegion );
-                basegfx::B2IVector aDevSize = pFrame->getDevice()->getSize();
-                aClipped.Intersect( Rectangle( 0, 0, aDevSize.getX(), aDevSize.getY() ) );
-
-                Rectangle aSubRect;
-                RegionHandle aHdl = aClipped.BeginEnumRects();
-                while( aClipped.GetNextEnumRect( aHdl, aSubRect ) )
-                {
-                    ARect aASubRect = { aSubRect.Left(), aSubRect.Top(),
-                                        aSubRect.Right(), aSubRect.Bottom() };
-                    BlitFrameRegionToWindow(&aOutBuffer, pFrame->getDevice(),
-                                            aASubRect,
-                                            aSubRect.Left(), aSubRect.Top());
-                }
-                aClipped.EndEnumRects( aHdl );
-#endif
             }
         }
     }
@@ -352,14 +326,11 @@ void AndroidSalInstance::RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buf
     if (pBuffer && pWindow)
         ANativeWindow_unlockAndPost(pWindow);
 
-    maRedrawRegion.SetEmpty();
     mbQueueReDraw = false;
 }
 
-void AndroidSalInstance::damaged(AndroidSalFrame */* frame */, const Rectangle &rRect)
+void AndroidSalInstance::damaged(AndroidSalFrame */* frame */)
 {
-    // FIXME: translate rRect to the frame's offset ...
-    maRedrawRegion.Union( rRect );
     mbQueueReDraw = true;
 }
 
@@ -756,13 +727,7 @@ public:
         {
             return;
         }
-        Rectangle aRect( std::max((long) 0, (long) rDamageRect.getMinX() ),
-                         std::max((long) 0, (long) rDamageRect.getMinY() ),
-                         std::max((long) 0, (long) ( rDamageRect.getMinX() +
-                                                     rDamageRect.getWidth() ) ),
-                         std::max((long) 0, (long) ( rDamageRect.getMinY() +
-                                                     rDamageRect.getHeight() ) ) );
-        AndroidSalInstance::getInstance()->damaged( this, aRect );
+        AndroidSalInstance::getInstance()->damaged( this );
     }
 
     virtual void UpdateSettings( AllSettings &rSettings )
diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx
index 9ae3baa..34c0d6e 100644
--- a/vcl/inc/android/androidinst.hxx
+++ b/vcl/inc/android/androidinst.hxx
@@ -65,10 +65,9 @@ public:
     void RedrawWindows(ANativeWindow *pWindow, ANativeWindow_Buffer *pBuffer = NULL);
     SalFrame *getFocusFrame() const;
 
-    void      damaged(AndroidSalFrame *frame, const Rectangle &rRect);
+    void      damaged(AndroidSalFrame *frame);
 protected:
     virtual void DoReleaseYield( int nTimeoutMS );
-    Region maRedrawRegion;
     bool   mbQueueReDraw;
 };
 
commit b34b8d3372364b3c5043da0357ec69505e8d8602
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 19:39:00 2013 +0200

    I think this is such a serious problem that an assert() is in order
    
    Change-Id: If4273ba0b0a95d314e346e26ce092b108214d898

diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 22051aa..e9a4edf 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -1748,6 +1748,7 @@ void ImplDbgTestSolarMutex()
     bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex();
     (void)bCheck;
     OSL_ENSURE( bCheck, "SolarMutex not locked" );
+    assert(bCheck);
 }
 
 // =======================================================================
commit 82e7c71e768c2281bd5e571e973e4478917e9e43
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 15:40:06 2013 +0200

    Try uncommenting these now, I don't think the FIXME holds any more
    
    Change-Id: Idded90eaa68481dbb9b4045ff62a54e13c7baa31

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index d855c17..b9ca23f 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -852,14 +852,13 @@ SalInstance *CreateSalInstance()
     LOGI("Android: CreateSalInstance!");
     AndroidSalInstance* pInstance = new AndroidSalInstance( new SalYieldMutex() );
     new AndroidSalData( pInstance );
-// FIXME: we init VCL in a different thread from where we run the mainloop [!] ...
-//    pInstance->AcquireYieldMutex(1);
+    pInstance->AcquireYieldMutex(1);
     return pInstance;
 }
 
 void DestroySalInstance( SalInstance *pInst )
 {
-//    pInst->ReleaseYieldMutex();
+    pInst->ReleaseYieldMutex();
     delete pInst;
 }
 
commit 7de08bcde91eece3ea4d5d5ba71cf9ba8aac6080
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 15:39:22 2013 +0200

    Don't SAL_INFO() a sal_Bool as a (binary) character
    
    Change-Id: I6eb8ad74e215dca4b6c7b51939843afda67e44e5

diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 2f85855..87a7487 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -204,8 +204,8 @@ VirtualDevice::~VirtualDevice()
 sal_Bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
 {
     SAL_INFO( "vcl.gdi",
-            "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", "
-            << rNewSize.Height() << ", " << bErase << " )" );
+              "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", "
+              << rNewSize.Height() << ", " << int(bErase) << " )" );
 
     if ( !mpVirDev )
         return sal_False;
commit 7361c08a861a6e4f120d985156e8cdfe7c2f6dee
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 15:23:58 2013 +0200

    Avoid "Warning: -writer is deprecated.  Use --writer instead."
    
    Change-Id: I348df07e6c821969b04fc83b2720d200ffb89f68

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 aebcfdf..22e15ac 100644
--- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
@@ -111,7 +111,7 @@ public class Desktop
 //            input = getIntent().getStringExtra("input");
 //            if (input == null)
 //            input = "/assets/test1.odt";
-            input = "-writer";
+            input = "--writer";
 
             // We need to fake up an argv, and the argv[0] even needs to
             // point to some file name that we can pretend is the "program".
commit 32da3c3a6bfc61de44c37a77bfca84e3cac2c59d
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 14:42:41 2013 +0200

    Try to use another kind of events
    
    I see randomish crashes that likely are caused by parallelism problems. Try to
    see if using Application::PostKeyEventg() and PostMouseEvent() instead of
    SalFrame::CallCallback() helps.
    
    Change-Id: Ia97259a378fe40ff0dab3fbb538599e9d2e69c1f

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 5c9fb78..d855c17 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -977,19 +977,14 @@ extern "C" SAL_JNI_EXPORT void JNICALL
 Java_org_libreoffice_experimental_desktop_Desktop_key(JNIEnv * /* env */,
                                                       jobject /* clazz */,
                                                       jchar c,
-                                                      jshort timestamp)
+                                                      jshort /* timestamp */)
 {
-    SalKeyEvent aEvent;
-
-    aEvent.mnCharCode = c;
-    aEvent.mnTime = timestamp;
-    aEvent.mnCode = c;
-    aEvent.mnRepeat = 0;
+    KeyEvent aEvent(c, c, 0);
 
     SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame();
     if (pFocus) {
-        pFocus->CallCallback( SALEVENT_KEYINPUT, &aEvent );
-        pFocus->CallCallback( SALEVENT_KEYUP, &aEvent );
+        Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
+        Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
     }
     else
         LOGW("No focused frame to emit event on");
@@ -1002,26 +997,23 @@ Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */,
                                                         jint action,
                                                         jint x,
                                                         jint y,
-                                                        jshort timestamp)
+                                                        jshort /* timestamp */)
 {
-    SalMouseEvent aEvent;
-
-    aEvent.mnTime = timestamp;
-    aEvent.mnX = x;
-    aEvent.mnY = y;
-    aEvent.mnButton = MOUSE_LEFT;
-    aEvent.mnCode = 0;
+    MouseEvent aEvent;
 
-    sal_uInt16 eventKind;
+    sal_uLong nEvent;
     switch (action) {
     case AMOTION_EVENT_ACTION_DOWN:
-        eventKind = SALEVENT_MOUSEBUTTONDOWN;
+        aEvent = MouseEvent(Point(x, y), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT);
+        nEvent = VCLEVENT_WINDOW_MOUSEBUTTONDOWN;
         break;
     case AMOTION_EVENT_ACTION_UP:
-        eventKind = SALEVENT_MOUSEBUTTONUP;
+        aEvent = MouseEvent(Point(x, y), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT);
+        nEvent = VCLEVENT_WINDOW_MOUSEBUTTONUP;
         break;
     case AMOTION_EVENT_ACTION_MOVE:
-        eventKind = SALEVENT_MOUSEMOVE;
+        aEvent = MouseEvent(Point(x, y), 1, MOUSE_SIMPLEMOVE, MOUSE_LEFT);
+        nEvent = VCLEVENT_WINDOW_MOUSEMOVE;
         break;
     default:
         LOGE("Java_org_libreoffice_experimental_desktop_Desktop_touch: Invalid action %d", action);
@@ -1030,7 +1022,7 @@ Java_org_libreoffice_experimental_desktop_Desktop_touch(JNIEnv * /* env */,
 
     SalFrame *pFocus = AndroidSalInstance::getInstance()->getFocusFrame();
     if (pFocus)
-        pFocus->CallCallback( eventKind, &aEvent );
+        Application::PostMouseEvent(nEvent, pFocus->GetWindow(), &aEvent);
     else
         LOGW("No focused frame to emit event on");
 }
commit 658824e43dc306b986a85e73cb1bffaf0e48b879
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 14:41:37 2013 +0200

    Bypass a little more stuff for Android (and iOS)
    
    Still tons of stuff left that make no sense on Android or iOS.
    
    Change-Id: I4bb1555b5d2aefc175d544aa220102aa78697b89

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 59ded96..9899b1a 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1386,6 +1386,7 @@ int Desktop::Main()
         new DesktopContext( com::sun::star::uno::getCurrentContext() ) );
 
     CommandLineArgs& rCmdLineArgs = GetCommandLineArgs();
+#if !defined(ANDROID) && !defined(IOS)
     OUString aUnknown( rCmdLineArgs.GetUnknown() );
     if ( !aUnknown.isEmpty() )
     {
@@ -1402,7 +1403,7 @@ int Desktop::Main()
         displayVersion();
         return EXIT_SUCCESS;
     }
-
+#endif
     // setup configuration error handling
     ConfigurationErrorHandler aConfigErrHandler;
     if (!ShouldSuppressUI(rCmdLineArgs))
@@ -1449,7 +1450,7 @@ int Desktop::Main()
         // there is no other instance using our data files from a remote host
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main -> Lockfile" );
         m_xLockfile.reset(new Lockfile);
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(IOS)
         if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() &&
              !rCmdLineArgs.IsNoLockcheck() && !m_xLockfile->check( Lockfile_execWarning ))
         {
@@ -1536,7 +1537,7 @@ int Desktop::Main()
         */
         Application::GetDefaultDevice();
 
-#ifndef ANDROID
+#if !defined(ANDROID) && !defined(IOS)
         // Check if bundled or shared extensions were added /removed
         // and process those extensions (has to be done before checking
         // the extension dependencies!
commit 1b05f8686849527698c960fb79624a544f21e71c
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 13:47:50 2013 +0200

    Bin one more too repetitive log line
    
    Change-Id: I0ab4ecc4791cd319c8c25583e5207dcfc66b0fac

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 5f8df73..5c9fb78 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -754,7 +754,6 @@ public:
         if (rDamageRect.getWidth() <= 0 ||
             rDamageRect.getHeight() <= 0)
         {
-            LOGE("Damage region has zero or negative size");
             return;
         }
         Rectangle aRect( std::max((long) 0, (long) rDamageRect.getMinX() ),
commit 0de21643a9ab3e9e906195752b5f0c76a1cd0bc9
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Feb 28 10:22:25 2013 +0200

    Use proper Android logging here, too
    
    Change-Id: Idfa826b9dd3156f2471ffd7dac245e68de8f4169

diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index cc40648..7ae12fb 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -32,7 +32,11 @@
 
 #ifdef ANDROID
 #  include <jni.h>
+#  include <android/log.h>
 #  include <salhelper/thread.hxx>
+
+#  define LOGTAG "LibreOffice/sofficemain"
+#  define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__))
 #endif
 
 int SVMain();
@@ -79,8 +83,8 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
     return SVMain();
 #if defined ANDROID
     } catch (const ::com::sun::star::uno::Exception &e) {
-        fprintf (stderr, "Not handled UNO exception at main: '%s'\n",
-                 rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+        LOGI("Unhandled UNO exception: '%s'",
+             rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
         throw; // to get exception type printed
     }
 #endif
@@ -96,7 +100,7 @@ public:
         int nRet;
         do {
             nRet = soffice_main();
-            fprintf( stderr, "nRet %d\n", nRet );
+            LOGI("soffice_main returned %d", nRet );
         } while (nRet == 81 || nRet == 79); // pretend to re-start.
         exit (nRet);
     }
@@ -106,7 +110,6 @@ extern "C" SAL_JNI_EXPORT void JNICALL
 Java_org_libreoffice_experimental_desktop_Desktop_spawnMain(JNIEnv* /* env */,
                                                             jobject /* dummy */)
 {
-    fprintf(stderr, "Spawn main!\n");
     new MainThread();
 }
 #endif


More information about the Libreoffice-commits mailing list