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

Tor Lillqvist tml at iki.fi
Mon Feb 25 08:10:12 PST 2013


 android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java |    8 +++--
 vcl/android/androidinst.cxx                                                                |   16 ++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit eb37322f14e6ed12a0db0f7fad1af81114a2ed80
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Feb 25 18:08:01 2013 +0200

    Temporary (one hopes) hack to get the actual view size down to SvpSalFrame
    
    Change-Id: I0c2a2301de1b0de71fc6724ff2af73fbf6b406ef

diff --git a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java
index 8d5b97d..58fe555 100644
--- a/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/android/experimental/desktop/Desktop.java
@@ -132,6 +132,7 @@ public class Desktop
 
     /* implementend by vcl */
     public static native void renderVCL(Bitmap bitmap);
+    public static native void setViewSize(int width, int height);
 
     /**
      * This class contains the state that is initialized once and never changes
@@ -278,15 +279,15 @@ public class Desktop
             if (bootstrapContext == null)
                 initBootstrapContext();
 
+            Log.i(TAG, "onCreate - set content view\n");
+            setContentView(new BitmapView());
+
             spawnMain();
         }
         catch (Exception e) {
             e.printStackTrace(System.err);
             finish();
         }
-
-        Log.i(TAG, "onCreate - set content view\n");
-        setContentView(new BitmapView());
     }
 
     class BitmapView extends android.view.View
@@ -305,6 +306,7 @@ public class Desktop
             if (mBitmap == null) {
                 Log.i(TAG, "calling Bitmap.createBitmap(" + getWidth() + ", " + getHeight() + ", Bitmap.Config.ARGB_8888)");
                 mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
+                setViewSize(getWidth(), getHeight());
             }
             renderVCL(mBitmap);
             canvas.drawBitmap(mBitmap, 0, 0, null);
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index 2ed1585..8bd285f 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -43,6 +43,9 @@
 
 static bool bHitIdle = false;
 
+// Horrible hack
+static int viewWidth = 1, viewHeight = 1;
+
 class AndroidSalData : public SalGenericData
 {
 public:
@@ -735,6 +738,8 @@ public:
                        pSysParent )
     {
         enableDamageTracker();
+        if (pParent == NULL && viewWidth > 1 && viewHeight > 1)
+            SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT);
     }
 
     virtual void GetWorkArea( Rectangle& rRect )
@@ -962,4 +967,15 @@ typedef struct ANativeWindow_Buffer {
     AndroidBitmap_unlockPixels(env, bitmap);
 }
 
+extern "C" SAL_JNI_EXPORT void JNICALL
+Java_org_libreoffice_experimental_desktop_Desktop_setViewSize(JNIEnv * /* env */,
+                                                              jobject /* object */,
+                                                              jint width,
+                                                              jint height)
+{
+    // Horrible
+    viewWidth = width;
+    viewHeight = height;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list