[Libreoffice-commits] online.git: Branch 'feature/mobile-input' - 7 commits - kit/ChildSession.cpp loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 3 13:28:06 UTC 2019


 kit/ChildSession.cpp                             |    2 
 loleaflet/src/layer/marker/ClipboardContainer.js |   54 ++++++-----------------
 loleaflet/src/layer/tile/TileLayer.js            |    4 -
 loleaflet/src/map/handler/Map.TouchGesture.js    |    7 ++
 4 files changed, 21 insertions(+), 46 deletions(-)

New commits:
commit 20b89f4b4420eaec9e7e284d3d9ffed754b42f40
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed Aug 28 21:26:46 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:27:26 2019 +0100

    loleaflet: mobile: fix the first typed character after opening the document
    
    calling the function setSelectionRange is an implicit keyboard focus.
    Only enable when the text area has the focus
    
    Change-Id: Ic58abd3fc555ad9a0a08a01041f7aeb5367d271b

diff --git a/loleaflet/src/layer/marker/ClipboardContainer.js b/loleaflet/src/layer/marker/ClipboardContainer.js
index 643e00567..4d996ffb8 100644
--- a/loleaflet/src/layer/marker/ClipboardContainer.js
+++ b/loleaflet/src/layer/marker/ClipboardContainer.js
@@ -507,7 +507,7 @@ L.ClipboardContainer = L.Layer.extend({
 	// always catch deleteContentBackward/deleteContentForward input events
 	// (some combination of browser + input method don't fire those on an
 	// empty contenteditable).
-	_emptyArea: function _emptyArea() {
+	_emptyArea: function _emptyArea(noSelect) {
 		this._fancyLog('empty-area');
 
 		this._ignoreInputCount++;
@@ -524,7 +524,7 @@ L.ClipboardContainer = L.Layer.extend({
 		this._textArea.value = this._preSpaceChar + this._postSpaceChar;
 
 		// avoid setting the focus keyboard
-		if (document.activeElement === this._textArea) {
+		if (!noSelect) {
 			this._textArea.setSelectionRange(1, 1);
 
 			if (this._hasWorkingSelectionStart === undefined)
@@ -566,7 +566,7 @@ L.ClipboardContainer = L.Layer.extend({
 		this._fancyLog('abort-composition', ev.type);
 		if (this._isComposing)
 			this._isComposing = false;
-		this._emptyArea();
+		this._emptyArea(document.activeElement !== this._textArea);
 	},
 
 	_onKeyDown: function _onKeyDown(ev) {
commit f682135863f0c3a3909f940e23484529e9aaf46c
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Aug 19 07:52:33 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:26:18 2019 +0100

    loleaflet: mobile: removes keyboard focus when the graphic is selected
    
    Change-Id: Iced49475ebf9af5508059f5d6e223e99d1187649

diff --git a/loleaflet/src/layer/marker/ClipboardContainer.js b/loleaflet/src/layer/marker/ClipboardContainer.js
index e7f7a2ed7..643e00567 100644
--- a/loleaflet/src/layer/marker/ClipboardContainer.js
+++ b/loleaflet/src/layer/marker/ClipboardContainer.js
@@ -522,9 +522,14 @@ L.ClipboardContainer = L.Layer.extend({
 		this._lastContent = [];
 
 		this._textArea.value = this._preSpaceChar + this._postSpaceChar;
-		this._textArea.setSelectionRange(1, 1);
-		if (this._hasWorkingSelectionStart === undefined)
-			this._hasWorkingSelectionStart = (this._textArea.selectionStart === 1);
+
+		// avoid setting the focus keyboard
+		if (document.activeElement === this._textArea) {
+			this._textArea.setSelectionRange(1, 1);
+
+			if (this._hasWorkingSelectionStart === undefined)
+				this._hasWorkingSelectionStart = (this._textArea.selectionStart === 1);
+		}
 
 		this._fancyLog('empty-area-end');
 
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index fcdab2bd4..eb24318a1 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -239,8 +239,11 @@ L.Map.TouchGesture = L.Handler.extend({
 		this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
 		this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
 
-		if (!this._map.hasFocus()) {
-			this._map.focus();
+		if (this._state === L.Map.TouchGesture.MARKER || this._state === L.Map.TouchGesture.GRAPHIC) {
+			this._map._clipboardContainer.blur();
+		} else {
+			if (!this._map.hasFocus())
+				this._map.focus();
 		}
 	},
 
commit 24d8a06e537bafec635601add6e6e1d2b03a8510
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Aug 15 16:29:24 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:23:04 2019 +0100

    loleaflet: mobile: hide the cursor marker when exists text selection
    
    Change-Id: Ib0a5c74567e1a0a71c53d741aa6c44a09b6b0fe2

diff --git a/loleaflet/src/layer/marker/ClipboardContainer.js b/loleaflet/src/layer/marker/ClipboardContainer.js
index ee90597d1..e7f7a2ed7 100644
--- a/loleaflet/src/layer/marker/ClipboardContainer.js
+++ b/loleaflet/src/layer/marker/ClipboardContainer.js
@@ -242,7 +242,11 @@ L.ClipboardContainer = L.Layer.extend({
 
 		// Move and display under-caret marker
 		if (L.Browser.touch) {
-			this._cursorHandler.setLatLng(bottom).addTo(this._map);
+			if (this._map._docLayer._selections.getLayers().length === 0) {
+				this._cursorHandler.setLatLng(bottom).addTo(this._map);
+			} else {
+				this._map.removeLayer(this._cursorHandler);
+			}
 		}
 
 		// Move the hidden text area with the cursor
commit 1ec290232f81a3d4787ac2e69b8727e4d3f90d48
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Oct 3 14:21:50 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:21:50 2019 +0100

    fixup 6f9508863fcc21b50197f24f8d00d308686aa2e0
    
    Change-Id: I8214bb9b2cde0d840ff52bdbf89c3b498dd2d3f8

diff --git a/loleaflet/src/layer/marker/ClipboardContainer.js b/loleaflet/src/layer/marker/ClipboardContainer.js
index 853889415..ee90597d1 100644
--- a/loleaflet/src/layer/marker/ClipboardContainer.js
+++ b/loleaflet/src/layer/marker/ClipboardContainer.js
@@ -86,18 +86,6 @@ L.ClipboardContainer = L.Layer.extend({
 	_onFocusBlur: function(ev) {
 		this._fancyLog(ev.type, '');
 
-		if (this.dontBlur && ev.type == 'blur') {
-			this._map.focus();
-			this.dontBlur = false;
-			return;
-		}
-
-		if (this.dontBlur && ev.type == 'blur') {
-			this._map.focus();
-			this.dontBlur = false;
-			return;
-		}
-
 		var onoff = (ev.type == 'focus' ? L.DomEvent.on : L.DomEvent.off).bind(L.DomEvent);
 
 		// Debug - connect first for saner logging.
commit 981e4cea1f6dc6e1dea11797e016c02578935165
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Oct 3 14:19:59 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:20:45 2019 +0100

    Remove obsolete and unhelpful method.
    
    Fixes up 8440e286c merge.
    
    Change-Id: I27f16d36d135feae10de6d1db732259f81afd1fc

diff --git a/loleaflet/src/layer/marker/ClipboardContainer.js b/loleaflet/src/layer/marker/ClipboardContainer.js
index 7e9cf4198..853889415 100644
--- a/loleaflet/src/layer/marker/ClipboardContainer.js
+++ b/loleaflet/src/layer/marker/ClipboardContainer.js
@@ -169,17 +169,6 @@ L.ClipboardContainer = L.Layer.extend({
 		return arr;
 	},
 
-	setValue: function(val) {
-		// console.log('clipboard setValue: ', val);
-		if (this._legacyArea) {
-			var tmp = document.createElement('div');
-			tmp.innerHTML = val;
-			this._textArea.value = tmp.innerText || tmp.textContent || '';
-		} else {
-			this._textArea.innerHTML = val;
-		}
-	},
-
 	update: function() {
 		if (this._container && this._map && this._latlng) {
 			var position = this._map.latLngToLayerPoint(this._latlng).round();
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 99d5ed316..c45329235 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -655,10 +655,6 @@ L.TileLayer = L.GridLayer.extend({
 		// messages during text composition, and resetting the contents
 		// of the clipboard container mid-composition will easily break it.
 		var formula = textMsg.substring(13);
-		if (!this._map['wopi'].DisableCopy) {
-			this._map._clipboardContainer.setValue(formula);
-			this._map._clipboardContainer.select();
-		}
 		this._lastFormula = formula;
 		this._map.fire('cellformula', {formula: formula});
 	},
commit 9e6c0db30cf8fe4f7d2ff5eac910f673cfc062c8
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Oct 3 14:09:03 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:10:29 2019 +0100

    Remove unused code.
    
    Change-Id: I7d75cd570411a3e9b596b853da9ebc77b703ee03

diff --git a/loleaflet/src/layer/marker/ClipboardContainer.js b/loleaflet/src/layer/marker/ClipboardContainer.js
index 7e048af14..7e9cf4198 100644
--- a/loleaflet/src/layer/marker/ClipboardContainer.js
+++ b/loleaflet/src/layer/marker/ClipboardContainer.js
@@ -143,16 +143,6 @@ L.ClipboardContainer = L.Layer.extend({
 		this._textArea.select();
 	},
 
-	warnCopyPaste: function() {
-		var self = this;
-		vex.dialog.alert({
-			unsafeMessage: _('<p>Your browser has very limited access to the clipboard, so use these keyboard shortcuts:<ul><li><b>Ctrl+C</b>: For copying.</li><li><b>Ctrl+X</b>: For cutting.</li><li><b>Ctrl+V</b>: For pasting.</li></ul></p>'),
-			callback: function () {
-				self._map.focus();
-			}
-		});
-	},
-
 	getValue: function() {
 		var value = this._textArea.value;
 		return value;
commit da704891b6d70cfb8598eee230f41149e316bbe2
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Oct 3 14:03:12 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Oct 3 14:03:12 2019 +0100

    fixup 17c90f8910f5418af2a81665bb3546aca1c101fb
    
    Change-Id: Ic2f625bf7962995a8e4a7facf7c9b96a7c7b7dc7

diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 5dce1f5db..7425e4fac 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -2113,7 +2113,7 @@ bool ChildSession::removeTextContext(const char* /*buffer*/, int /*length*/,
         return false;
     }
 
-    std::unique_lock<std::mutex> lock(_docManager.getDocumentMutex());
+    std::unique_lock<std::mutex> lock(getLock());
     getLOKitDocument()->setView(_viewId);
     getLOKitDocument()->removeTextContext(id, before, after);
 


More information about the Libreoffice-commits mailing list