[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - 2 commits - desktop/Library_sofficeapp.mk desktop/source filter/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 5 22:24:32 UTC 2019


 desktop/Library_sofficeapp.mk            |    3 +-
 desktop/source/lib/init.cxx              |   22 ++++++++++++++
 filter/source/svg/presentation_engine.js |   46 ++++++++++++++-----------------
 3 files changed, 45 insertions(+), 26 deletions(-)

New commits:
commit 662f8d687a56d01e8b192aefdeed4051102d19e4
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Oct 23 17:47:58 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Dec 5 23:23:20 2019 +0100

    tdf#127939: Make slideshow touch input work properly again on iOS 13
    
    For some reason, navigator.userAgent in WebKit on iOS 13 claims it to
    be a Macintosh, so our old code to recognise iOS did not work any
    longer. Also the Hammer.js included in this file looked at
    navigator.userAgent and its decision what to do based on that did not
    work properly either.
    
    Simplify our code by handling swipe gestures all the time, even when
    such won't be generated (on mouse-only devices).
    
    Also, Hammer.JS was too eager to think it detected a pointer-only
    device based on the presense of window.PointerEvent. That sems to be
    present now in iOS 13. Let's not blindly think that means it is a
    pointer-only device. If the device supports touch events, don't bother
    with PointerEvents.
    
    Change-Id: I57d972415798967e871c6e262f16043561ed6af5
    Reviewed-on: https://gerrit.libreoffice.org/81404
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 8f78d6a0d1b4d8d2e21aad9e90510fe6be4df5bb)
    Reviewed-on: https://gerrit.libreoffice.org/83731
    Reviewed-on: https://gerrit.libreoffice.org/83883
    Tested-by: Jenkins
    (cherry picked from commit 8012a200d1a7c5cd1b64a147ca6899fb8863ce8b)
    Reviewed-on: https://gerrit.libreoffice.org/84529

diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 6dff0f2b4a67..5e67ecd2ea7e 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -494,7 +494,7 @@ function createInputInstance(manager) {
 
     if (inputClass) {
         Type = inputClass;
-    } else if (SUPPORT_POINTER_EVENTS) {
+    } else if (!SUPPORT_TOUCH && SUPPORT_POINTER_EVENTS) {
         Type = PointerEventInput;
     } else if (SUPPORT_ONLY_TOUCH) {
         Type = TouchInput;
@@ -823,6 +823,7 @@ inherit(MouseInput, Input, {
      * @param {Object} ev
      */
     handler: function MEhandler(ev) {
+        // console.log('==> MouseInput handler');
         var eventType = MOUSE_INPUT_MAP[ev.type];
 
         // on start we want to have the left mouse button down
@@ -897,6 +898,7 @@ inherit(PointerEventInput, Input, {
      * @param {Object} ev
      */
     handler: function PEhandler(ev) {
+        // console.log('==> PointerEventInput handler');
         var store = this.store;
         var removePointer = false;
 
@@ -966,6 +968,7 @@ function SingleTouchInput() {
 
 inherit(SingleTouchInput, Input, {
     handler: function TEhandler(ev) {
+        // console.log('==> SingleTouchInput handler');
         var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
 
         // should we handle the touch events?
@@ -1033,6 +1036,7 @@ function TouchInput() {
 
 inherit(TouchInput, Input, {
     handler: function MTEhandler(ev) {
+        // console.log('==> TouchInput handler');
         var type = TOUCH_INPUT_MAP[ev.type];
         var touches = getTouches.call(this, ev, type);
         if (!touches) {
@@ -1141,6 +1145,7 @@ inherit(TouchMouseInput, Input, {
      * @param {Object} inputData
      */
     handler: function TMEhandler(manager, inputEvent, inputData) {
+        // console.log('==> TouchMouseInput handler');
         var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
             isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
 
@@ -6480,26 +6485,22 @@ function init()
     theSlideIndexPage = new SlideIndexPage();
     aSlideShow.displaySlide( theMetaDoc.nStartSlideNumber, false );
 
-    // In the iOS app, allow slide switching with swipe gestures left
+    // Allow slide switching with swipe gestures left
     // and right. Swiping up or down will exit the slideshow.
-    var ua = navigator.userAgent;
-    if (ua.indexOf(' AppleWebKit/') !== -1 &&
-        ua.indexOf(' Mobile/') !== -1) {
-        var hammer = new Hammer(ROOT_NODE);
-        hammer.on('swipeleft', function() {
-            switchSlide(1, false);
-        });
-        hammer.on('swiperight', function() {
-            switchSlide(-1, false);
-        });
-        hammer.get('swipe').set({ direction: Hammer.DIRECTION_ALL });
-        hammer.on('swipeup', function() {
-            aSlideShow.exitSlideShowInApp();
-        });
-        hammer.on('swipedown', function() {
-            aSlideShow.exitSlideShowInApp();
-        });
-    }
+    var hammer = new Hammer(ROOT_NODE);
+    hammer.on('swipeleft', function() {
+        switchSlide(1, false);
+    });
+    hammer.on('swiperight', function() {
+        switchSlide(-1, false);
+    });
+    hammer.get('swipe').set({ direction: Hammer.DIRECTION_ALL });
+    hammer.on('swipeup', function() {
+        aSlideShow.exitSlideShowInApp();
+    });
+    hammer.on('swipedown', function() {
+        aSlideShow.exitSlideShowInApp();
+    });
 }
 
 function presentationEngineStop(message)
@@ -18410,10 +18411,7 @@ SlideShow.prototype.rewindAllEffects = function()
 
 SlideShow.prototype.exitSlideShowInApp = function()
 {
-    var ua = navigator.userAgent;
-    if (ua.indexOf(' AppleWebKit/') !== -1 &&
-        ua.indexOf(' Mobile/') !== -1 &&
-        window.webkit !== undefined &&
+    if (window.webkit !== undefined &&
         window.webkit.messageHandlers !== undefined &&
         window.webkit.messageHandlers.lool !== undefined)
         window.webkit.messageHandlers.lool.postMessage('EXITSLIDESHOW', '*');
commit e7a87ff3651bde1ba8399c553556babe36807cbe
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Nov 20 18:14:07 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Dec 5 23:23:04 2019 +0100

    We use the system clipboard on iOS and not the "LOK clipboard"
    
    The use of the system clipboard was implemented for iOS in vcl already
    in cp-6.0. This "LOK clipboard" thing is for different situations in
    web-based Online and not applicable for the iOS app.
    
    Change-Id: I679b5c27d308a563eadaf1e543ce8c45d763f3c6
    Reviewed-on: https://gerrit.libreoffice.org/83339
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 8ce79f1a9188ae389dc8be1f53de0000b3ca0951)
    Reviewed-on: https://gerrit.libreoffice.org/84528
    Tested-by: Jenkins

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index e7c56f4ee0b7..9dd91971a825 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -155,7 +155,8 @@ ifneq ($(filter $(OS),ANDROID iOS MACOSX WNT),)
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
 	desktop/source/lib/init \
 	desktop/source/lib/lokinteractionhandler \
-	desktop/source/lib/lokclipboard \
+	$(if $(filter-out $(OS),IOS), \
+		desktop/source/lib/lokclipboard) \
 	$(if $(filter $(OS),ANDROID), \
 		desktop/source/lib/lokandroid) \
 ))
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 947206d18d54..88e82c0ee3f1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -937,6 +937,8 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis)
     return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get());
 }
 
+#ifndef IOS
+
 /*
  * Unfortunately clipboard creation using UNO is insanely baroque.
  * we also need to ensure that this works for the first view which
@@ -953,6 +955,9 @@ rtl::Reference<LOKClipboard> forceSetClipboardForCurrentView(LibreOfficeKitDocum
 
     return xClip;
 }
+
+#endif
+
 } // anonymous namespace
 
 LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent)
@@ -1039,7 +1044,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
     }
     pClass = m_pDocumentClass.get();
 
+#ifndef IOS
     forceSetClipboardForCurrentView(this);
+#endif
 }
 
 LibLODocument_Impl::~LibLODocument_Impl()
@@ -1622,10 +1629,12 @@ bool CallbackFlushHandler::processWindowEvent(CallbackData& aCallbackData)
             return false;
         }
 
+#ifndef IOS
         auto xClip = forceSetClipboardForCurrentView(m_pDocument);
 
         uno::Reference<datatransfer::clipboard::XClipboard> xClipboard(xClip.get());
         pWindow->SetClipboard(xClipboard);
+#endif
     }
     else if (aAction == "size_changed")
     {
@@ -3917,6 +3926,13 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
                             const size_t  *pInSizes,
                             const char   **pInStreams)
 {
+#ifdef IOS
+    (void) pThis;
+    (void) nInCount;
+    (void) pInMimeTypes;
+    (void) pInSizes;
+    (void) pInStreams;
+#else
     comphelper::ProfileZone aZone("doc_setClipboard");
 
     SolarMutexGuard aGuard;
@@ -3941,7 +3957,7 @@ static int doc_setClipboard(LibreOfficeKitDocument* pThis,
         SetLastExceptionMsg("Document doesn't support this mime type");
         return false;
     }
-
+#endif
     return true;
 }
 
@@ -4613,7 +4629,11 @@ static int doc_createViewWithOptions(LibreOfficeKitDocument* pThis,
 
     int nId = SfxLokHelper::createView();
 
+#ifdef IOS
+    (void) pThis;
+#else
     forceSetClipboardForCurrentView(pThis);
+#endif
 
     return nId;
 }


More information about the Libreoffice-commits mailing list