[Libreoffice-commits] online.git: loleaflet/src loolwsd/LOOLSession.cpp loolwsd/protocol.txt

Mihai Varga mihai.varga at collabora.com
Thu Aug 6 08:56:01 PDT 2015


 loleaflet/src/control/Control.Search.js |    5 +++++
 loleaflet/src/control/Permission.js     |    1 +
 loolwsd/LOOLSession.cpp                 |    6 +++++-
 loolwsd/protocol.txt                    |    5 +++++
 4 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit d4f818522a6bcfcafd1f72d15186449bdbca03ef
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Aug 6 18:54:45 2015 +0300

    'requestloksession' message that starts a LOK process
    
    Used to predict the user's interaction with the document and to
    provide a better response time

diff --git a/loleaflet/src/control/Control.Search.js b/loleaflet/src/control/Control.Search.js
index 91e3638..c383e02 100644
--- a/loleaflet/src/control/Control.Search.js
+++ b/loleaflet/src/control/Control.Search.js
@@ -46,6 +46,9 @@ L.Control.Search = L.Control.extend({
 			this._updateDisabled();
 			this._refocusOnMap();
 		}
+		else {
+			this._map._docLayer.sendMessage('requestloksession');
+		}
 	},
 
 	_searchResultFound: function (e) {
@@ -82,6 +85,8 @@ L.Control.Search = L.Control.extend({
 		bar.title = title;
 
 		L.DomEvent
+			.on(bar, 'click', L.DomEvent.stop)
+			.on(bar, 'click', fn, this)
 			.on(bar, 'keyup', L.DomEvent.stop)
 			.on(bar, 'keyup', fn, this);
 
diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js
index 8d80993..f6ed8ee 100644
--- a/loleaflet/src/control/Permission.js
+++ b/loleaflet/src/control/Permission.js
@@ -21,6 +21,7 @@ L.Map.include({
 		if (this._docLayer._permission === 'edit') {
 			return;
 		}
+		this._docLayer.sendMessage('requestloksession');
 		this.dragging.disable();
 	},
 
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index f7439c5..ecf65e9 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -269,6 +269,7 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
              tokens[0] != "invalidatetiles" &&
              tokens[0] != "key" &&
              tokens[0] != "mouse" &&
+             tokens[0] != "requestloksession" &&
              tokens[0] != "resetselection" &&
              tokens[0] != "saveas" &&
              tokens[0] != "selectgraphic" &&
@@ -312,7 +313,10 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
 
         if (_peer.expired())
             dispatchChild();
-        forwardToPeer(buffer, length);
+        if (tokens[0] != "requestloksession")
+        {
+            forwardToPeer(buffer, length);
+        }
 
         if ((tokens.count() > 1 && tokens[0] == "uno" && tokens[1] == ".uno:Save")) {
            _tileCache->documentSaved();
diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt
index 10b17f9..734d317 100644
--- a/loolwsd/protocol.txt
+++ b/loolwsd/protocol.txt
@@ -43,6 +43,11 @@ mouse type=<type> x=<x> y=<y> count=<count>
 
     <type> is 'buttondown', 'buttonup' or 'move', others are numbers.
 
+requestloksession
+
+    requests the initialization of a LOK process in an attempt to predict the user's
+    interaction with the document
+
 resetselection
 
 saveas url=<url> format=<format> options=<options>


More information about the Libreoffice-commits mailing list