[Libreoffice-commits] online.git: 3 commits - loolwsd/DocumentBroker.cpp loolwsd/MasterProcessSession.cpp loolwsd/MasterProcessSession.hpp

Pranav Kant pranavk at collabora.com
Wed May 11 16:16:06 UTC 2016


 loolwsd/DocumentBroker.cpp       |   31 ++-----------------------------
 loolwsd/MasterProcessSession.cpp |   23 -----------------------
 loolwsd/MasterProcessSession.hpp |    5 -----
 3 files changed, 2 insertions(+), 57 deletions(-)

New commits:
commit a1b351d32801a5b3b3789501de917a3dc27f3624
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed May 11 19:16:52 2016 +0530

    Use new DontTerminateEdit param in .uno:Save to be in edit mode
    
    Change-Id: I781eba73af668be874ab91881bcb88494b43a2e9

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 3bb4572..cf7d479 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -284,7 +284,8 @@ bool DocumentBroker::sendUnoSave()
                 // Invalidate the timestamp to force persisting.
                 _lastFileModifiedTime.fromEpochTime(0);
 
-                queue->put("uno .uno:Save");
+                // We do not want save to terminate editing mode if we are in edit mode now
+                queue->put("uno .uno:Save {\"DontTerminateEdit\":{\"type\":\"boolean\",\"value\":true}}");
                 return true;
             }
         }
commit 7a96c2fff0fb29ff83ac201309124f8a73673366
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed May 11 19:15:59 2016 +0530

    Revert "bccu#1776: Restore input mode if we are in one before saving"
    
    This reverts commit 5500b090167b46a9b02b465c0cce75abacde37f8.
    
    Change-Id: I54b385dc823d8fc4e5ef9f6d8291c5cb8ca85417

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 9a4db8a..3bb4572 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -285,14 +285,6 @@ bool DocumentBroker::sendUnoSave()
                 _lastFileModifiedTime.fromEpochTime(0);
 
                 queue->put("uno .uno:Save");
-
-                // Set calc cell mode back to edit mode
-                // if we were in edit before save
-                if (sessionIt.second->isCursorVisible())
-                {
-                    queue->put("uno .uno:SetInputMode");
-                }
-
                 return true;
             }
         }
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 990c309..c62ef32 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -175,10 +175,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                     }
                 }
             }
-            else if (tokens.count() == 2 && tokens[0] == "cursorvisible:")
-            {
-                peer->setCursorVisible(tokens[1] == "true");
-            }
         }
 
         if (peer && !_isDocPasswordProtected)
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index 2472eb5..19a4788 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -50,8 +50,6 @@ class MasterProcessSession final : public LOOLSession, public std::enable_shared
     void setEditLock(const bool value);
     void markEditLock(const bool value) { _bEditLock = value; }
     bool isEditLocked() const { return _bEditLock; }
-    void setCursorVisible(const bool value) { _isCursorVisible = value; }
-    bool isCursorVisible() { return _isCursorVisible; }
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
@@ -88,7 +86,6 @@ public:
 
     int _curPart;
     int _loadPart;
-    bool _isCursorVisible;
     /// Kind::ToClient instances store URLs of completed 'save as' documents.
     MessageQueue _saveAsQueue;
     std::shared_ptr<DocumentBroker> _docBroker;
commit 58123086b8ef322da65fa5695e05558df81f18c8
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed May 11 19:14:00 2016 +0530

    Revert "bccu#1776: Fake double click after auto-saving"
    
    This reverts commit 55a85ddb33854ef18f950ba63a656eb5e15b04ed.

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 31be2ce..9a4db8a 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -54,16 +54,6 @@ std::string getCachePath(const std::string& uri)
             Poco::DigestEngine::digestToHex(digestEngine.digest()).insert(3, "/").insert(2, "/").insert(1, "/"));
 }
 
-/// Return mouse commands
-std::string getMouseCommand(std::string type, long posX, long posY, int count)
-{
-    return std::string("mouse type=" + type +
-                       " x=" + std::to_string(posX) +
-                       " y=" + std::to_string(posY) +
-                       " count=" + std::to_string(count) +
-                       " buttons=1 modifier=0");
-}
-
 }
 
 Poco::URI DocumentBroker::sanitizeURI(const std::string& uri)
@@ -294,23 +284,13 @@ bool DocumentBroker::sendUnoSave()
                 // Invalidate the timestamp to force persisting.
                 _lastFileModifiedTime.fromEpochTime(0);
 
-                // Store the cursor position before saving, if visible
-                long posX = -1;
-                long posY = -1;
-                if (sessionIt.second->isCursorVisible())
-                {
-                    sessionIt.second->getCursorPos(posX, posY);
-                }
-
                 queue->put("uno .uno:Save");
 
-                // Restore the cursor position, if visible, by a fake double click
-                if (posX != -1 && posY != -1)
+                // Set calc cell mode back to edit mode
+                // if we were in edit before save
+                if (sessionIt.second->isCursorVisible())
                 {
-                    queue->put(getMouseCommand("buttondown", posX, posY, 1));
-                    queue->put(getMouseCommand("buttonup", posX, posY, 1));
-                    queue->put(getMouseCommand("buttondown", posX, posY, 2));
-                    queue->put(getMouseCommand("buttonup", posX, posY, 2));
+                    queue->put("uno .uno:SetInputMode");
                 }
 
                 return true;
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 9cd67ff..990c309 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -175,16 +175,9 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                     }
                 }
             }
-            else if (tokens.count() == 5 && tokens[0] == "invalidatecursor:")
-            {
-                peer->setCursorPos(std::stoi(tokens[1]), std::stoi(tokens[2]));
-            }
             else if (tokens.count() == 2 && tokens[0] == "cursorvisible:")
             {
-                if (tokens[1] == "false")
-                {
-                    peer->setCursorPos(-1, -1);
-                }
+                peer->setCursorVisible(tokens[1] == "true");
             }
         }
 
@@ -669,16 +662,4 @@ bool MasterProcessSession::shutdownPeer(Poco::UInt16 statusCode, const std::stri
     return peer != nullptr;
 }
 
-void MasterProcessSession::setCursorPos(long posX, long posY)
-{
-    _cursorPosX = posX;
-    _cursorPosY = posY;
-}
-
-void MasterProcessSession::getCursorPos(long& posX, long& posY)
-{
-    posX = _cursorPosX;
-    posY = _cursorPosY;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index d2227e7..2472eb5 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -50,9 +50,8 @@ class MasterProcessSession final : public LOOLSession, public std::enable_shared
     void setEditLock(const bool value);
     void markEditLock(const bool value) { _bEditLock = value; }
     bool isEditLocked() const { return _bEditLock; }
-    void setCursorPos(const long posX, const long posY);
-    void getCursorPos(long& posX, long& posY);
-    bool isCursorVisible() { return _cursorPosX != -1 && _cursorPosY != -1; }
+    void setCursorVisible(const bool value) { _isCursorVisible = value; }
+    bool isCursorVisible() { return _isCursorVisible; }
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
@@ -89,8 +88,7 @@ public:
 
     int _curPart;
     int _loadPart;
-    long _cursorPosX;
-    long _cursorPosY;
+    bool _isCursorVisible;
     /// Kind::ToClient instances store URLs of completed 'save as' documents.
     MessageQueue _saveAsQueue;
     std::shared_ptr<DocumentBroker> _docBroker;


More information about the Libreoffice-commits mailing list