Rebased ref, commits from common ancestor: commit eb2de5c700e9c19abf96228ee8610d608d568652 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jan 23 18:38:55 2015 +0100
LOK: don't ignore all callback events when we're in the callback already There are two conflicting requirements here: - if there was an invalidation event, and PaintTile() is called due to that, then we're not interested in invalidation events generated by PaintTile() itself. - we do want other event types all the time like the cursor rectangle Change SwViewShell::libreOfficeKitCallback(), so that it doesn't ignore all callbacks when we're in the callback already, just the so far only problematic type: tile invalidation. Change-Id: Idcaedbbe0fe2b5b1aa9bafbfe33a81c8011fe148 diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 8ee2d11..16db81b 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -197,6 +197,7 @@ protected: LibreOfficeKitCallback mpLibreOfficeKitCallback; void* mpLibreOfficeKitData; + bool mbInLibreOfficeKitCallback; public: TYPEINFO(); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 0d7dcb7..14741cd 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -125,6 +125,11 @@ void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const { + if (mbInLibreOfficeKitCallback && nType == LOK_CALLBACK_INVALIDATE_TILES) + // Make sure no more invalidation events are issued when we're in the + // callback already. + return; + if (mpLibreOfficeKitCallback) mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); } @@ -1775,8 +1780,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex OutputDevice *pSaveOut = mpOut; bool bTiledRendering = mbTiledRendering; mbTiledRendering = true; - LibreOfficeKitCallback pCallback = mpLibreOfficeKitCallback; - mpLibreOfficeKitCallback = 0; + mbInLibreOfficeKitCallback = true; mpOut = &rDevice; // resizes the virtual device so to contain the entrie context @@ -1824,7 +1828,7 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex // SwViewShell's output device tear down mpOut = pSaveOut; - mpLibreOfficeKitCallback = pCallback; + mbInLibreOfficeKitCallback = false; mbTiledRendering = bTiledRendering; static bool bDebug = getenv("SW_DEBUG_TILEDRENDERING") != 0; diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index 6a951a1..d4813f9 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -171,6 +171,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, mbSelectAll(false), mpLibreOfficeKitCallback(0), mpLibreOfficeKitData(0), + mbInLibreOfficeKitCallback(false), mpPrePostOutDev(0), // #i72754# maPrePostMapMode() { @@ -249,6 +250,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, mbSelectAll(false), mpLibreOfficeKitCallback(0), mpLibreOfficeKitData(0), + mbInLibreOfficeKitCallback(false), mpPrePostOutDev(0), // #i72754# maPrePostMapMode() { commit c7ce08fbb1fa7f5f91d5fc2b2257370976fc4c30 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jan 23 17:13:03 2015 +0100 sw: missing consts Change-Id: I052c8dfb668cbc31ba03d9b68bc21be58fce0e2a diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 6a73d55..8ee2d11 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -580,11 +580,11 @@ public: /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API for Writer. void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); /// Invokes the registered callback, if there are any. - void libreOfficeKitCallback(int nType, const char* pPayload); + void libreOfficeKitCallback(int nType, const char* pPayload) const; /// Set if we are doing tiled rendering. void setTiledRendering(bool bTiledRendering); /// Are we doing tiled rendering? - bool isTiledRendering(); + bool isTiledRendering() const; }; diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 5e13cd5..0d7dcb7 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -123,7 +123,7 @@ void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallbac mpLibreOfficeKitData = pData; } -void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) +void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const { if (mpLibreOfficeKitCallback) mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); @@ -134,7 +134,7 @@ void SwViewShell::setTiledRendering(bool bTiledRendering) mbTiledRendering = bTiledRendering; } -bool SwViewShell::isTiledRendering() +bool SwViewShell::isTiledRendering() const { return mbTiledRendering; } commit e57a6494da2a3ae3111d9befafb0fc23de80e01f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Sat Jan 24 00:06:56 2015 +0900 android: touch pop-ups keyboard and sends mousebuttondown event Change-Id: I98bf7c5ae4d31ab1a48321d1c5a3a4858cd3e00b diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index f274cf3..a185d79 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -164,6 +164,9 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation private void touch(String touchType, MotionEvent motionEvent, PointF mDocumentTouchCoordinate) { LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); + float x = motionEvent.getX(); + float y = motionEvent.getY(); + mTileProvider.mouseButtonDown(mDocumentTouchCoordinate); } private void createThumbnail(final ThumbnailCreator.ThumbnailCreationTask task) { commit f6e82e2e8bc682a2de8bec19d6226f812f24eaaa Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Sat Jan 24 00:05:23 2015 +0900 android: convert to document coor. and send it with touch event Change-Id: I11286f73d23b21ee1e35e332b64b8bb37f7aaae8 diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java index 9440091..595657f 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java @@ -12,7 +12,6 @@ import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; -import org.libreoffice.LOEventFactory; import org.libreoffice.LOKitShell; import org.libreoffice.LibreOfficeMainActivity; import org.mozilla.gecko.ZoomConstraints; @@ -901,9 +900,15 @@ public class JavaPanZoomController mWaitForDoubleTap = false; } + private PointF getMotionInDocumentCoordinates(MotionEvent motionEvent) { + RectF viewport = getValidViewportMetrics().getViewport(); + PointF viewPoint = new PointF(motionEvent.getX(0), motionEvent.getY(0)); + return mTarget.convertViewPointToLayerPoint(viewPoint); + } + @Override public void onLongPress(MotionEvent motionEvent) { - LOKitShell.sentTouchEvent("LongPress", motionEvent); + LOKitShell.sentTouchEvent("LongPress", motionEvent, getMotionInDocumentCoordinates(motionEvent)); } @Override @@ -911,7 +916,7 @@ public class JavaPanZoomController // When double-tapping is allowed, we have to wait to see if this is // going to be a double-tap. if (!mWaitForDoubleTap) { - LOKitShell.sentTouchEvent("SingleTap", motionEvent); + LOKitShell.sentTouchEvent("SingleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent)); } // return false because we still want to get the ACTION_UP event that triggers this return false; @@ -921,14 +926,14 @@ public class JavaPanZoomController public boolean onSingleTapConfirmed(MotionEvent motionEvent) { // In cases where we don't wait for double-tap, we handle this in onSingleTapUp. if (mWaitForDoubleTap) { - LOKitShell.sentTouchEvent("SingleTap", motionEvent); + LOKitShell.sentTouchEvent("SingleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent)); } return true; } @Override public boolean onDoubleTap(MotionEvent motionEvent) { - LOKitShell.sentTouchEvent("DoubleTap", motionEvent); + LOKitShell.sentTouchEvent("DoubleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent)); return true; } commit 06da73832af106f3b4a1921df53037e81614feae Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Sat Jan 24 00:00:56 2015 +0900 android: view point to document point conversion updated Change-Id: Ie8a712f3fa24d0ffeef3ef524c02e97acdb1237e diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java index 9ec1c98..db21554 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java @@ -398,33 +398,14 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener { return this; } - /** Implementation of PanZoomTarget - * Converts a point from layer view coordinates to layer coordinates. In other words, given a - * point measured in pixels from the top left corner of the layer view, returns the point in - * pixels measured from the last scroll position we sent to Gecko, in CSS pixels. Assuming the - * events being sent to Gecko are processed in FIFO order, this calculation should always be - * correct. - */ public PointF convertViewPointToLayerPoint(PointF viewPoint) { - if (!mGeckoIsReady) { - return null; - } - ImmutableViewportMetrics viewportMetrics = mViewportMetrics; PointF origin = viewportMetrics.getOrigin(); float zoom = viewportMetrics.zoomFactor; - ImmutableViewportMetrics geckoViewport = mGeckoViewport; - PointF geckoOrigin = geckoViewport.getOrigin(); - float geckoZoom = geckoViewport.zoomFactor; - - // viewPoint + origin gives the coordinate in device pixels from the top-left corner of the page. - // Divided by zoom, this gives us the coordinate in CSS pixels from the top-left corner of the page. - // geckoOrigin / geckoZoom is where Gecko thinks it is (scrollTo position) in CSS pixels from - // the top-left corner of the page. Subtracting the two gives us the offset of the viewPoint from - // the current Gecko coordinate in CSS pixels. + PointF layerPoint = new PointF( - ((viewPoint.x + origin.x) / zoom) - (geckoOrigin.x / geckoZoom), - ((viewPoint.y + origin.y) / zoom) - (geckoOrigin.y / geckoZoom)); + ((viewPoint.x + origin.x) / zoom), + ((viewPoint.y + origin.y) / zoom)); return layerPoint; } commit 525d73fc41bdb8afe227d6207e1f5d6df27ca24b Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Jan 23 23:58:28 2015 +0900 android: extend touch event with transformed document coordinate Change-Id: I17e48bd39b799dc41b8d0402652f70d33ba002d7 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java index 809988d..11bd72d 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java @@ -1,5 +1,6 @@ package org.libreoffice; +import android.graphics.PointF; import android.view.KeyEvent; import android.view.MotionEvent; @@ -33,6 +34,7 @@ public class LOEvent implements Comparable<LOEvent> { public SubTile mTile; public String mTouchType; public MotionEvent mMotionEvent; + public PointF mDocumentTouchCoordinate; public KeyEvent mKeyEvent; public LOEvent(int type) { @@ -81,11 +83,12 @@ public class LOEvent implements Comparable<LOEvent> { mTile = tile; } - public LOEvent(int type, String touchType, MotionEvent motionEvent) { + public LOEvent(int type, String touchType, MotionEvent motionEvent, PointF documentTouchCoordinate) { mType = type; mTypeString = "Touch"; mTouchType = touchType; mMotionEvent = motionEvent; + mDocumentTouchCoordinate = documentTouchCoordinate; } public LOEvent(int type, KeyEvent keyEvent) { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index 49da6b4..0f606ed 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -3,6 +3,7 @@ package org.libreoffice; import android.app.ActivityManager; import android.content.Context; +import android.graphics.PointF; import android.os.Handler; import android.util.DisplayMetrics; import android.view.KeyEvent; @@ -72,8 +73,8 @@ public class LOKitShell { /** * Send touch event to LOKitThread. */ - public static void sentTouchEvent(String touchType, MotionEvent motionEvent) { - LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent)); + public static void sentTouchEvent(String touchType, MotionEvent motionEvent, PointF pointF) { + LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent, pointF)); } /** diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index fd88f1c..f274cf3 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -151,7 +151,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (!LOKitShell.isEditingEnabled()) { return; } - touch(event.mTouchType, event.mMotionEvent); + touch(event.mTouchType, event.mMotionEvent, event.mDocumentTouchCoordinate); break; case LOEvent.KEY_PRESS: if (!LOKitShell.isEditingEnabled()) { @@ -162,7 +162,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation } } - private void touch(String touchType, MotionEvent motionEvent) { + private void touch(String touchType, MotionEvent motionEvent, PointF mDocumentTouchCoordinate) { LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); } commit 41e5824de88d9caa62612a8ca7265014635fb3de Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Jan 23 23:55:20 2015 +0900 android: add mouseButtonDown(Up) to TileProvider + impl. Change-Id: I1ca2242d2bc7ee7d2d48a4a5f5bcc6e77edfaa2d diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 08561d8..1ace50f 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -1,6 +1,7 @@ package org.libreoffice; import android.graphics.Bitmap; +import android.graphics.PointF; import android.graphics.RectF; import android.util.Log; import android.view.KeyEvent; @@ -294,6 +295,21 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback mOffice.postKeyEvent(Office.KEY_PRESS, code); } + private void mouseButton(int type, PointF inDocument) { + int x = (int) pixelToTwip(inDocument.x, mDPI); + int y = (int) pixelToTwip(inDocument.y, mDPI); + mDocument.postMouseEvent(type, x, y); + } + + @Override + public void mouseButtonDown(PointF inDocument) { + mouseButton(Document.MOUSE_BUTTON_DOWN, inDocument); + } + + @Override + public void mouseButtonUp(PointF inDocument) { + mouseButton(Document.MOUSE_BUTTON_UP, inDocument); + } @Override protected void finalize() throws Throwable { diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java index 15332a7..f68678a 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java @@ -1,6 +1,7 @@ package org.libreoffice; import android.graphics.Bitmap; +import android.graphics.PointF; import android.view.KeyEvent; import org.mozilla.gecko.gfx.BufferedCairoImage; @@ -23,7 +24,7 @@ public class MockTileProvider implements TileProvider { LibreOfficeMainActivity.mAppContext.mMainHandler.post(new Runnable() { @Override public void run() { - LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().add(partView); + LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdapter().add(partView); } }); } @@ -92,6 +93,16 @@ public class MockTileProvider implements TileProvider { } @Override + public void mouseButtonDown(PointF inDocument) { + + } + + @Override + public void mouseButtonUp(PointF inDocument) { + + } + + @Override public void changePart(int partIndex) { } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index ed9682f..a411879 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -2,6 +2,7 @@ package org.libreoffice; import android.graphics.Bitmap; +import android.graphics.PointF; import android.graphics.RectF; import android.view.KeyEvent; @@ -67,6 +68,18 @@ public interface TileProvider { void keyPress(KeyEvent keyEvent); /** + * Trigger a mouse button down event. + * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered + */ + void mouseButtonDown(PointF documentCoordinate); + + /** + * Trigger a mouse button up event. + * @param documentCoordinate - coordinate relative to the document where the mouse button should be triggered + */ + void mouseButtonUp(PointF documentCoordinate); + + /** * Callback to retrieve invalidation calls */ public interface TileInvalidationCallback { commit 8fa9f14a77216f3aba23db306fe8c4fc7c42b7df Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Jan 23 23:48:14 2015 +0900 android: add some comments to TileProvider interface Change-Id: I1c6f7bccda2392235242f5c26af1437f1365f728 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java index da0d0f4..ed9682f 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java @@ -9,8 +9,14 @@ import org.mozilla.gecko.gfx.CairoImage; import org.mozilla.gecko.gfx.IntSize; public interface TileProvider { + /** + * Returns the page width in pixels. + */ int getPageWidth(); + /** + * Returns the page height in pixels. + */ int getPageHeight(); boolean isReady(); @@ -22,18 +28,42 @@ public interface TileProvider { */ void rerenderTile(CairoImage image, float x, float y, IntSize tileSize, float zoom); + /** + * Change the document part to the one specified by the partIndex input parameter. + * @param partIndex - part index to change to + */ void changePart(int partIndex); + /** + * Get the current document part number. + * @return + */ int getCurrentPartNumber(); Bitmap thumbnail(int size); + /** + * Closes the document. + */ void close(); + /** + * Returns true if the current open document is a text document. + */ boolean isTextDocument(); + /** + * Register a callback that is invoked when a tile invalidation is + * required. + * + * @param tileInvalidationCallback - the tile invalidation callback + */ void registerInvalidationCallback(TileProvider.TileInvalidationCallback tileInvalidationCallback); + /** + * Trigger a key press. + * @param keyEvent - contains the + */ void keyPress(KeyEvent keyEvent); /** commit d0b50231d901b477caacfa8bad7b71cf5b6015cd Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Jan 22 18:27:36 2015 +0100 android: translate DEL/ENTER in LOKitTileProvider Change-Id: Idda4769fc85a4059ba46706430f30ed247dddaa3 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 0e0b031..08561d8 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -278,7 +278,19 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback @Override public void keyPress(KeyEvent keyEvent) { - int code = keyEvent.getUnicodeChar(); + int code = 0; + switch (keyEvent.getKeyCode()) + { + case KeyEvent.KEYCODE_DEL: + code = com.sun.star.awt.Key.BACKSPACE; + break; + case KeyEvent.KEYCODE_ENTER: + code = com.sun.star.awt.Key.RETURN; + break; + default: + code = keyEvent.getUnicodeChar(); + break; + } mOffice.postKeyEvent(Office.KEY_PRESS, code); } commit c1d2c39afbef155b991c211dcef97eeba828b996 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Jan 22 17:50:02 2015 +0100 android: use getUnicodeChar() in LOKitTileProvider Follow gtktiledviewer's approach for keycodes: unless it's a special key, ask the system to provide the Unicode equivalent and send that. This makes typing work, except for special keys. Change-Id: If9891ddfb0d52e1160099aa00580d1b261e71e61 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index a6d8d79..0e0b031 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -278,7 +278,8 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback @Override public void keyPress(KeyEvent keyEvent) { - mOffice.postKeyEvent(Office.KEY_PRESS, keyEvent.getKeyCode()); + int code = keyEvent.getUnicodeChar(); + mOffice.postKeyEvent(Office.KEY_PRESS, code); } commit a791560cb545b548900efd9cf9f73717f12a54e2 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Jan 22 17:03:36 2015 +0100 android: make sure the soffice.cfg directory is always available Otherwise FSStorageFactory::createInstanceWithArguments() would throw, resulting in a css::configuration::CorruptedConfigurationException later, that makes LO throw up its hands in Desktop::Main() and say that the instset is simply corrupted, there is no point in continuing further. Change-Id: I3a401ee77f4fbf1a42a09c5fedd7681b4f32e952 diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index 716ced5..77d2bcf 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -138,11 +138,14 @@ copy-stuff: rm -Rf assets/share # pre-clean it mkdir -p assets/share/config cp -R $(INSTDIR)/share/registry assets/share +# Make sure the soffice.cfg directory is always created, it's not possible to hit any keys without it. if ! test z$(DISABLE_UI) = zTRUE; then \ echo "Copying UI files into the apk"; \ cp -R $(INSTDIR)/share/config/soffice.cfg assets/share/config; \ else \ echo "Skipping UI files"; \ + mkdir -p assets/share/config/soffice.cfg; \ + echo > assets/share/config/soffice.cfg/empty; \ for F in main.xcd res/registry_en-US.xcd; do \ $(SRC_ROOT)/android/mobile-config.py assets/share/registry/$$F assets/share/registry/$$F.new && mv assets/share/registry/$$F.new assets/share/registry/$$F; \ done; \ commit 004695708fac830282fbffd6aac6dcc72887b43d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Jan 22 13:11:12 2015 +0100 android: disable Impress View -> Slide Pane Change-Id: I5a3c014894fe74781cf050f3cd2ce2bcc0395cb3 diff --git a/android/mobile-config.py b/android/mobile-config.py index 93e08c6..aa5d86f 100755 --- a/android/mobile-config.py +++ b/android/mobile-config.py @@ -76,6 +76,7 @@ if __name__ == '__main__': # Don't do pointless Word -> Writer and similar conversions when we have no UI. nsDict = { "component-schema": "{http://openoffice.org/2001/registry}component-schema", + "component-data": "{http://openoffice.org/2001/registry}component-data", "name": "{http://openoffice.org/2001/registry}name", } microsoftImport = '%(component-schema)s[@%(name)s="Common"]/component/group[@%(name)s="Filter"]/group[@%(name)s="Microsoft"]/group[@%(name)s="Import"]/prop' % nsDict @@ -93,6 +94,11 @@ if __name__ == '__main__': for value in prop.findall("value"): value.text = "false" + # Disable Impress View -> Slide Pane + for prop in root.findall('%(component-data)s[@%(name)s="Impress"]/node[@%(name)s="MultiPaneGUI"]/node[@%(name)s="SlideSorterBar"]/node[@%(name)s="Visible"]/prop[@%(name)s="ImpressView"]' % nsDict): + for value in prop.findall("value"): + value.text = "false" + # The namespace prefixes xs and oor are present in attribute *values*, and namespace # declarations for them are needed, even if no actual elements or attributes with these # namespace prefixes are present. Fun. commit 718e46c16d8e1749f78f40eeeb54b4f14b375918 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Jan 22 12:42:16 2015 +0100 configure: fix --with-android-package-name wrt ndk-gdb Default to the package name that makes ndk-gdb happy in case --enable-dbgutil is used (can be extended later to --enable-symbols / --enable-debug as well, if necessary). Change-Id: If9dc09f48c895a4a138c3911f129e84f001d5f43 diff --git a/configure.ac b/configure.ac index 484de13..f20dac0 100644 --- a/configure.ac +++ b/configure.ac @@ -12311,7 +12311,12 @@ if echo "$host_os" | grep -q linux-android ; then ANDROID_PACKAGE_NAME= AC_MSG_CHECKING([for Android package name]) if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then - ANDROID_PACKAGE_NAME="org.example" + if test -n "$ENABLE_DBGUTIL"; then + # Default to the package name that makes ndk-gdb happy. + ANDROID_PACKAGE_NAME="org.libreoffice" + else + ANDROID_PACKAGE_NAME="org.example.libreoffice" + fi AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME]) else commit dbde7f6ab8106649cf7e153bda07c50753f2dad3 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Jan 22 14:44:37 2015 +0900 android: add postMouseEvent to LOKit JNI interface Change-Id: I652a0c365c4a1413226cdd4dc7910e65ac2a5285 diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 4c791cb..3cd9b0e 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -26,6 +26,10 @@ public class Document { public static final int DOCTYPE_DRAWING = 3; public static final int DOCTYPE_OTHER = 4; + public static final int MOUSE_BUTTON_DOWN = 0; + public static final int MOUSE_BUTTON_UP = 1; + public static final int MOUSE_MOVE = 2; + private final ByteBuffer handle; private MessageCallback messageCallback = null; @@ -86,6 +90,14 @@ public class Document { public native void initializeForRendering(); /** + * Post a mouse event to LOK + * @param type - mouse event type + * @param x - x coordinate + * @param y - y coordinate + */ + public native void postMouseEvent(int type, int x, int y); + + /** * Callback to retrieve messages from LOK */ public interface MessageCallback { diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx index 0290222..9ea5107 100644 --- a/desktop/source/lib/lokandroid.cxx +++ b/desktop/source/lib/lokandroid.cxx @@ -277,6 +277,13 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs return result; } +extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postMouseEvent + (JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y) +{ + LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject); + pDocument->pClass->postMouseEvent(pDocument, type, x, y); +} + /* DirectBufferAllocator */ extern "C" SAL_JNI_EXPORT jobject JNICALL Java_org_libreoffice_kit_DirectBufferAllocator_allocateDirectBufferNative commit 3928932fe3fc758fa6b17c1cb6182519c4a8a9c3 Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Jan 22 08:57:23 2015 +0100 android: 'make release-apk' now also accepts the example document. Change-Id: I4144d0ed42a50be4fa91f377f78a20c28fda36f6 diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index 64efa93..716ced5 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -130,7 +130,7 @@ copy-stuff: for F in program/services/services program/services; do \ sed -e 's!uri="vnd.sun.star.expand:$$LO_LIB_DIR/!uri="file://$$APP_DATA_DIR/lib/!g' <$(INSTDIR)/$$F.rdb >assets/$$F.rdb; \ done - cp $(SRC_ROOT)/android/default-document/example.odt assets/example.odt + cp $(if $(exampleDocument),$(exampleDocument),$(SRC_ROOT)/android/default-document/example.odt) assets/example.odt cp $(SRC_ROOT)/readlicense_oo/license/LICENSE assets/license.txt cp $(SRC_ROOT)/readlicense_oo/license/NOTICE assets/notice.txt cp $(WORKDIR)/ComponentTarget/i18npool/util/i18npool.component assets/ComponentTarget/i18npool/util diff --git a/android/Makefile b/android/Makefile index 644d0e6..152b1a7 100644 --- a/android/Makefile +++ b/android/Makefile @@ -13,14 +13,19 @@ include $(module_directory)/../solenv/gbuild/partial_build.mk .PHONY: sign SIGNED_APK := $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer.apk -RELEASE_APK_USAGE := echo; echo "Usage: make versionCode=<version_num+1> key=<key_name> release-apk" +RELEASE_APK_USAGE := echo; echo "Usage: make versionCode=<version_num+1> exampleDocument=</absolute/path/example.odt> key=<key_name> release-apk" release-apk: build + # versionCode and key are mandatory, examplDocument is not @if test -z "$(versionCode)" ; then $(RELEASE_APK_USAGE) ; exit 1 ; fi @if test -z "$(key)" ; then $(RELEASE_APK_USAGE) ; exit 1 ; fi + rm -f $(SIGNED_APK) + + # the actual signing jarsigner --verbose -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.keystore $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer-release-unsigned.apk $(key) $(ANDROID_SDK_HOME)/build-tools/*/zipalign -v 4 $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer-release-unsigned.apk $(SIGNED_APK) + @echo @echo "Resulting signed apk: $(SIGNED_APK)" commit ae924ed3d0a3a9b4f8438c4f1187d8378777bf92 Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Jan 22 08:35:40 2015 +0100 android: Rename 'make sign' to 'make release-apk'. This now also allows to specify the version number; now you want to use: cd android/ make versionCode=<previous_version_num+1> key=<key_name> release-apk Change-Id: I078e8dbbe671969fc3b228ac987cdb9a4a53b281 diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index fd48132..64efa93 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -182,7 +182,11 @@ copy-stuff: echo 'BuildVersion=' >> assets/program/versionrc echo 'buildid=$(shell cd $(SRCDIR) && git log -1 --format=%H)' >> assets/program/versionrc echo 'ReferenceOOoMajorMinor=4.1' >> assets/program/versionrc - sed -i 's|android:versionName=".*"|android:versionName="$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)/$(shell cd $(SRCDIR) && git log -1 --format=%H)/$(OOO_VENDOR)"|' AndroidManifest.xml + sed -e 's|@ANDROID_DEBUGGABLE@|$(if $(ENABLE_DEBUG),android:debuggable="true",)|' \ + -e 's|@ANDROID_INSTALL_LOCATION@|$(if $(ENABLE_DEBUG),internalOnly,preferExternal)|' \ + -e 's|@ANDROID_VERSION_NAME@|$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)/$(shell cd $(SRCDIR) && git log -1 --format=%h)/$(OOO_VENDOR)|' \ + -e 's|@ANDROID_VERSION_NUMBER@|$(if $(versionCode),$(versionCode),1)|' \ + < AndroidManifest.xml.in > AndroidManifest.xml # # .res files mkdir -p assets/program/resource diff --git a/android/Makefile b/android/Makefile index 8a2bdbd..644d0e6 100644 --- a/android/Makefile +++ b/android/Makefile @@ -13,8 +13,11 @@ include $(module_directory)/../solenv/gbuild/partial_build.mk .PHONY: sign SIGNED_APK := $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer.apk +RELEASE_APK_USAGE := echo; echo "Usage: make versionCode=<version_num+1> key=<key_name> release-apk" -sign: build +release-apk: build + @if test -z "$(versionCode)" ; then $(RELEASE_APK_USAGE) ; exit 1 ; fi + @if test -z "$(key)" ; then $(RELEASE_APK_USAGE) ; exit 1 ; fi rm -f $(SIGNED_APK) jarsigner --verbose -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.keystore $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer-release-unsigned.apk $(key) $(ANDROID_SDK_HOME)/build-tools/*/zipalign -v 4 $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer-release-unsigned.apk $(SIGNED_APK) diff --git a/android/experimental/LOAndroid3/AndroidManifest.xml.in b/android/experimental/LOAndroid3/AndroidManifest.xml.in index ac2c8af..3a17f62 100644 --- a/android/experimental/LOAndroid3/AndroidManifest.xml.in +++ b/android/experimental/LOAndroid3/AndroidManifest.xml.in @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.libreoffice" - @ANDROID_INSTALL_LOCATION@ - android:versionCode="1" - android:versionName="@ANDROID_VERSION@"> + android:installLocation="@ANDROID_INSTALL_LOCATION@" + android:versionCode="@ANDROID_VERSION_NUMBER@" + android:versionName="@ANDROID_VERSION_NAME@"> <!-- App requires OpenGL ES 2.0 --> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> diff --git a/configure.ac b/configure.ac index 8ae2852..484de13 100644 --- a/configure.ac +++ b/configure.ac @@ -3789,8 +3789,6 @@ fi if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then ENABLE_DEBUG="TRUE" - ANDROID_DEBUGGABLE='android:debuggable="true"' - ANDROID_INSTALL_LOCATION='android:installLocation="internalOnly"' if test -n "$ENABLE_DBGUTIL" ; then AC_MSG_RESULT([yes (dbgutil)]) else @@ -3798,13 +3796,9 @@ if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" fi else ENABLE_DEBUG="" - ANDROID_DEBUGGABLE="" - ANDROID_INSTALL_LOCATION='android:installLocation="preferExternal"' AC_MSG_RESULT([no]) fi AC_SUBST(ENABLE_DEBUG) -AC_SUBST(ANDROID_DEBUGGABLE) -AC_SUBST(ANDROID_INSTALL_LOCATION) if test "$enable_sal_log" = yes; then ENABLE_SAL_LOG=TRUE @@ -4420,7 +4414,6 @@ if test "$cross_compiling" = "yes"; then bin/get_config_variables \ solenv/bin/getcompver.awk \ solenv/inc/langlist.mk \ - android/experimental/LOAndroid3/AndroidManifest.xml.in \ config_host.mk.in \ Makefile.in \ lo.xcent.in \ @@ -12795,8 +12788,7 @@ if test -f config_host.mk; then config_md5=`$MD5SUM config_host.mk | sed "s/ .*//"` fi -AC_CONFIG_FILES([android/experimental/LOAndroid3/AndroidManifest.xml - config_host.mk +AC_CONFIG_FILES([config_host.mk Makefile lo.xcent instsetoo_native/util/openoffice.lst commit 2d584cb7cc5c5b14d3e158690fb30cd2866ab7c5 Author: Jan Holesovsky <ke...@collabora.com> Date: Thu Jan 22 07:14:34 2015 +0100 android: Bind the release/debug setting to --enable-release-build. Change-Id: I9e9849d91dda0ff9361ef9a0023be18406b067d0 diff --git a/android/experimental/LOAndroid3/Makefile b/android/experimental/LOAndroid3/Makefile index bc37149..c5c18c7 100644 --- a/android/experimental/LOAndroid3/Makefile +++ b/android/experimental/LOAndroid3/Makefile @@ -34,7 +34,7 @@ build-ant: android_version_setup copy-stuff link-so properties $(call COPYJAR,$(INSTDIR)/$(LIBO_SHARE_JAVA_FOLDER)/$${F}.jar); \ done # - unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) $(if $(ENABLE_DEBUG),debug,release) + unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) $(if $(ENABLE_RELEASE_BUILD),release,debug) run: adb shell am start -n $(APP_PACKAGE)/.ui.LibreOfficeUIActivity -e input /assets/test1.odt commit 4c9030beff8519a024f6a1282f15c853368fd24f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Jan 22 13:53:57 2015 +0900 android: it doesn't hurt to log the document filename on load Change-Id: I18554052e543a8799ebb45727947a3466b1c793c diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 78a592b..a6d8d79 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -49,6 +49,8 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback mOffice = new Office(LibreOfficeKit.getLibreOfficeKitHandle()); mInputFile = input; + + Log.i(LOGTAG, "====> Loading file '" + input + "'"); mDocument = mOffice.documentLoad(input); if (mDocument == null) { commit 79317f2fef1e401354fc9c002f313ad43b2f65e6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Jan 22 13:23:10 2015 +0900 android: Fix loading files that have space in the filename Change-Id: Icf540bf199b3daf79e4eca9b0a403978b6cae18c diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index 48c46ff..1b20328 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -96,7 +96,7 @@ public class LibreOfficeMainActivity extends LOAbout { LayoutInflater.from(this).setFactory(ViewFactory.getInstance()); if (getIntent().getData() != null) { - mInputFile = getIntent().getData().getEncodedPath(); + mInputFile = getIntent().getData().getPath(); } else { mInputFile = DEFAULT_DOC_PATH; } commit 52246e009758165b7fbe603eb24269d0a0d154c7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 18:34:21 2015 +0100 SwXTextDocument::postMouseEvent: missing guard Change-Id: I1141fe501eddb84a77a7f9f3fdd248a205f2a10c diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index cd4b4bc..e0de39b 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3175,6 +3175,8 @@ void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* p void SwXTextDocument::postMouseEvent(int nType, int nX, int nY) { + SolarMutexGuard aGuard; + SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); MouseEvent aEvent(Point(nX, nY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); commit 3d4c1b9dcebaeefaf70dd9191f0573f050297d11 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 17:57:05 2015 +0100 Initial SwEditWin::LogicMouseButtonDown/Up This makes single left mouse button clicks work while editing. The idea is that when we do tiled rendering, we get the click position in document coordinates (twips) and SwEditWin::MouseButtonDown() can check if we're doing tiled rendering. For now, make sure that the position is not passed to any other methods in the tiled rendering case, those may interpret them as pixels, which is not true. Change-Id: Icbd16411596393ed983a87fd3a59a08e4fda3696 diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index d04e3d7..61e99cf 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -2816,6 +2816,7 @@ void SwEditWin::MoveCursor( SwWrtShell &rSh, const Point aDocPos, void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) { SwWrtShell &rSh = m_rView.GetWrtShell(); + bool bTiledRendering = rSh.isTiledRendering(); const SwField *pCrsrFld = rSh.CrsrInsideInputFld() ? rSh.GetCurFld( true ) : NULL; // We have to check if a context menu is shown and we have an UI @@ -2832,7 +2833,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) MouseEvent rMEvt(_rMEvt); - if (m_rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel())) + if (!bTiledRendering && m_rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel())) return; m_rView.GetPostItMgr()->SetActiveSidebarWin(0); @@ -2851,7 +2852,11 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) m_bWasShdwCrsr = 0 != m_pShadCrsr; delete m_pShadCrsr, m_pShadCrsr = 0; - const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) ); + Point aDocPos; + if (bTiledRendering) + aDocPos = rMEvt.GetPosPixel(); + else + aDocPos = PixelToLogic( rMEvt.GetPosPixel() ); // How many clicks do we need to select a fly frame? FrameControlType eControl; @@ -2973,7 +2978,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) SET_CURR_SHELL( &rSh ); SdrView *pSdrView = rSh.GetDrawView(); - if ( pSdrView ) + if ( pSdrView && !bTiledRendering) { if (pSdrView->MouseButtonDown( rMEvt, this ) ) { @@ -3022,7 +3027,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) m_rView.InvalidateRulerPos(); SfxBindings& rBind = m_rView.GetViewFrame()->GetBindings(); rBind.Update(); - if ( RulerColumnDrag( rMEvt, + if ( !bTiledRendering && RulerColumnDrag( rMEvt, (SwTab::COL_VERT == nMouseTabCol || SwTab::ROW_HORI == nMouseTabCol)) ) { m_rView.SetTabColFromDoc( false ); @@ -3046,7 +3051,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) SfxBindings& rBind = m_rView.GetViewFrame()->GetBindings(); rBind.Update(); - if ( RulerMarginDrag( rMEvt, + if ( !bTiledRendering && RulerMarginDrag( rMEvt, rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPos ) ) ) { m_rView.SetNumRuleNodeFromDoc( NULL ); @@ -3101,7 +3106,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) return; } } - if ( EnterDrawMode( rMEvt, aDocPos ) ) + if ( !bTiledRendering && EnterDrawMode( rMEvt, aDocPos ) ) { bNoInterrupt = false; return; @@ -3176,7 +3181,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) SwEditWin::m_nDDStartPosX = aDocPos.X(); // hit an URL in DrawText object? - if (bExecHyperlinks && pSdrView) + if (bExecHyperlinks && pSdrView && !bTiledRendering) { SdrViewEvent aVEvt; pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); @@ -3743,7 +3748,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) } } - if (bCallBase) + if (bCallBase && !bTiledRendering) Window::MouseButtonDown(rMEvt); } @@ -6254,12 +6259,17 @@ void SwEditWin::LogicMouseMove(const MouseEvent& /*rMouseEvent*/) { } -void SwEditWin::LogicMouseButtonDown(const MouseEvent& /*rMouseEvent*/) +void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent) { + // When we're not doing tiled rendering, then positions must be passed as pixels. + assert(m_rView.GetWrtShell().isTiledRendering()); + MouseButtonDown(rMouseEvent); } -void SwEditWin::LogicMouseButtonUp(const MouseEvent& /*rMouseEvent*/) +void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent) { + assert(m_rView.GetWrtShell().isTiledRendering()); + MouseButtonUp(rMouseEvent); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 752d15176fe6c3361288f3939508cd9d4497115d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 12:52:30 2015 +0100 Add SwXTextDocument::postMouseEvent() Change-Id: Ic2e6343288e87e23026b2f0c17338ecf5f1bed99 diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index a837c76..2d5161e 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -413,6 +413,8 @@ public: * @param pData is private data of the client that will be sent back when the callback is invoked */ virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postMouseEvent(). + virtual void postMouseEvent(int nType, int nX, int nY) SAL_OVERRIDE; void Invalidate(); void Reactivate(SwDocShell* pNewDocShell); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index fef9d4d..d04e3d7 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6250,15 +6250,15 @@ void SwEditWin::LogicInvalidate(const vcl::Region* pRegion) m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } -void SwEditWin::LogicMouseMove(const MouseEvent& rMouseEvent) +void SwEditWin::LogicMouseMove(const MouseEvent& /*rMouseEvent*/) { } -void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent) +void SwEditWin::LogicMouseButtonDown(const MouseEvent& /*rMouseEvent*/) { } -void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent) +void SwEditWin::LogicMouseButtonUp(const MouseEvent& /*rMouseEvent*/) { } diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index c28ad6e..c1018f8 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -302,8 +302,11 @@ public: * @param pRegion If 0, that means the whole area, otherwise the area in logic coordinates. */ void LogicInvalidate(const vcl::Region* pRegion) SAL_OVERRIDE; + /// Same as MouseMove(), but coordinates are in logic unit. void LogicMouseMove(const MouseEvent& rMouseEvent); + /// Same as MouseButtonDown(), but coordinates are in logic unit. void LogicMouseButtonDown(const MouseEvent& rMouseEvent); + /// Same as MouseButtonUp(), but coordinates are in logic unit. void LogicMouseButtonUp(const MouseEvent& rMouseEvent); }; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 08fd4a4..cd4b4bc 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -129,6 +129,7 @@ #include <swatrset.hxx> #include <view.hxx> #include <srcview.hxx> +#include <edtwin.hxx> #include <svtools/langtab.hxx> #include <map> @@ -3172,6 +3173,25 @@ void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* p pViewShell->registerLibreOfficeKitCallback(pCallback, pData); } +void SwXTextDocument::postMouseEvent(int nType, int nX, int nY) +{ + SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); + MouseEvent aEvent(Point(nX, nY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + + switch (nType) + { + case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: + rEditWin.LogicMouseButtonDown(aEvent); + break; + case LOK_MOUSEEVENT_MOUSEBUTTONUP: + rEditWin.LogicMouseButtonUp(aEvent); + break; + default: + assert(false); + break; + } +} + void * SAL_CALL SwXTextDocument::operator new( size_t t) throw() { return SwXTextDocumentBaseClass::operator new(t); commit bb0b878b9d8a63e43c5063b65b1b2381621a18f6 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 12:42:08 2015 +0100 LOK: move postMouseEvent to Document Change-Id: I5d2d2d05fc0f55d98a1e7a1591b4d66fd93ad353 diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e8f98aa..154a8f5a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -203,6 +203,10 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis); static void doc_registerCallback(LibreOfficeKitDocument* pThis, LibreOfficeKitCallback pCallback, void* pData); +static void doc_postMouseEvent (LibreOfficeKitDocument* pThis, + int nType, + int nX, + int nY); struct LibLODocument_Impl : public _LibreOfficeKitDocument { @@ -230,6 +234,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument m_pDocumentClass->getDocumentSize = doc_getDocumentSize; m_pDocumentClass->initializeForRendering = doc_initializeForRendering; m_pDocumentClass->registerCallback = doc_registerCallback; + m_pDocumentClass->postMouseEvent = doc_postMouseEvent; gDocumentClass = m_pDocumentClass; } @@ -253,7 +258,6 @@ static int lo_initialize (LibreOfficeKit* pThis, const ch static LibreOfficeKitDocument* lo_documentLoad (LibreOfficeKit* pThis, const char* pURL); static char * lo_getError (LibreOfficeKit* pThis); static void lo_postKeyEvent (LibreOfficeKit* pThis, int nType, int nCode); -static void lo_postMouseEvent (LibreOfficeKit* pThis, int nType, int nX, int nY); struct LibLibreOffice_Impl : public _LibreOfficeKit @@ -273,7 +277,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit m_pOfficeClass->documentLoad = lo_documentLoad; m_pOfficeClass->getError = lo_getError; m_pOfficeClass->postKeyEvent = lo_postKeyEvent; - m_pOfficeClass->postMouseEvent = lo_postMouseEvent; gOfficeClass = m_pOfficeClass; } @@ -644,6 +647,19 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, pDoc->registerCallback(pCallback, pData); } +static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + pDoc->postMouseEvent(nType, nX, nY); +} + + static char* lo_getError (LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); @@ -672,28 +688,6 @@ static void lo_postKeyEvent(LibreOfficeKit* /*pThis*/, int nType, int nCode) #endif } -static void lo_postMouseEvent(LibreOfficeKit* /*pThis*/, int nType, int nX, int nY) -{ -#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) - if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame()) - { - MouseEvent aEvent = MouseEvent(Point(nX, nY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); - switch (nType) - { - case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: - Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pFocus->GetWindow(), &aEvent); - break; - case LOK_MOUSEEVENT_MOUSEBUTTONUP: - Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONUP, pFocus->GetWindow(), &aEvent); - break; - default: - assert(false); - break; - } - } -#endif -} - static void force_c_locale(void) { // force locale (and resource files loaded) to en-US diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 397d435..991fae4 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -100,7 +100,6 @@ struct _LibreOfficeKitClass LibreOfficeKitDocument* (*documentLoad) (LibreOfficeKit* pThis, const char* pURL); char* (*getError) (LibreOfficeKit* pThis); void (*postKeyEvent) (LibreOfficeKit* pThis, int nType, int nCode); - void (*postMouseEvent)(LibreOfficeKit* pThis, int nType, int nX, int nY); }; #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize) @@ -165,9 +164,12 @@ struct _LibreOfficeKitDocumentClass void (*registerCallback) (LibreOfficeKitDocument* pThis, LibreOfficeKitCallback pCallback, void* pData); - void (*postKeyEvent) (LibreOfficeKitDocument* pThis, - int nType, - int nCode); + + /// @see lok::Document::postMouseEvent + void (*postMouseEvent)(LibreOfficeKitDocument* pThis, + int nType, + int nX, + int nY); #endif // LOK_USE_UNSTABLE_API }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index bd3ce55..f3b3e88 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -104,6 +104,18 @@ public: { mpDoc->pClass->registerCallback(mpDoc, pCallback, pData); } + + /** + * Posts a mouse event to the document. + * + * @param nType Event type, like down, move or up. + * @param nX horizontal position in document coordinates + * @param nY vertical position in document coordinates + */ + inline void postMouseEvent(int nType, int nX, int nY) + { + mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY); + } #endif // LOK_USE_UNSTABLE_API }; @@ -146,18 +158,6 @@ public: { mpThis->pClass->postKeyEvent(mpThis, nType, nCode); } - - /** - * Posts a mouse event to the focused frame. - * - * @param nType Event type, like down, move or up. - * @param nX horizontal position - * @param nY vertical position - */ - inline void postMouseEvent(int nType, int nX, int nY) - { - mpThis->pClass->postMouseEvent(mpThis, nType, nX, nY); - } }; inline Office* lok_cpp_init(const char* pInstallPath) diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 15630c1..8711611 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -96,6 +96,13 @@ public: * @param pData is private data of the client that will be sent back when the callback is invoked */ virtual void registerCallback(LibreOfficeKitCallback /*pCallback*/, void* /*pData*/) { } + + /** + * Posts a mouse event on the document. + * + * @see lok::Document::postMouseEvent(). + */ + virtual void postMouseEvent(int /*nType*/, int /*nX*/, int /*nY*/) { } }; } // namespace vcl diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index 972acab..bb2444c 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -45,10 +45,10 @@ void lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* switch (pEvent->type) { case GDK_BUTTON_PRESS: - pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); + pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); break; case GDK_BUTTON_RELEASE: - pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); + pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); break; default: break; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 7001bf0..fef9d4d 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6250,4 +6250,16 @@ void SwEditWin::LogicInvalidate(const vcl::Region* pRegion) m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } +void SwEditWin::LogicMouseMove(const MouseEvent& rMouseEvent) +{ +} + +void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent) +{ +} + +void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent) +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index 3866dbf..c28ad6e 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -302,6 +302,9 @@ public: * @param pRegion If 0, that means the whole area, otherwise the area in logic coordinates. */ void LogicInvalidate(const vcl::Region* pRegion) SAL_OVERRIDE; + void LogicMouseMove(const MouseEvent& rMouseEvent); + void LogicMouseButtonDown(const MouseEvent& rMouseEvent); + void LogicMouseButtonUp(const MouseEvent& rMouseEvent); }; #endif commit 167412ce5e10f2e84ac960eb99bf9ce87df03050 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 21 15:05:34 2015 +0100 android: Add makefile rule to sign the resulting .apk. To sign, do: cd android make key=<your_key_name> sign Change-Id: I20214e034f997125ccfd122b97d18ae141130336 diff --git a/android/Makefile b/android/Makefile index 0c6f47b..8a2bdbd 100644 --- a/android/Makefile +++ b/android/Makefile @@ -10,4 +10,15 @@ module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) include $(module_directory)/../solenv/gbuild/partial_build.mk +.PHONY: sign + +SIGNED_APK := $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer.apk + +sign: build + rm -f $(SIGNED_APK) + jarsigner --verbose -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.keystore $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer-release-unsigned.apk $(key) + $(ANDROID_SDK_HOME)/build-tools/*/zipalign -v 4 $(BUILDDIR)/android/experimental/LOAndroid3/bin/LibreOfficeViewer-release-unsigned.apk $(SIGNED_APK) + @echo + @echo "Resulting signed apk: $(SIGNED_APK)" + # vim: set noet sw=4 ts=4: commit 94ec99db8a35094758f240451a8a7acbe4bab540 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 14:55:27 2015 +0100 android: fix crash in tile provider while closing the document The problem was that for large documents if "back" was pressed quickly, then we closed the document, but rendering thumbnails for the different parts was still in progress. Just make sure we don't crash when the underlying document is gone. E/AndroidRuntime( 8902): java.lang.NullPointerException E/AndroidRuntime( 8902): at org.libreoffice.LOKitTileProvider.thumbnail(LOKitTileProvider.java:244) E/AndroidRuntime( 8902): at org.libreoffice.ThumbnailCreator$ThumbnailCreationTask.getThumbnail(ThumbnailCreator.java:78) E/AndroidRuntime( 8902): at org.libreoffice.LOKitThread.createThumbnail(LOKitThread.java:170) E/AndroidRuntime( 8902): at org.libreoffice.LOKitThread.processEvent(LOKitThread.java:148) E/AndroidRuntime( 8902): at org.libreoffice.LOKitThread.run(LOKitThread.java:120) Change-Id: I93e8e1ea19545ca196ef6f59d19528bb42f3676d diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 0970bbb..78a592b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -241,7 +241,8 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback Log.w(LOGTAG, "Thumbnail size: " + getPageWidth() + " " + getPageHeight() + " " + widthPixel + " " + heightPixel); ByteBuffer buffer = ByteBuffer.allocateDirect(widthPixel * heightPixel * 4); - mDocument.paintTile(buffer, widthPixel, heightPixel, 0, 0, (int) mWidthTwip, (int) mHeightTwip); + if (mDocument != null) + mDocument.paintTile(buffer, widthPixel, heightPixel, 0, 0, (int) mWidthTwip, (int) mHeightTwip); Bitmap bitmap = Bitmap.createBitmap(widthPixel, heightPixel, Bitmap.Config.ARGB_8888); bitmap.copyPixelsFromBuffer(buffer); @@ -287,12 +288,18 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback @Override public void changePart(int partIndex) { + if (mDocument == null) + return; + mDocument.setPart(partIndex); resetDocumentSize(); } @Override public int getCurrentPartNumber() { + if (mDocument == null) + return 0; + return mDocument.getPart(); } commit 2b67566adef887664ca41457e4ebeb327cb95e56 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 21 12:50:51 2015 +0100 android: Set the debug / release according to the configure setting. Change-Id: Ic1c4328b21e1cdca2fdb1aee72b8563af8f770c7 diff --git a/android/experimental/LOAndroid3/Makefile b/android/experimental/LOAndroid3/Makefile index e700daa..bc37149 100644 --- a/android/experimental/LOAndroid3/Makefile +++ b/android/experimental/LOAndroid3/Makefile @@ -7,6 +7,7 @@ endif all: build-ant # The package of this app +# The setting from configure (ANDROID_PACKAGE_NAME) is applied in later stages. APP_PACKAGE=org.libreoffice DISABLE_UI=TRUE @@ -33,7 +34,7 @@ build-ant: android_version_setup copy-stuff link-so properties $(call COPYJAR,$(INSTDIR)/$(LIBO_SHARE_JAVA_FOLDER)/$${F}.jar); \ done # - unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) debug + unset JAVA_HOME && $(ANT) $(if $(VERBOSE)$(verbose),,-quiet) $(if $(ENABLE_DEBUG),debug,release) run: adb shell am start -n $(APP_PACKAGE)/.ui.LibreOfficeUIActivity -e input /assets/test1.odt commit 722d4f0cab4897065244f8dc5991394b8030987a Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 21 12:44:03 2015 +0100 android: Fix release build via top level 'make'. Change-Id: I342e3dfd1e142d4be14162fd8a68876d038ed5ea diff --git a/android/CustomTarget_android_desktop.mk b/android/CustomTarget_android_desktop.mk index e301ee9..715fd8c 100644 --- a/android/CustomTarget_android_desktop.mk +++ b/android/CustomTarget_android_desktop.mk @@ -27,7 +27,7 @@ $(android_desktop_DIR)/done : $(call gb_Postprocess_get_target,AllModulesButInst # the apps as such are mostly useless. # Us "foo" instead of the old INPATH mkdir -p $(BUILDDIR)/instsetoo_native/foo/bin; \ - cp $(SRCDIR)/android/experimental/desktop/bin/*-debug.apk $(BUILDDIR)/instsetoo_native/foo/bin + cp $(SRCDIR)/android/experimental/desktop/bin/*.apk $(BUILDDIR)/instsetoo_native/foo/bin $(call gb_CustomTarget_get_clean_target,android/desktop) : $(call gb_Output_announce,$(subst $(WORKDIR)/Clean/,,$@),$(false),MAK,2) diff --git a/android/CustomTarget_lo_android.mk b/android/CustomTarget_lo_android.mk index 4d32cac..5ee53d4 100644 --- a/android/CustomTarget_lo_android.mk +++ b/android/CustomTarget_lo_android.mk @@ -27,7 +27,7 @@ $(loandroid3_DIR)/done : $(call gb_Postprocess_get_target,AllModulesButInstsetNa # the apps as such are mostly useless. # Us "foo" instead of the old INPATH mkdir -p $(BUILDDIR)/instsetoo_native/foo/bin; \ - cp $(SRCDIR)/android/experimental/LOAndroid3/bin/*-debug.apk $(BUILDDIR)/instsetoo_native/foo/bin + cp $(SRCDIR)/android/experimental/LOAndroid3/bin/*.apk $(BUILDDIR)/instsetoo_native/foo/bin $(call gb_CustomTarget_get_clean_target,android/loandroid3) : $(call gb_Output_announce,$(subst $(WORKDIR)/Clean/,,$@),$(false),MAK,2) commit 609367d3c92eb552514636d1176ae878b3417aa7 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 21 12:43:03 2015 +0100 android: Set the package name correctly. Change-Id: Iab771f65121e477cda871a04098df306399628e7 diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index 3332646..fd48132 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -38,10 +38,10 @@ endef # # Horrors below: # -$(BOOTSTRAPDIR)/no-resource-compress.xml : $(ANDROID_SDK_HOME)/tools/ant/build.xml +$(BOOTSTRAPDIR)/no-resource-compress.xml : $(ANDROID_SDK_HOME)/tools/ant/build.xml $(BOOTSTRAPDIR)/no-resource-compress-*.xml ( \ android_sdk_ver=`grep 'Pkg.Revision' $(ANDROID_SDK_HOME)/tools/source.properties | sed 's/^.*=//' | sed 's/\..*//'` ; \ - cp $(BOOTSTRAPDIR)/no-resource-compress-$$android_sdk_ver.xml $(BOOTSTRAPDIR)/no-resource-compress.xml ; \ + sed 's/@ANDROID_PACKAGE_NAME@/$(ANDROID_PACKAGE_NAME)/' < $(BOOTSTRAPDIR)/no-resource-compress-$$android_sdk_ver.xml > $@ ; \ if ! test -f $(BOOTSTRAPDIR)/no-resource-compress.xml; then \ echo "Unknown Android SDK version: $$android_sdk_ver"; \ exit 1; \ diff --git a/android/Bootstrap/no-resource-compress-20.xml b/android/Bootstrap/no-resource-compress-20.xml index d6fb925..dd0fee0 100644 --- a/android/Bootstrap/no-resource-compress-20.xml +++ b/android/Bootstrap/no-resource-compress-20.xml @@ -19,6 +19,7 @@ <do-only-if-not-library elseText="Library project: do not package resources..." > <aapt executable="${aapt}" command="package" + manifestpackage="@ANDROID_PACKAGE_NAME@" versioncode="${version.code}" versionname="${version.name}" debug="${build.is.packaging.debug}" diff --git a/android/Bootstrap/no-resource-compress-21.xml b/android/Bootstrap/no-resource-compress-21.xml index 2b29782..c06f839 100644 --- a/android/Bootstrap/no-resource-compress-21.xml +++ b/android/Bootstrap/no-resource-compress-21.xml @@ -19,6 +19,7 @@ <do-only-if-not-library elseText="Library project: do not package resources..." > <aapt executable="${aapt}" command="package" + manifestpackage="@ANDROID_PACKAGE_NAME@" versioncode="${version.code}" versionname="${version.name}" debug="${build.is.packaging.debug}" diff --git a/android/Bootstrap/no-resource-compress-22.xml b/android/Bootstrap/no-resource-compress-22.xml index 2b29782..c06f839 100644 --- a/android/Bootstrap/no-resource-compress-22.xml +++ b/android/Bootstrap/no-resource-compress-22.xml @@ -19,6 +19,7 @@ <do-only-if-not-library elseText="Library project: do not package resources..." > <aapt executable="${aapt}" command="package" + manifestpackage="@ANDROID_PACKAGE_NAME@" versioncode="${version.code}" versionname="${version.name}" debug="${build.is.packaging.debug}" diff --git a/android/Bootstrap/no-resource-compress-23.xml b/android/Bootstrap/no-resource-compress-23.xml index 2b29782..c06f839 100644 --- a/android/Bootstrap/no-resource-compress-23.xml +++ b/android/Bootstrap/no-resource-compress-23.xml @@ -19,6 +19,7 @@ <do-only-if-not-library elseText="Library project: do not package resources..." > <aapt executable="${aapt}" command="package" + manifestpackage="@ANDROID_PACKAGE_NAME@" versioncode="${version.code}" versionname="${version.name}" debug="${build.is.packaging.debug}" diff --git a/android/Bootstrap/no-resource-compress-24.xml b/android/Bootstrap/no-resource-compress-24.xml index 2b29782..c06f839 100644 --- a/android/Bootstrap/no-resource-compress-24.xml +++ b/android/Bootstrap/no-resource-compress-24.xml @@ -19,6 +19,7 @@ <do-only-if-not-library elseText="Library project: do not package resources..." > <aapt executable="${aapt}" command="package" + manifestpackage="@ANDROID_PACKAGE_NAME@" versioncode="${version.code}" versionname="${version.name}" debug="${build.is.packaging.debug}" diff --git a/config_host.mk.in b/config_host.mk.in index 26e38ea..ac811c9 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -20,6 +20,7 @@ export ALL_LANGS=@ALL_LANGS@ export ANDROID_APP_ABI=@ANDROID_APP_ABI@ export ANDROID_NDK_GDBSERVER=@ANDROID_NDK_GDBSERVER@ export ANDROID_SDK_HOME=@ANDROID_SDK_HOME@ +export ANDROID_PACKAGE_NAME=@ANDROID_PACKAGE_NAME@ export ANT=@ANT@ export ANT_HOME=@ANT_HOME@ export ANT_LIB=@ANT_LIB@ commit ef99aeea0e8f671dd0cb72aa311a80b8025f495d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 11:27:05 2015 +0100 android: eliminate hardcoded LibreOfficeMainActivity and package in LOAbout Change-Id: I276f27a96b4fb970520dec588b9321731e7fc26b diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java index 27bb50a..13c436f 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOAbout.java @@ -39,9 +39,9 @@ public abstract class LOAbout extends Activity { private void loadFromAbout(String input) { if (mNewActivity) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.fromFile(new File(input))); - i.setComponent(new ComponentName( - "org.libreoffice", - "org.libreoffice.LibreOfficeMainActivity")); + String packageName = getApplicationContext().getPackageName(); + ComponentName componentName = new ComponentName(packageName, LibreOfficeMainActivity.class.getName()); + i.setComponent(componentName); startActivity(i); } else { LOKitShell.sendEvent(LOEventFactory.close()); commit 872e5d85519f09b85cbde2dfb1c07ff0c825ff8d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 15:30:54 2015 +0900 Revert "android: store tiles in Map for faster access to tiles" This reverts commit 6263bcfd70bf76dbcdf6b7e35bb02e48e44cbd94. Conflicts: android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java Change-Id: I2fbd0b67aa3ccf0f629ce4af8788236d297144e5 diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index d917c03..ca25438 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -14,18 +14,14 @@ import org.libreoffice.LOKitShell; import org.libreoffice.TileIdentifier; import org.mozilla.gecko.util.FloatUtils; -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; public abstract class ComposedTileLayer extends Layer implements ComponentCallbacks2 { private static final String LOGTAG = ComposedTileLayer.class.getSimpleName(); - protected final ConcurrentMap<TileIdentifier, SubTile> tiles = new ConcurrentHashMap<TileIdentifier, SubTile>(); - protected final Set<TileIdentifier> newTileIds = Collections.newSetFromMap(new ConcurrentHashMap<TileIdentifier, Boolean>()); + protected final List<SubTile> tiles = new CopyOnWriteArrayList<SubTile>(); protected final IntSize tileSize; protected RectF currentViewport = new RectF(); @@ -37,7 +33,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } public void invalidate() { - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { tile.invalidate(); } } @@ -45,14 +41,14 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba @Override public void beginTransaction() { super.beginTransaction(); - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { tile.beginTransaction(); } } @Override public void endTransaction() { - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { tile.endTransaction(); } super.endTransaction(); @@ -60,7 +56,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba @Override public void draw(RenderContext context) { - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { if (RectF.intersects(tile.getBounds(context), context.viewport)) { tile.draw(context); } @@ -71,7 +67,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba protected void performUpdates(RenderContext context) { super.performUpdates(context); - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { tile.beginTransaction(); tile.refreshTileMetrics(); tile.endTransaction(); @@ -82,7 +78,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba @Override public Region getValidRegion(RenderContext context) { Region validRegion = new Region(); - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { validRegion.op(tile.getValidRegion(context), Region.Op.UNION); } @@ -92,7 +88,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba @Override public void setResolution(float newResolution) { super.setResolution(newResolution); - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { tile.setResolution(newResolution); } } @@ -159,9 +155,14 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba if (x > pageRect.width()) { continue; } - TileIdentifier tileId = new TileIdentifier((int) x, (int) y, currentZoom, tileSize); - if (!tiles.containsKey(tileId) && !newTileIds.contains(tileId)) { - newTileIds.add(tileId); + boolean contains = false; + for (SubTile tile : tiles) { + if (tile.id.x == x && tile.id.y == y && tile.id.zoom == currentZoom) { + contains = true; + } + } + if (!contains) { + TileIdentifier tileId = new TileIdentifier((int) x, (int) y, currentZoom, tileSize); LOEvent event = LOEventFactory.tileRequest(this, tileId, true); event.mPriority = getTilePriority(); LOKitShell.sendEvent(event); @@ -171,18 +172,18 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } private void clearMarkedTiles() { - Iterator<Map.Entry<TileIdentifier, SubTile>> iterator; - for (iterator = tiles.entrySet().iterator(); iterator.hasNext();) { - SubTile tile = iterator.next().getValue(); + List<SubTile> tilesToRemove = new ArrayList<SubTile>(); + for (SubTile tile : tiles) { if (tile.markedForRemoval) { tile.destroy(); - iterator.remove(); + tilesToRemove.add(tile); } } + tiles.removeAll(tilesToRemove); } private void markTiles() { - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { if (FloatUtils.fuzzyEquals(tile.id.zoom, currentZoom)) { RectF tileRect = tile.id.getRectF(); if (!RectF.intersects(currentViewport, tileRect)) { @@ -201,8 +202,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba public void addTile(SubTile tile) { tile.beginTransaction(); - tiles.put(tile.id, tile); - newTileIds.remove(tile.id); + tiles.add(tile); } public boolean isStillValid(TileIdentifier tileId) { @@ -215,7 +215,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba public void invalidateTiles(RectF cssRect) { RectF zoomedRect = RectUtils.scale(cssRect, currentZoom); - for (SubTile tile : tiles.values()) { + for (SubTile tile : tiles) { if (RectF.intersects(zoomedRect, tile.id.getRectF())) { LOKitShell.sendEvent(LOEventFactory.tileRerender(this, tile)); } @@ -241,6 +241,5 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } public void cleanupInvalidTile(TileIdentifier tileId) { - newTileIds.remove(tileId); } -} \ No newline at end of file +} commit 784a1765d7e90382d7656eea569c2d66c0ba1c5f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 14:53:26 2015 +0900 android: guard rendering if buffer could not be allocated Change-Id: I51a8f7f56531e5f0c4cb966c44be40913c557da7 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 9a32fe8..fd88f1c 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -30,12 +30,11 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation private void tileRequest(ComposedTileLayer composedTileLayer, TileIdentifier tileId, boolean forceRedraw) { if (composedTileLayer.isStillValid(tileId)) { CairoImage image = mTileProvider.createTile(tileId.x, tileId.y, tileId.size, tileId.zoom); - mViewportMetrics = mLayerClient.getViewportMetrics(); - mLayerClient.beginDrawing(); - SubTile tile = new SubTile(image, tileId); - composedTileLayer.addTile(tile); - mLayerClient.endDrawing(mViewportMetrics); - if (forceRedraw) { + if (image != null) { + mLayerClient.beginDrawing(); + SubTile tile = new SubTile(image, tileId); + composedTileLayer.addTile(tile); + mLayerClient.endDrawing(mViewportMetrics); mLayerClient.forceRender(); } } else { commit 3596abe1d84e1bc9323254e0a0d60b19851d5db5 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 13:50:22 2015 +0900 android: getRect renamed to getRectF - adapt the code to this Change-Id: Id0248803fbd8fedf846d7741a2faddb9bfd171e0 diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index db27d1b..d917c03 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -184,7 +184,7 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba private void markTiles() { for (SubTile tile : tiles.values()) { if (FloatUtils.fuzzyEquals(tile.id.zoom, currentZoom)) { - RectF tileRect = tile.id.getRect(); + RectF tileRect = tile.id.getRectF(); if (!RectF.intersects(currentViewport, tileRect)) { tile.markForRemoval(); } @@ -206,16 +206,17 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } public boolean isStillValid(TileIdentifier tileId) { - return RectF.intersects(currentViewport, tileId.getRect()) || currentViewport.contains(tileId.getRect()); + return RectF.intersects(currentViewport, tileId.getRectF()) || currentViewport.contains(tileId.getRectF()); } /** * Invalidate tiles which intersect the input rect */ - public void invalidateTiles(RectF rect) { - RectF zoomedRect = RectUtils.scale(rect, currentZoom); + public void invalidateTiles(RectF cssRect) { + RectF zoomedRect = RectUtils.scale(cssRect, currentZoom); + for (SubTile tile : tiles.values()) { - if (RectF.intersects(zoomedRect, tile.id.getRect())) { + if (RectF.intersects(zoomedRect, tile.id.getRectF())) { LOKitShell.sendEvent(LOEventFactory.tileRerender(this, tile)); } } commit 3135fbb42eab592d3f1d89e9b90cc135dce56486 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 13:46:06 2015 +0900 android: invalidate only new/changed tiles - big perf. improvement Previously on every rerender or draw event all tiles were invalidated (which means they were reuploaded to GPU even when the tiles didn't change). This was changed to only invalidate tiles that did actually change. Change-Id: I50a8b51b9d5b44797ac3e2dedd20cfb07fb2bb8b diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index ed63cd7..9a32fe8 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -30,6 +30,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation private void tileRequest(ComposedTileLayer composedTileLayer, TileIdentifier tileId, boolean forceRedraw) { if (composedTileLayer.isStillValid(tileId)) { CairoImage image = mTileProvider.createTile(tileId.x, tileId.y, tileId.size, tileId.zoom); + mViewportMetrics = mLayerClient.getViewportMetrics(); mLayerClient.beginDrawing(); SubTile tile = new SubTile(image, tileId); composedTileLayer.addTile(tile); @@ -46,6 +47,7 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (composedTileLayer.isStillValid(tile.id) && !tile.markedForRemoval) { mLayerClient.beginDrawing(); mTileProvider.rerenderTile(tile.getImage(), tile.id.x, tile.id.y, tile.id.size, tile.id.zoom); + tile.invalidate(); mLayerClient.endDrawing(mViewportMetrics); mLayerClient.forceRender(); } diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java index 1006383..9ec1c98 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java @@ -277,8 +277,8 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener { try { mNewGeckoViewport = viewportMetrics; updateViewport(); - mLowResLayer.invalidate(); - mRootLayer.invalidate(); + //mLowResLayer.invalidate(); + //mRootLayer.invalidate(); } finally { mLowResLayer.endTransaction(); mRootLayer.endTransaction(); commit 5ad41801910890be3eec7158aa867aa626f2c82e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 13:44:06 2015 +0900 android: make editing switchable via LOKitShell Change-Id: I329dbead616527a985eba1f3b42cddf573501e86 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index ac3e360..49da6b4 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -82,4 +82,8 @@ public class LOKitShell { public static void sendKeyPressEvent(KeyEvent event) { LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_PRESS, event)); } + + public static boolean isEditingEnabled() { + return false; + } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 9954ea8..ed63cd7 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -147,9 +147,15 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation createThumbnail(event.mTask); break; case LOEvent.TOUCH: + if (!LOKitShell.isEditingEnabled()) { + return; + } touch(event.mTouchType, event.mMotionEvent); break; case LOEvent.KEY_PRESS: + if (!LOKitShell.isEditingEnabled()) { + return; + } mTileProvider.keyPress(event.mKeyEvent); break; } @@ -174,6 +180,10 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation @Override public void invalidate(RectF rect) { + if (!LOKitShell.isEditingEnabled()) { + return; + } + Log.i(LOGTAG, "Invalidate request: " + rect); mLayerClient = mApplication.getLayerClient(); commit 07a736ff67c0f6ed96a26b7fb165b3a1f81ef73f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 13:35:48 2015 +0900 android: add getCSSRect to TileIdentifier and use id in SubTile Change-Id: I565a5f88d5913f5337f5c3d32d54be71a32f542a diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java index 40ec60c..d682775 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java @@ -1,5 +1,6 @@ package org.libreoffice; +import android.graphics.Rect; import android.graphics.RectF; import org.mozilla.gecko.gfx.IntSize; @@ -17,14 +18,27 @@ public class TileIdentifier { this.size = size; } - public RectF getRect() { + public RectF getRectF() { return new RectF(x, y, x + size.width, y + size.height); } - public RectF getCSSRect() { - float cssX = x * zoom; - float cssY = y * zoom; - return new RectF(cssX, cssY, cssX + (size.width * zoom), cssY + (size.height * zoom)); + public RectF getCSSRectF() { + float cssX = x / zoom; + float cssY = y / zoom; + float cssSizeW = size.width / zoom; + float cssSizeH = size.height / zoom; + return new RectF(cssX, cssY, cssX + cssSizeW, cssY + cssSizeH); + } + + public Rect getCSSRect() { + float cssX = x / zoom; + float cssY = y / zoom; + float sizeW = size.width / zoom; + float sizeH = size.height / zoom; + return new Rect( + (int) cssX, (int) cssY, + (int) (cssX + sizeW), + (int) (cssY + sizeH) ); } @Override diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java index d76bc54..b5af410 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/SubTile.java @@ -19,13 +19,7 @@ public class SubTile extends SingleTileLayer { } public void refreshTileMetrics() { - Rect position = getPosition(); - float positionX = id.x / id.zoom; - float positionY = id.y / id.zoom; - float tileSizeWidth = id.size.width / id.zoom; - float tileSizeHeight = id.size.height / id.zoom; - position.set((int) positionX, (int) positionY, (int) (positionX + tileSizeWidth), (int) (positionY + tileSizeHeight)); - setPosition(position); + setPosition(id.getCSSRect()); } public void markForRemoval() { commit f3fdc828f1856a4f5c5eea23dd96b13a1afe58cb Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 11:41:38 2015 +0900 android: small cleanup of ComposedTileLayer Change-Id: Ifa4b35fa23a754c0ba0dbf63653986e61e6cb399 diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index 7989ffe..db27d1b 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -130,11 +130,11 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba } public void reevaluateTiles(ImmutableViewportMetrics viewportMetrics, DisplayPortMetrics mDisplayPort) { - RectF newCurrentViewPort = getViewPort(viewportMetrics); + RectF newViewPort = getViewPort(viewportMetrics); float newZoom = getZoom(viewportMetrics); - if (!currentViewport.equals(newCurrentViewPort) || currentZoom != newZoom) { - currentViewport = newCurrentViewPort; + if (!currentViewport.equals(newViewPort) || currentZoom != newZoom) { + currentViewport = newViewPort; currentZoom = newZoom; RectF pageRect = viewportMetrics.getPageRect(); @@ -232,12 +232,10 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba @Override public void onTrimMemory(int level) { - Log.i(LOGTAG, "Trimming memory " + level); - if (level >= 10 /*TRIM_MEMORY_RUNNING_LOW*/) { - Log.i(LOGTAG, "Trimming memory - TRIM_MEMORY_RUNNING_LOW"); - } else if (level >= 15 /*TRIM_MEMORY_RUNNING_CRITICAL*/) { + if (level >= 15 /*TRIM_MEMORY_RUNNING_CRITICAL*/) { Log.i(LOGTAG, "Trimming memory - TRIM_MEMORY_RUNNING_CRITICAL"); - //clearAndReset(); + } else if (level >= 10 /*TRIM_MEMORY_RUNNING_LOW*/) { + Log.i(LOGTAG, "Trimming memory - TRIM_MEMORY_RUNNING_LOW"); } } commit 70766d8cb76cda0d1409a289a1601a4a290000a9 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 10:22:44 2015 +0900 android: construct a "css" rect of the tile in TileIdentifier Change-Id: I98417dbb6b607b127540292fcae6a8efce4a7da4 diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java index 7c51b52..40ec60c 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileIdentifier.java @@ -21,6 +21,12 @@ public class TileIdentifier { return new RectF(x, y, x + size.width, y + size.height); } + public RectF getCSSRect() { + float cssX = x * zoom; + float cssY = y * zoom; + return new RectF(cssX, cssY, cssX + (size.width * zoom), cssY + (size.height * zoom)); + } + @Override public boolean equals(Object o) { if (this == o) return true; commit 61c368ddde6ffab64f5c80b9cb653ff105a94d03 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Jan 21 10:19:11 2015 +0900 android: cleanup new tileid's if they gone out of viewport scope It can happen that the viewport moves so fast that the tileid is not valid anymore before it could even be rendered to. Change-Id: I5ff7d3de6b289ca48ea8a8974705d8306e1be86b diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 3b7f657..9954ea8 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -37,6 +37,8 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation if (forceRedraw) { mLayerClient.forceRender(); } + } else { + composedTileLayer.cleanupInvalidTile(tileId); } } diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java index e169056..7989ffe 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/ComposedTileLayer.java @@ -240,4 +240,8 @@ public abstract class ComposedTileLayer extends Layer implements ComponentCallba //clearAndReset(); } } + + public void cleanupInvalidTile(TileIdentifier tileId) { + newTileIds.remove(tileId); + } } \ No newline at end of file commit d38b6618ca9548c71865f8090ec3bec4e22f735c Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jan 20 18:13:34 2015 +0100 android: make the about dialog scrollable Content was cut in landscape mode on smaller screens. Change-Id: Ic3b52da7a4ba9e093946be814afa93226cc34c4b diff --git a/android/experimental/LOAndroid3/res/layout/about.xml b/android/experimental/LOAndroid3/res/layout/about.xml index 49f707a..9882ab1 100644 --- a/android/experimental/LOAndroid3/res/layout/about.xml +++ b/android/experimental/LOAndroid3/res/layout/about.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> +<ScrollView> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" @@ -43,3 +44,4 @@ android:textColor="@android:color/secondary_text_light" android:textSize="18sp"/> </LinearLayout> +</ScrollView> commit a6276c5bcd1069a5059da59585115cfd5cc0e4c4 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jan 20 17:50:46 2015 +0100 lokdocview: send mouse events in doc model coordinates Change-Id: Ie4bc39330bf5f7f8ac4683486d98aec87aa82923 diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index bf8dd71..972acab 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -22,6 +22,7 @@ static void lok_docview_class_init( LOKDocViewClass* pClass ); static void lok_docview_init( LOKDocView* pDocView ); +static float pixelToTwip(float nInput); // We specifically need to destroy the document when closing in order to ensure // that lock files etc. are cleaned up. @@ -36,6 +37,7 @@ void lcl_onDestroy( LOKDocView* pDocView, gpointer pData ) /// Receives a button press event. void lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* pDocView) { + g_info("lcl_signalButton: %d, %d (in twips: %d, %d)", (int)pEvent->x, (int)pEvent->y, (int)pixelToTwip(pEvent->x), (int)pixelToTwip(pEvent->y)); (void) pEventBox; lok_docview_set_edit(pDocView, TRUE); @@ -43,10 +45,10 @@ void lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* switch (pEvent->type) { case GDK_BUTTON_PRESS: - pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pEvent->x, pEvent->y); + pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); break; case GDK_BUTTON_RELEASE: - pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONUP, pEvent->x, pEvent->y); + pDocView->pOffice->pClass->postMouseEvent(pDocView->pOffice, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); break; default: break; commit 4bd31546f3ff32ae64117b77cccc088420a1554c ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits