[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - 63 commits - bundled/include common/Session.cpp kit/ChildSession.cpp kit/ChildSession.hpp kit/Kit.cpp loleaflet/css loleaflet/debug loleaflet/html loleaflet/Makefile.am loleaflet/README loleaflet/src net/Socket.cpp net/Socket.hpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/Storage.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri May 3 11:54:55 UTC 2019


 bundled/include/LibreOfficeKit/LibreOfficeKit.h   |    5 
 bundled/include/LibreOfficeKit/LibreOfficeKit.hxx |   14 +
 common/Session.cpp                                |    1 
 kit/ChildSession.cpp                              |   43 +++-
 kit/ChildSession.hpp                              |    1 
 kit/Kit.cpp                                       |    8 
 loleaflet/Makefile.am                             |    1 
 loleaflet/README                                  |   23 ++
 loleaflet/css/leaflet.css                         |    7 
 loleaflet/css/loleaflet.css                       |   48 ++++
 loleaflet/css/menubar.css                         |    2 
 loleaflet/css/partsPreviewControl.css             |    8 
 loleaflet/css/sidebar.css                         |    3 
 loleaflet/css/spreadsheet.css                     |    2 
 loleaflet/debug/document/loleaflet.html           |    2 
 loleaflet/html/loleaflet.html.m4                  |    4 
 loleaflet/src/control/Control.LokDialog.js        |  228 ++++++++++++++++++++--
 loleaflet/src/control/Control.Menubar.js          |    2 
 loleaflet/src/control/Parts.js                    |    1 
 loleaflet/src/map/Map.js                          |   47 ++++
 net/Socket.cpp                                    |    1 
 net/Socket.hpp                                    |    2 
 wsd/ClientSession.cpp                             |    4 
 wsd/DocumentBroker.cpp                            |    2 
 wsd/LOOLWSD.cpp                                   |   26 +-
 wsd/Storage.cpp                                   |    1 
 26 files changed, 439 insertions(+), 47 deletions(-)

New commits:
commit 9b31ab7d44894dda87276eae6bb852bbbc692e1e
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Mar 25 20:19:09 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Sidebar: don't show border and placeholder if not visible
    
    Change-Id: I689fa47b0dcb034688ec73c0d338c99423b10a38

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index fe11e6daf..6078f7155 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -73,6 +73,7 @@ body {
 }
 
 #sidebar-dock-wrapper {
+	display: none;
 	background: #fff;
 	position: absolute;
 	top: 77px;
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index c06ca138c..e151ff820 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -471,6 +471,8 @@ L.Control.LokDialog = L.Control.extend({
 		    && this._map._permission != 'edit')
 			return;
 
+		$('#sidebar-dock-wrapper').css('display', 'block');
+
 		var ratio = 1.0;
 		if (width > window.screen.width) {
 			ratio = window.screen.width / width;
@@ -803,7 +805,10 @@ L.Control.LokDialog = L.Control.extend({
 
 	_resizeSidebar: function(strId, width) {
 		this._currentDeck.width = width;
-		width = width + 15;
+		if (width > 1) {
+			// Add extra space for scrollbar only when visible
+			width = width + 15;
+		}
 		var sidebar = L.DomUtil.get(strId);
 		if (sidebar) {
 			sidebar.width = width;
commit 0d7b28daf8a8bf6f2adc33bbe3d7d5f7f72d6659
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Feb 7 15:17:21 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Z-index doc, sidebar under menu
    
    Change-Id: Ic9c0dbb326d45c205746e50018906030f7a6fd27

diff --git a/loleaflet/README b/loleaflet/README
index 3b9f53d21..e10a2795b 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -359,3 +359,26 @@ are independent of the map's div, thus enabling us to link them to the map as ne
 When the user scrolls, the map is panned by the same amount as it would've been scrolled.
 Also, some custom jquery scrollbars are used, to trigger the same scroll events across
 browsers.
+
+Z-index values:
+-------------------------------------------
+		leaflet
+-------------------------------------------
+10			map
+11			ruler
+-------------------------------------------
+		under menu
+-------------------------------------------
+990			sidebar
+999			toolbar-up
+-------------------------------------------
+		menu items
+-------------------------------------------
+1000			menu, toolbar-down
+1050			closebuttonwrapper
+-------------------------------------------
+		on the top
+-------------------------------------------
+1105			dialogs
+2000			mobile-edit-button
+-------------------------------------------
diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 9970910b0..fe11e6daf 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -81,7 +81,7 @@ body {
 	border-top: 1px solid #b6b6b6;
 	border-left: 1px solid #b6b6b6;
 	overflow: hidden;
-	z-index: 1100;
+	z-index: 990;
 }
 
 #sidebar-panel {
commit 5125226337e5ea826359534cccc8c46df62d6e8b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Feb 3 10:55:52 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: resize the sidebar just befor rendering
    
    This prevents flicker and the clipped sidebar issue.
    
    Change-Id: Ia940894c2ad6cdcfcdcf5eb910d101c45b2f9ee5

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index f0a03883c..c06ca138c 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -479,9 +479,8 @@ L.Control.LokDialog = L.Control.extend({
 		var strId = this._toStrId(id);
 
 		if (this._currentDeck) {
-			if (width > 0) {
-				this._resizeSidebar(strId, width);
-			}
+			this._currentDeck.width = width;
+			this._currentDeck.height = height;
 
 			// Hide cursor.
 			this._currentDeck.cursorVisible = false;
@@ -493,10 +492,6 @@ L.Control.LokDialog = L.Control.extend({
 			else
 				$(panel).parent().hide();
 
-			// update the underlying canvas
-			var panelCanvas = L.DomUtil.get(this._currentDeck.strId + '-canvas');
-			this._setCanvasWidthHeight(panelCanvas, width, height);
-
 			// Render window.
 			this._sendPaintWindowRect(id);
 
@@ -513,7 +508,7 @@ L.Control.LokDialog = L.Control.extend({
 		panelContainer.id = strId;
 
 		// Create the panel canvas.
-		panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
+		var panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
 		L.DomUtil.setStyle(panelCanvas, 'position', 'absolute');
 		this._setCanvasWidthHeight(panelCanvas, width, height);
 		panelCanvas.id = strId + '-canvas';
@@ -752,16 +747,22 @@ L.Control.LokDialog = L.Control.extend({
 			}
 
 			// Sidebars find out their size and become visible on first paint.
-			if (that._isSidebar(parentId))
+			var isSidebar = that._isSidebar(parentId);
+			if (isSidebar) {
 				that._resizeSidebar(strId, that._currentDeck.width);
 
+				// Update the underlying canvas.
+				var panelCanvas = L.DomUtil.get(that._currentDeck.strId + '-canvas');
+				that._setCanvasWidthHeight(panelCanvas, that._currentDeck.width, that._currentDeck.height);
+			}
+
 			ctx.drawImage(img, x, y);
 
 			// if dialog is hidden, show it
 			var container = L.DomUtil.get(strId);
 			if (container)
 				$(container).parent().show();
-			that.focus(parentId, !that._isSidebar(parentId));
+			that.focus(parentId, !isSidebar);
 		};
 		img.src = imgData;
 	},
commit 3857d7e08b3924731ab65fa4fe874c71b319f071
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Feb 2 22:18:22 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: keep the client active while the user interacts with dialogs/sidebar
    
    Change-Id: I7667f2ae98b04d6066de779348a0aa8a2c0cb14a

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 09f2ab8e5..f0a03883c 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -242,7 +242,7 @@ L.Control.LokDialog = L.Control.extend({
 			}
 		}
 
-		// all other callbacks doens't make sense without an active dialog
+		// All other callbacks doen't make sense without an active dialog.
 		if (!(this._isOpen(e.id) || this._getParentId(e.id)))
 			return;
 
@@ -571,6 +571,8 @@ L.Control.LokDialog = L.Control.extend({
 		L.DomEvent.on(canvas, 'mousemove', function(e) {
 			this._map.lastActiveTime = Date.now();
 			this._postWindowMouseEvent('move', id, e.offsetX, e.offsetY, 1, 0, 0);
+			// Keep map active while user is playing with sidebar/dialog.
+			this._map.lastActiveTime = Date.now();
 		}, this);
 		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {
 			L.DomEvent.stopPropagation(e);
@@ -582,6 +584,8 @@ L.Control.LokDialog = L.Control.extend({
 			var lokEventType = e.type.replace('mouse', 'button');
 			this._postWindowMouseEvent(lokEventType, id, e.offsetX, e.offsetY, 1, buttons, 0);
 			this.focus(id, !this._dialogs[id].isSidebar);
+			// Keep map active while user is playing with sidebar/dialog.
+			this._map.lastActiveTime = Date.now();
 		}, this);
 		L.DomEvent.on(dlgInput,
 		              'keyup keypress keydown compositionstart compositionupdate compositionend textInput',
@@ -596,7 +600,7 @@ L.Control.LokDialog = L.Control.extend({
 			                                                id),
 			                                         dlgInput);
 
-			              // Keep map active while user is playing with window.
+			              // Keep map active while user is playing with sidebar/dialog.
 			              this._map.lastActiveTime = Date.now();
 		              }, this);
 		L.DomEvent.on(dlgInput, 'contextmenu', function() {
commit 8231f902195deb9c510a03f25de4bc9662460e43
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Feb 2 11:05:14 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: allow space for the vertical scrollbar
    
    This prevents hiding part of the sidebar behind
    the scrollbar, when it appears.
    
    Perhaps we should do this dynamically, only
    where the scrollbar is visible, but that will
    introduce flicker and resizing of the document
    container, which are undersirable. This is
    a small extra space, so can be visible.
    
    Change-Id: Ic123832812663c14afadf0087ce49b742aa466c2

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index c4861f434..09f2ab8e5 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -798,6 +798,7 @@ L.Control.LokDialog = L.Control.extend({
 
 	_resizeSidebar: function(strId, width) {
 		this._currentDeck.width = width;
+		width = width + 15;
 		var sidebar = L.DomUtil.get(strId);
 		if (sidebar) {
 			sidebar.width = width;
commit 7ba1f6a12c6c8797b3d832faf540d4914b6f219b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Feb 2 10:11:02 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: hide sidebar's horizontal scrollbar
    
    And merge a single z-index property into
    the main css.
    
    Change-Id: I0a8ed76c98b46052b2cf4b32cfcae498c1615584

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 9f49feccb..9970910b0 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -73,24 +73,26 @@ body {
 }
 
 #sidebar-dock-wrapper {
-    background: #fff;
-    position: absolute;
-    top: 77px;
-    right: 0px;
-    bottom: 37px;
-    border-top: 1px solid #b6b6b6;
-    border-left: 1px solid #b6b6b6;
-    overflow: hidden; /* FIXME we want scrollbars here to handle overflows client-side */
-    z-index: 1100;
+	background: #fff;
+	position: absolute;
+	top: 77px;
+	right: 0px;
+	bottom: 37px;
+	border-top: 1px solid #b6b6b6;
+	border-left: 1px solid #b6b6b6;
+	overflow: hidden;
+	z-index: 1100;
 }
 
 #sidebar-panel {
-    padding: 0px;
-    margin: 0px;
-    position: relative;
-    width: 100%;
-    height: 100%;
-    overflow-y: auto;
+	padding: 0px;
+	margin: 0px;
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow-x: hidden;
+	overflow-y: auto;
+	z-index: 1200;
 }
 
 #toolbar-wrapper {
diff --git a/loleaflet/css/sidebar.css b/loleaflet/css/sidebar.css
index e62774dfa..fa0e913ab 100644
--- a/loleaflet/css/sidebar.css
+++ b/loleaflet/css/sidebar.css
@@ -1,8 +1,3 @@
 #document-container.sidebar-document {
         left: 214px;
 }
-
-#sidebar-panel {
-    height: 100%;
-    z-index: 1200;
-}
commit 8595bb421989091584447aeb9bc549ef88953a96
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 30 08:03:17 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Allow to grab focus by dialogs without a cursor
    
    Change-Id: Ifb40ffbc3ea3e921dff9e31247318e377b372400

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index fc6899f15..c4861f434 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -357,8 +357,8 @@ L.Control.LokDialog = L.Control.extend({
 		L.DomUtil.setPosition(dlgContainer, new L.Point(left, top));
 	},
 
-	focus: function(dlgId) {
-		if (!this._isOpen(dlgId) || !this._dialogs[dlgId].input || !this._dialogs[dlgId].cursorVisible)
+	focus: function(dlgId, force) {
+		if (!force && (!this._isOpen(dlgId) || !this._dialogs[dlgId].input || !this._dialogs[dlgId].cursorVisible))
 			return;
 
 		this._dialogs[dlgId].input.focus();
@@ -581,7 +581,7 @@ L.Control.LokDialog = L.Control.extend({
 			// 'mousedown' -> 'buttondown'
 			var lokEventType = e.type.replace('mouse', 'button');
 			this._postWindowMouseEvent(lokEventType, id, e.offsetX, e.offsetY, 1, buttons, 0);
-			this.focus(id);
+			this.focus(id, !this._dialogs[id].isSidebar);
 		}, this);
 		L.DomEvent.on(dlgInput,
 		              'keyup keypress keydown compositionstart compositionupdate compositionend textInput',
@@ -757,7 +757,7 @@ L.Control.LokDialog = L.Control.extend({
 			var container = L.DomUtil.get(strId);
 			if (container)
 				$(container).parent().show();
-			that.focus(parentId);
+			that.focus(parentId, !that._isSidebar(parentId));
 		};
 		img.src = imgData;
 	},
commit 25ea25c938d3d939878f83b6ab2cacac021d91c3
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 16 21:12:04 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Get correct canvas object
    
    Change-Id: Iedc41741968a4baab787c0b364764415c941aa16

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index f20a852bd..fc6899f15 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -822,8 +822,11 @@ L.Control.LokDialog = L.Control.extend({
 		if (!this._isSidebar(dialogId)) {
 			// Remove any extra height allocated for the parent container (only for floating dialogs).
 			var canvas = document.getElementById(dialogId + '-canvas');
-			if (!canvas)
-				return;
+			if (!canvas) {
+				canvas = document.getElementById(this._toStrId(dialogId) + '-canvas');
+				if (!canvas)
+					return;
+			}
 			var canvasHeight = canvas.height;
 			$('#' + dialogId).height(canvasHeight + 'px');
 		}
commit 41b80a56b79e9d8eb45a8fde07d15cefc3603377
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jan 12 14:46:02 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: hide sidebar on mobile screens
    
    Change-Id: I9d43dab6e44eeda35bdd8f2fffe0702d5d0c11f1

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index f8cf72424..9f49feccb 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -171,7 +171,7 @@ body {
 	}
 	#document-container {
 	top: 41px;
-
+	right: 0px !important;
 	}
 	#spreadsheet-row-column-frame {
 	top: 83px !important;
commit 132f3f64b36306fba31aec38dac795e61efc6457
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Jan 4 05:58:35 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: resize sidebar to container without caching
    
    With cached getSize we don't get the new size when
    exiting fullscreen, so we leave the sidebar stuck
    at fullscreen height, which shows scrollbars.
    
    Change-Id: Icb09cd7d47998eb716b5334fb7991e2ba8ae8714

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 185b1e169..d63d43b3a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -981,8 +981,7 @@ L.Map = L.Evented.extend({
 		if (sidebarpanel) {
 			var sidebar = sidebarpanel.children[0];
 			if (sidebar) {
-				var newSize = this.getSize();
-				sidebar.height = newSize.y - 10;
+				sidebar.height = this._container.clientHeight - 10;
 				sidebar.style.height = sidebar.height + 'px';
 
 				// Fire the resize event to propagate the size change to WSD.
commit 4d6037a033d2607915215626c0be3aed0b883b4b
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Dec 17 19:34:48 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Close sidebar if menu activated on mobile
    
    Change-Id: Ia5b0d42db638025768ce1ddc1f0786d41f0cd7e6

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index c38d07982..f20a852bd 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -90,6 +90,7 @@ L.Control.LokDialog = L.Control.extend({
 		map.on('opendialog', this._openDialog, this);
 		map.on('docloaded', this._docLoaded, this);
 		map.on('closepopup', this.onCloseCurrentPopUp, this);
+		map.on('closesidebar', this._closeSidebar, this);
 		map.on('editorgotfocus', this._onEditorGotFocus, this);
 		L.DomEvent.on(document, 'mouseup', this.onCloseCurrentPopUp, this);
 	},
@@ -710,6 +711,15 @@ L.Control.LokDialog = L.Control.extend({
 		this._onDialogClose(this._currentId, true);
 	},
 
+	_closeSidebar: function() {
+		for (var dialog in this._dialogs) {
+			if (this._dialogs[dialog].isSidebar == true) {
+				this._onSidebarClose(dialog);
+			}
+		}
+		$('#sidebar-dock-wrapper').css({display: ''});
+	},
+
 	_onEditorGotFocus: function() {
 		// We need to lose focus on any dialogs/sidebars currently with focus.
 		for (var winId in this._dialogs) {
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index d90e3fb79..6a94d673e 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -579,6 +579,7 @@ L.Control.Menubar = L.Control.extend({
 
 		$('#main-menu').bind('keydown', {self: this}, this._onKeyDown);
 
+		var self = this;
 		// SmartMenus mobile menu toggle button
 		$(function() {
 			var $mainMenuState = $('#main-menu-state');
@@ -588,6 +589,7 @@ L.Control.Menubar = L.Control.extend({
 					var $menu = $('#main-menu');
 					var $nav = $menu.parent();
 					if (this.checked) {
+						self._map.fire('closesidebar');
 						$nav.css({height: 'initial', bottom: '38px'});
 						$menu.hide().slideDown(250, function() { $menu.css('display', ''); });
 					} else {
commit 59ce01d511ebf7b59f2be714b193bc23794b130d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Dec 17 12:54:11 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Don't show empty sidebar on start for tablets
    
    Change-Id: I0123b150bb095eb1a070468a4baa98595adf1af1

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 0bdd3b1fd..f8cf72424 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -20,6 +20,10 @@
 	display: none;
 }
 
+#sidebar-dock-wrapper.tablet {
+	top: 41px;
+}
+
 #map {
 	position: absolute;
 	top: 0px;
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index cfdc8ff23..c38d07982 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -466,7 +466,8 @@ L.Control.LokDialog = L.Control.extend({
 		if (!top)
 			top = 0;
 
-		if (window.mode.isMobile() && this._map._permission != 'edit')
+		if ((window.mode.isMobile() || window.mode.isTablet())
+		    && this._map._permission != 'edit')
 			return;
 
 		var ratio = 1.0;
@@ -498,6 +499,9 @@ L.Control.LokDialog = L.Control.extend({
 			// Render window.
 			this._sendPaintWindowRect(id);
 
+			if (window.mode.isTablet())
+				$('#sidebar-dock-wrapper').addClass('tablet');
+
 			if (ratio < 1.0) {
 				$('#sidebar-dock-wrapper').css('width', String(width * ratio) + 'px');
 			}
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 3d01b9ec3..185b1e169 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -230,7 +230,7 @@ L.Map = L.Evented.extend({
 			this.initializeModificationIndicator();
 
 			// Show sidebar.
-			if (this._docLayer && !window.mode.isMobile() &&
+			if (this._docLayer && !window.mode.isMobile() && !window.mode.isTablet() &&
 				(this._docLayer._docType === 'presentation' || this._docType === 'drawing')) {
 				// Let the first page finish loading then load the sidebar.
 				var map = this;
commit 59006ad53c720bffe397f307838f649444f3a239
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Dec 17 12:19:06 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Scrollable sidebar on mobile with small screen
    
    Change-Id: Ib1d6684aacee68a95b946a8dcc96df76f60697c5

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index b43b2d773..cfdc8ff23 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -466,6 +466,14 @@ L.Control.LokDialog = L.Control.extend({
 		if (!top)
 			top = 0;
 
+		if (window.mode.isMobile() && this._map._permission != 'edit')
+			return;
+
+		var ratio = 1.0;
+		if (width > window.screen.width) {
+			ratio = window.screen.width / width;
+		}
+
 		var strId = this._toStrId(id);
 
 		if (this._currentDeck) {
@@ -489,6 +497,10 @@ L.Control.LokDialog = L.Control.extend({
 
 			// Render window.
 			this._sendPaintWindowRect(id);
+
+			if (ratio < 1.0) {
+				$('#sidebar-dock-wrapper').css('width', String(width * ratio) + 'px');
+			}
 			return;
 		}
 
commit 527b8bdd7c7dcfc3b6c02427c0fdca8309b97d94
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Dec 17 00:01:43 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: maintain sidebar size after child is closed
    
    Change-Id: I61d2b31a5b657136160f2d21b515ca4052d34a68

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index d4b889123..b43b2d773 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -793,12 +793,14 @@ L.Control.LokDialog = L.Control.extend({
 
 	_onDialogChildClose: function(dialogId) {
 		$('#' + this._toStrId(dialogId) + '-floating').remove();
-		// remove any extra height allocated for the parent container
-		var canvas = document.getElementById(dialogId + '-canvas');
-		if (!canvas)
-			return;
-		var canvasHeight = canvas.height;
-		$('#' + dialogId).height(canvasHeight + 'px');
+		if (!this._isSidebar(dialogId)) {
+			// Remove any extra height allocated for the parent container (only for floating dialogs).
+			var canvas = document.getElementById(dialogId + '-canvas');
+			if (!canvas)
+				return;
+			var canvasHeight = canvas.height;
+			$('#' + dialogId).height(canvasHeight + 'px');
+		}
 	},
 
 	_removeDialogChild: function(id) {
@@ -835,6 +837,8 @@ L.Control.LokDialog = L.Control.extend({
 		L.DomUtil.setStyle(floatingCanvas, 'position', 'absolute');
 		L.DomUtil.setStyle(floatingCanvas, 'left', (left - 1) + 'px'); // Align drop-down list with parent.
 		L.DomUtil.setStyle(floatingCanvas, 'top', top + 'px');
+		L.DomUtil.setStyle(floatingCanvas, 'width', '0px');
+		L.DomUtil.setStyle(floatingCanvas, 'height', '0px');
 
 		// attach events
 		this._setupChildEvents(childId, floatingCanvas);
commit 8a1ed2c8aca416041ea5026dc902fdef107aa558
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Dec 13 20:09:53 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Don't show sidebar on start in mobile
    
    Change-Id: I9b8eeb6d3406e971608fc950359b315220a50e51

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index d583b46fe..3d01b9ec3 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -230,7 +230,7 @@ L.Map = L.Evented.extend({
 			this.initializeModificationIndicator();
 
 			// Show sidebar.
-			if (this._docLayer &&
+			if (this._docLayer && !window.mode.isMobile() &&
 				(this._docLayer._docType === 'presentation' || this._docType === 'drawing')) {
 				// Let the first page finish loading then load the sidebar.
 				var map = this;
commit 32d78d8ba2f6712a46584ddb1b22eaa5f8b8512a
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Dec 13 20:09:34 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    Top align sidebar in mobile
    
    Change-Id: Ib2e1d70bf9a63f6136c6458bb83c6b8b030d177a

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index cfbc8c8ee..0bdd3b1fd 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -141,6 +141,7 @@ body {
 	/* Show sidebar beyond 768px only */
 	#sidebar-dock-wrapper {
 		display: none;
+		top: 41px;
 	}
 
 	#document-container.sidebar-document {
commit 403026655706aac47d68bc9b37f63ec8d158e4be
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Dec 10 00:08:48 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: Hide sidebar on collapse
    
    Change-Id: I7c4f3e1fa23277a24c0ae055298050234df11ac5

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index a965c204d..d4b889123 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -477,6 +477,12 @@ L.Control.LokDialog = L.Control.extend({
 			this._currentDeck.cursorVisible = false;
 			$('#' + strId + '-cursor').css({display: 'none'});
 
+			var panel = L.DomUtil.get('sidebar-panel');
+			if (width > 1)
+				$(panel).parent().show();
+			else
+				$(panel).parent().hide();
+
 			// update the underlying canvas
 			var panelCanvas = L.DomUtil.get(this._currentDeck.strId + '-canvas');
 			this._setCanvasWidthHeight(panelCanvas, width, height);
commit 9bd92971dc34508091133024bcabd3043e0b6ab3
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Dec 9 14:59:30 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: scroll sidebars in client instead of resizing in core
    
    And resize the sidebar div to slightly shorter height than
    the content area to avoid scrolling the sidebar unnecessarily.
    
    Change-Id: I5cedb54a573f90097bfefd9a0099375e13a76a3b

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 5264b2b42..cfbc8c8ee 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -86,6 +86,7 @@ body {
     position: relative;
     width: 100%;
     height: 100%;
+    overflow-y: auto;
 }
 
 #toolbar-wrapper {
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index e83d8af88..a965c204d 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -527,8 +527,10 @@ L.Control.LokDialog = L.Control.extend({
 		this._setupWindowEvents(id, panelCanvas, dlgInput);
 
 		L.DomEvent.on(panelContainer, 'resize', function() {
-			this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelContainer.width + ',' + panelContainer.height);
+			// Don't resize the window as we handle overflowing with scrollbars.
+			// this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelContainer.width + ',' + panelContainer.height);
 		}, this);
+
 		L.DomEvent.on(panelContainer, 'mouseleave', function() {
 			// Move the mouse off-screen when we leave the sidebar
 			// so we don't leave edge-elements highlighted as if
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index e65f43b5a..d583b46fe 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -982,8 +982,8 @@ L.Map = L.Evented.extend({
 			var sidebar = sidebarpanel.children[0];
 			if (sidebar) {
 				var newSize = this.getSize();
-				sidebar.height = newSize.y;
-				sidebar.style.height = newSize.y + 'px';
+				sidebar.height = newSize.y - 10;
+				sidebar.style.height = sidebar.height + 'px';
 
 				// Fire the resize event to propagate the size change to WSD.
 				// .trigger isn't working, so doing it manually.
commit 873c5480818d34c3061bd093adb550d6631d3028
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 5 05:32:29 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: sidebar: focus only when we have a cursor
    
    Change-Id: Ifc61c2da4f6fcaa7e5210b4869288697b5852527

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 91c63af11..e83d8af88 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -357,7 +357,7 @@ L.Control.LokDialog = L.Control.extend({
 	},
 
 	focus: function(dlgId) {
-		if (!this._isOpen(dlgId) || !this._dialogs[dlgId].input)
+		if (!this._isOpen(dlgId) || !this._dialogs[dlgId].input || !this._dialogs[dlgId].cursorVisible)
 			return;
 
 		this._dialogs[dlgId].input.focus();
@@ -556,7 +556,7 @@ L.Control.LokDialog = L.Control.extend({
 			// 'mousedown' -> 'buttondown'
 			var lokEventType = e.type.replace('mouse', 'button');
 			this._postWindowMouseEvent(lokEventType, id, e.offsetX, e.offsetY, 1, buttons, 0);
-			dlgInput.focus();
+			this.focus(id);
 		}, this);
 		L.DomEvent.on(dlgInput,
 		              'keyup keypress keydown compositionstart compositionupdate compositionend textInput',
commit a9ab3e7328e9080be7d6909ee9a2c007cee232df
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Dec 5 05:09:52 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: sidebar: hide cursor when changing decks
    
    Change-Id: I7912294638ea449c5e483ed9fd87689a1ea8e5c1

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 5ba3bff7e..91c63af11 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -473,6 +473,10 @@ L.Control.LokDialog = L.Control.extend({
 				this._resizeSidebar(strId, width);
 			}
 
+			// Hide cursor.
+			this._currentDeck.cursorVisible = false;
+			$('#' + strId + '-cursor').css({display: 'none'});
+
 			// update the underlying canvas
 			var panelCanvas = L.DomUtil.get(this._currentDeck.strId + '-canvas');
 			this._setCanvasWidthHeight(panelCanvas, width, height);
commit c374a18f6e3780b0e4cdc48458989d6d2d1b75ba
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 30 09:10:28 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    wsd: document forced autosave and why isAutosave=false
    
    Change-Id: I5bb35898bb917f6768327b264e87dd9000a10ecc

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 57d6b8fc7..08d4d3b11 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -607,6 +607,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
         }
     }
 
+
 #if ENABLE_SUPPORT_KEY
     if (!LOOLWSD::OverrideWatermark.empty())
         watermarkText = LOOLWSD::OverrideWatermark;
commit ceb9f895b6fad00de1870feac40041500d00f98a
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Nov 27 09:38:07 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: trigger sidebar change upon load
    
    Here we trigger changing the sidebar to ensure that
    we do show the sidebar and the notification is not lost.
    Since sidebar creation happens before the view/frame are
    attached, we tend to lose said notification.
    
    Another benefit to triggering all sidebars here is that
    we preload them so switching between them is snappy.
    This should be moved to preinit stage though.
    
    Change-Id: I19345c7c0405ad83a8b6fcd86c50bcdbb1b8f9ff

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 8cd4204ce..e65f43b5a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -235,8 +235,14 @@ L.Map = L.Evented.extend({
 				// Let the first page finish loading then load the sidebar.
 				var map = this;
 				setTimeout(function () {
+                    // This triggers all sidebar decks, so they would
+                    // be loaded and show rather quickly on first use.
+                    // Also, triggers sidebar window creation in the client.
+					map._socket.sendMessage('uno .uno:MasterSlidesPanel');
+					map._socket.sendMessage('uno .uno:CustomAnimation');
+					map._socket.sendMessage('uno .uno:SlideChangeWindow');
 					map._socket.sendMessage('uno .uno:ModifyPage');
-				}, 1000);
+				}, 200);
 			}
 		}, this);
 	},
commit 8ad642b818ce173106a67a394dd591091646c605
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 23 11:18:18 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: don't let sidebar steal focus from editor
    
    Change-Id: I7401389a3b54d8001de88818da11c447cf29af62

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 51acec481..5ba3bff7e 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -771,6 +771,12 @@ L.Control.LokDialog = L.Control.extend({
 		var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
 		if (spreadsheetRowColumnFrame)
 			spreadsheetRowColumnFrame.style.right = width.toString() + 'px';
+
+		// If we didn't have the focus, don't steal it form the editor.
+		if ($('#' + this._currentDeck.strId + '-cursor').css('display') === 'none') {
+			this._map.fire('editorgotfocus');
+			this._map.focus();
+		}
 	},
 
 	_onDialogChildClose: function(dialogId) {
commit f3e01f96629350f7b71114fcb2ba8528b32a1f5a
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 23 10:53:39 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: take focus when clicking in the editor
    
    This fixes the issue of clicking back into the editor
    where the cursor actually is. Because we rely on Core
    to give us cursor updates to take focus, this never
    happens when we click where the cursor actually is,
    since there is no change. End result is that the
    editor doesn't get focus.
    
    With this fix we ensure that we release dialogs/sidebar
    from focus and properly aquire it, even if Core doesn't
    give us cursor updates.
    
    Change-Id: Ib05b2bf5238ad92aed81ab53a9f54ea8bc3e5195

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 168a449df..8cd4204ce 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1239,10 +1239,11 @@ L.Map = L.Evented.extend({
 
 		// (tml: For me, for this to work with a mobile device, we need to
 		// accept 'mouseup', too, and check the _wasSingleTap flag set over in Map.Tap.js.)
-		if (type === 'click' || (type === 'mouseup' &&
+		if (type === 'click' || type === 'dblclick' || (type === 'mouseup' &&
 					 typeof this._container._wasSingleTap !== 'undefined' &&
 					 this._container._wasSingleTap)) {
 			if (this._permission === 'edit') {
+				this.fire('editorgotfocus');
 				this.focus();
 			}
 
commit 7159068462f0b5f7c400cf4f63a4f662c65ccbf7
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 23 00:58:05 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: support closing of sidebars
    
    Change-Id: Icf94810af18fd4b67d32bd9c5f5008f9326abf4e

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index bbdf8edf3..51acec481 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -298,6 +298,8 @@ L.Control.LokDialog = L.Control.extend({
 			parent = this._getParentId(e.id);
 			if (parent)
 				this._onDialogChildClose(parent);
+			else if (this._isSidebar(e.id))
+				this._onSidebarClose(e.id);
 			else
 				this._onDialogClose(e.id, false);
 		}
@@ -652,6 +654,14 @@ L.Control.LokDialog = L.Control.extend({
 		                              ' char=' + charcode + ' key=' + keycode);
 	},
 
+	_onSidebarClose: function(dialogId) {
+		this._resizeSidebar(dialogId, 0);
+		$('#' + this._currentDeck.strId).remove();
+		this._map.focus();
+		delete this._dialogs[dialogId];
+		this._currentDeck = null;
+	},
+
 	_onDialogClose: function(dialogId, notifyBackend) {
 		if (window.ThisIsTheiOSApp)
 			w2ui['editbar'].enable('closemobile');
@@ -751,12 +761,16 @@ L.Control.LokDialog = L.Control.extend({
 	_resizeSidebar: function(strId, width) {
 		this._currentDeck.width = width;
 		var sidebar = L.DomUtil.get(strId);
-		sidebar.width = width;
-		sidebar.style.width = width.toString() + 'px';
+		if (sidebar) {
+			sidebar.width = width;
+			if (sidebar.style)
+				sidebar.style.width = width.toString() + 'px';
+		}
+
 		this._map.options.documentContainer.style.right = (width + 1).toString() + 'px';
 		var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
 		if (spreadsheetRowColumnFrame)
-			spreadsheetRowColumnFrame.style.right = sidebar.style.width;
+			spreadsheetRowColumnFrame.style.right = width.toString() + 'px';
 	},
 
 	_onDialogChildClose: function(dialogId) {
commit e0cc52ea627d0163fd215123c8b8ce073ac7555e
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 23 00:04:25 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: show the sidebar after loading
    
    We allow for the first page to render before
    we request the Impress/Draw sidebar.
    
    Change-Id: I95351ab4737cf70af2b621e513c9cd187204e985

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index d775fdf25..168a449df 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -228,6 +228,16 @@ L.Map = L.Evented.extend({
 			}
 
 			this.initializeModificationIndicator();
+
+			// Show sidebar.
+			if (this._docLayer &&
+				(this._docLayer._docType === 'presentation' || this._docType === 'drawing')) {
+				// Let the first page finish loading then load the sidebar.
+				var map = this;
+				setTimeout(function () {
+					map._socket.sendMessage('uno .uno:ModifyPage');
+				}, 1000);
+			}
 		}, this);
 	},
 
commit dee28b6b1eae2c5faf18c3e7cf7dd2264b05f833
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Nov 20 01:10:41 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    sidebar: Resize the underlying canvas on resize.
    
    Otherwise it always stays 400x600 and things get cut off.
    
    Change-Id: I999ef1f852f933ac447d500d922e6d38cb028459

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 7ef1001fe..5264b2b42 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -73,10 +73,10 @@ body {
     position: absolute;
     top: 77px;
     right: 0px;
-    bottom: 36px;
+    bottom: 37px;
     border-top: 1px solid #b6b6b6;
     border-left: 1px solid #b6b6b6;
-    display: block;
+    overflow: hidden; /* FIXME we want scrollbars here to handle overflows client-side */
     z-index: 1100;
 }
 
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index c135b9e78..bbdf8edf3 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -466,13 +466,15 @@ L.Control.LokDialog = L.Control.extend({
 
 		var strId = this._toStrId(id);
 
-		if (this._currentDeck)
-		{
-			if (width > 0)
-			{
+		if (this._currentDeck) {
+			if (width > 0) {
 				this._resizeSidebar(strId, width);
 			}
 
+			// update the underlying canvas
+			var panelCanvas = L.DomUtil.get(this._currentDeck.strId + '-canvas');
+			this._setCanvasWidthHeight(panelCanvas, width, height);
+
 			// Render window.
 			this._sendPaintWindowRect(id);
 			return;
@@ -482,7 +484,7 @@ L.Control.LokDialog = L.Control.extend({
 		panelContainer.id = strId;
 
 		// Create the panel canvas.
-		var panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
+		panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
 		L.DomUtil.setStyle(panelCanvas, 'position', 'absolute');
 		this._setCanvasWidthHeight(panelCanvas, width, height);
 		panelCanvas.id = strId + '-canvas';
commit 20ca03ee754b78a4ced9c49073b73e3e76d9196d
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Nov 20 00:30:39 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    sidebar: Lower the z-index, so that it is covered with the overlay.
    
    Change-Id: I8f6910289ca512c253d34b251c7385f1dc55fead

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 9930f021c..7ef1001fe 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -77,6 +77,7 @@ body {
     border-top: 1px solid #b6b6b6;
     border-left: 1px solid #b6b6b6;
     display: block;
+    z-index: 1100;
 }
 
 #sidebar-panel {
commit 500d79f1f0cdeba077ad507aa0b881e79a95de61
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Nov 20 00:11:33 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    sidebar: Send resize events according to the container, not the canvas.
    
    The canvas is fixed size and does not resize, so gets no resize events.
    
    Change-Id: Ie18f9f2e5c64cc7a54e506f2fbe0ed3a5d372b06

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 752cf3fcc..c135b9e78 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -518,17 +518,8 @@ L.Control.LokDialog = L.Control.extend({
 		var dlgInput = this._createDialogInput(strId);
 		this._setupWindowEvents(id, panelCanvas, dlgInput);
 
-		L.DomEvent.on(panelCanvas, 'resize', function() {
-			this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelCanvas.width + ',' + panelCanvas.height);
-		}, this);
 		L.DomEvent.on(panelContainer, 'resize', function() {
-			var sidebarpanel = L.DomUtil.get('sidebar-panel');
-			if (sidebarpanel) {
-				var sidebar = sidebarpanel.children[0];
-				if (sidebar) {
-					this._map._socket.sendMessage('resizewindow ' + id + ' size=' + sidebar.width + ',' + sidebar.height);
-				}
-			}
+			this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelContainer.width + ',' + panelContainer.height);
 		}, this);
 		L.DomEvent.on(panelContainer, 'mouseleave', function() {
 			// Move the mouse off-screen when we leave the sidebar
commit d1ba38386c2c8367213afd47d66f992870fa7207
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Nov 19 23:03:52 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    sibebar: Various smaller visual cleanups.
    
    * Make it work with the menu fold / unfold button
    * White background + a grey line separating the document area + the
      sidebar
    * Use CSS instead of manually setting the properties in some cases
    
    Change-Id: I2ba7201075637ebdcc2b9f7319aa59317631aba2

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 5b21f74a7..9930f021c 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -69,16 +69,24 @@ body {
 }
 
 #sidebar-dock-wrapper {
-    background: #dfdfdf;
-    float: right;
-    /* position: absolute; */
-    top: 70px;
-    /* left: 0px; */
-    bottom: 66px;
+    background: #fff;
+    position: absolute;
+    top: 77px;
+    right: 0px;
+    bottom: 36px;
     border-top: 1px solid #b6b6b6;
+    border-left: 1px solid #b6b6b6;
     display: block;
 }
 
+#sidebar-panel {
+    padding: 0px;
+    margin: 0px;
+    position: relative;
+    width: 100%;
+    height: 100%;
+}
+
 #toolbar-wrapper {
 	position: relative;
 	table-layout: fixed;
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index 8560c73c3..440454c5d 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -139,7 +139,6 @@ ifelse(MOBILEAPP,[true],
 
     <div id="sidebar-dock-wrapper">
       <div id="sidebar-panel"></div>
-      <div id="sidebar-toolbar"></div>
     </div>
 
     <div id="mobile-edit-button" style="display: none">
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 54755677b..752cf3fcc 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -479,11 +479,6 @@ L.Control.LokDialog = L.Control.extend({
 		}
 
 		var panelContainer = L.DomUtil.create('div', 'panel', L.DomUtil.get('sidebar-panel'));
-		L.DomUtil.setStyle(panelContainer, 'padding', '0px');
-		L.DomUtil.setStyle(panelContainer, 'margin', '0px');
-		L.DomUtil.setStyle(panelContainer, 'position', 'relative');
-		panelContainer.width = width;
-		panelContainer.height = height;
 		panelContainer.id = strId;
 
 		// Create the panel canvas.
@@ -765,7 +760,7 @@ L.Control.LokDialog = L.Control.extend({
 		var sidebar = L.DomUtil.get(strId);
 		sidebar.width = width;
 		sidebar.style.width = width.toString() + 'px';
-		this._map.options.documentContainer.style.right = sidebar.style.width;
+		this._map.options.documentContainer.style.right = (width + 1).toString() + 'px';
 		var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
 		if (spreadsheetRowColumnFrame)
 			spreadsheetRowColumnFrame.style.right = sidebar.style.width;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 552b4d132..d775fdf25 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1498,6 +1498,7 @@ L.Map = L.Evented.extend({
 			moveObjectVertically($('#spreadsheet-row-column-frame'), 36);
 			moveObjectVertically($('#document-container'), 36);
 			moveObjectVertically($('#presentation-controls-wrapper'), 36);
+			moveObjectVertically($('#sidebar-dock-wrapper'), 36);
 		}
 		else {
 			$('.main-nav').css({'display': 'none'});
@@ -1512,6 +1513,7 @@ L.Map = L.Evented.extend({
 			moveObjectVertically($('#spreadsheet-row-column-frame'), -36);
 			moveObjectVertically($('#document-container'), -36);
 			moveObjectVertically($('#presentation-controls-wrapper'), -36);
+			moveObjectVertically($('#sidebar-dock-wrapper'), -36);
 		}
 	}
 });
commit d51c53ffc0eeae9a7b27000462e2784975382eb6
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Nov 19 20:08:14 2018 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    sidebar: Remove the old JS pieces.
    
    Change-Id: I28bc314fc78152e9a4967f8365d441af2d10bb5d

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 47a453d4a..a050edf47 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -286,13 +286,6 @@ var deps = {
 		desc: 'Parts preview sidebar'
 	},
 
-	ControlSidebar: {
-		src: ['control/Control.js',
-		      'control/Control.Sidebar.js'],
-		heading: 'Controls',
-		desc: 'Sidebar panels deck'
-	},
-
 	ControlHeader: {
 		src: ['control/Control.js',
 		      'control/Control.Header.js'],
diff --git a/loleaflet/js/main.js b/loleaflet/js/main.js
index 7f79d3102..15e859606 100644
--- a/loleaflet/js/main.js
+++ b/loleaflet/js/main.js
@@ -74,7 +74,6 @@ map.addControl(L.control.scroll());
 map.addControl(L.control.alertDialog());
 map.addControl(L.control.lokDialog());
 map.addControl(L.control.partsPreview());
-map.addControl(L.control.sidebar());
 map.addControl(L.control.tabs());
 map.addControl(L.control.columnHeader());
 map.addControl(L.control.rowHeader());
diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
deleted file mode 100644
index c14069805..000000000
--- a/loleaflet/src/control/Control.Sidebar.js
+++ /dev/null
@@ -1,540 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.Control.Sidebar
- */
-
-/* global $ */
-L.Control.Sidebar = L.Control.extend({
-	panelIdPrefix: 'sidebarpanel-',
-
-	onAdd: function (map) {
-		map;
-		// map.on('window', this._onWindowMsg, this);
-		// map.on('windowpaint', this._onWindowPaint, this);
-	},
-
-	_isParent: function(id) {
-		return this._currentDeck != null && this._currentDeck.id === id;
-	},
-
-	// If returns non-null, then id is that of a panels and we have a parent (with the returned id).
-	_getParentId: function(id) {
-		if (this._isChild(parseInt(id)))
-			return this._currentDeck.id;
-		return null;
-	},
-
-	_isOpen: function(id) {
-		return this._isParent(id) && $('#' + this._toStrId(id)).length > 0;
-	},
-
-	// Converts an string Id to its raw integer Id.
-	_toIntId: function(id) {
-		if (typeof(id) === 'string')
-			return parseInt(id.replace(this.panelIdPrefix, ''));
-		return id;
-	},
-
-	// Converts an integer Id to string, such as 'sidebarpanel-123'.
-	_toStrId: function(id) {
-		return this.panelIdPrefix + id;
-	},
-
-	_isChild: function(id) {
-		return this._currentDeck != null && this._currentDeck.child != null && this._currentDeck.child.id === id;
-	},
-
-	_isChildOpen: function(id) {
-		return this._isChild(id) && $('#' + this._currentDeck.strId + '-floating').length > 0;
-	},
-
-	_sendPaintWindowRect: function(id, x, y, width, height) {
-		if (!width)
-			width = this._currentDeck.width;
-		if (width <= 0)
-			return;	// Don't request rendering an empty area.
-		if (!height)
-			height = this._currentDeck.height;
-		if (height <= 0)
-			return;	// Don't request rendering an empty area.
-		if (!x)
-			x = 0;
-		if (!y)
-			y = 0;
-
-		// pre-multiplied by the scale factor
-		var dpiscale = L.getDpiScaleFactor();
-		var rect = [x * dpiscale, y * dpiscale, width * dpiscale, height * dpiscale].join(',');
-		this._sendPaintWindow(id, rect);
-	},
-
-	_sendPaintWindow: function(id, rectangle) {
-		if (!rectangle)
-			return; // Don't request rendering an empty area.
-
-		rectangle = rectangle.replace(/ /g, '');
-		if (!rectangle)
-			return; // Don't request rendering an empty area.
-
-		var dpiscale = L.getDpiScaleFactor();
-		console.log('_sendPaintWindow: rectangle: ' + rectangle + ', dpiscale: ' + dpiscale);
-		this._map._socket.sendMessage('paintwindow ' + id + ' rectangle=' + rectangle + ' dpiscale=' + dpiscale);
-	},
-
-	_isRectangleValid: function(rect) {
-		rect = rect.split(',');
-		return (parseInt(rect[0]) >= 0 && parseInt(rect[1]) >= 0 &&
-				parseInt(rect[2]) >= 0 && parseInt(rect[3]) >= 0);
-	},
-
-	_onWindowMsg: function(e) {
-		e.id = parseInt(e.id);
-		var strId = this._toStrId(e.id);
-
-		var width = 0;
-		var height = 0;
-		if (e.size) {
-			width = parseInt(e.size.split(',')[0]);
-			height = parseInt(e.size.split(',')[1]);
-		}
-
-		var left = 0;
-		var top = 0;
-		if (e.position) {
-			left = parseInt(e.position.split(',')[0]);
-			top = parseInt(e.position.split(',')[1]);
-		}
-
-		if (e.action === 'created') {
-			if (e.winType === 'deck') {
-				this._launchSidebar(e.id, left, top, width, height);
-			} else if (e.winType === 'child') {
-				var parentId = parseInt(e.parentId);
-				if (!this._isOpen(parentId))
-					return;
-
-				left -= this._currentDeck.left;
-				top -= this._currentDeck.top;
-
-				this._removeChild(parentId);
-				this._currentDeck.child = {
-					id: e.id,
-					strId: strId,
-					left: left,
-					top: top,
-					width: width,
-					height: height,
-					parentId: parentId
-				};
-
-				this._createChild(e.id, parentId, top, left);
-				this._sendPaintWindowRect(e.id, 0, 0, width, height);
-			}
-			else {
-				// We only handle sidebar panels here (see Control.LokDialog.js)
-				return;
-			}
-		}
-
-		// The following act on an existing window.
-		if (!this._isOpen(e.id) && !this._isChildOpen(e.id))
-			return;
-
-		if (e.action === 'invalidate') {
-			var rectangle = e.rectangle;
-			if (!rectangle || !this._isRectangleValid(rectangle))
-			{
-				if (this._isChild(e.id))
-					rectangle = '0,0,' + this._currentDeck.child.width + ',' + this._currentDeck.child.height;
-				else
-					rectangle = '0,0,' + this._currentDeck.width + ',' + this._currentDeck.height;
-
-				this._sendPaintWindow(e.id, rectangle);
-			}
-			else if (this._isChild(e.id))
-			{
-				// Child windows are given relative coordinates.
-				this._sendPaintWindow(e.id, rectangle);
-			}
-			else
-			{
-				// Convert from absolute screen coordinates to relative.
-				rectangle = rectangle.split(',');
-				rectangle[0] = parseInt(rectangle[0]) - this._currentDeck.left;
-				rectangle[1] = parseInt(rectangle[1]) - this._currentDeck.top;
-				this._sendPaintWindowRect(e.id, rectangle[0], rectangle[1], rectangle[2], rectangle[3]);
-			}
-		} else if (e.action === 'size_changed') {
-			this._launchSidebar(e.id, left, top, width, height);
-		} else if (e.action === 'cursor_invalidate') {
-			if (this._isOpen(e.id) && !!e.rectangle) {
-				rectangle = e.rectangle.split(',');
-				var x = parseInt(rectangle[0]);
-				var y = parseInt(rectangle[1]);
-				height = parseInt(rectangle[3]);
-
-				// Relative x to the sidebar.
-				x -= this._currentDeck.left;
-
-				this._updateDialogCursor(e.id, x, y, height);
-			}
-		} else if (e.action === 'cursor_visible') {
-			this._currentDeck.cursor.cursorVisible = e.visible === 'true';
-			if (this._currentDeck.cursor.cursorVisible)
-				$('#' + strId + '-cursor').css({display: 'block'});
-			else
-				$('#' + strId + '-cursor').css({display: 'none'});
-		} else if (e.action === 'close') {
-			var parent = this._getParentId(e.id);
-			if (parent)
-				this._onPanelChildClose(this._toStrId(parent));
-			else
-				this._onPanelClose(e.id, false);
-		}
-	},
-
-	_updateDialogCursor: function(dlgId, x, y, height) {
-		var strId = this._toStrId(dlgId);
-		var dialogCursor = L.DomUtil.get(strId + '-cursor');
-		L.DomUtil.setStyle(dialogCursor, 'height', height + 'px');
-		L.DomUtil.setStyle(dialogCursor, 'display', this._currentDeck.cursor.cursorVisible ? 'block' : 'none');
-		// set the position of the cursor container element
-		L.DomUtil.setStyle(this._currentDeck.cursor, 'left', x + 'px');
-		L.DomUtil.setStyle(this._currentDeck.cursor, 'top', y + 'px');
-
-		// update the input as well
-		this._updateDialogInput(dlgId);
-	},
-
-	_createDialogCursor: function(dialogId) {
-		this._currentDeck.cursor = L.DomUtil.create('div', 'sidebar-cursor-container', L.DomUtil.get(dialogId));
-		var cursor = L.DomUtil.create('div', 'leaflet-cursor lokdialog-cursor', this._currentDeck.cursor);
-		cursor.id = dialogId + '-cursor';
-		L.DomUtil.addClass(cursor, 'blinking-cursor');
-	},
-
-	_createDialogInput: function(dialogId) {
-		var clipDlgContainer = L.DomUtil.create('div', 'clipboard-container', L.DomUtil.get(dialogId));
-		clipDlgContainer.id = dialogId + '-clipboard-container';
-		var dlgTextArea = L.DomUtil.create('input', 'clipboard', clipDlgContainer);
-		dlgTextArea.setAttribute('type', 'text');
-		dlgTextArea.setAttribute('autocorrect', 'off');
-		dlgTextArea.setAttribute('autocapitalize', 'off');
-		dlgTextArea.setAttribute('autocomplete', 'off');
-		dlgTextArea.setAttribute('spellcheck', 'false');
-		this._currentDeck.input = dlgTextArea;
-
-		return dlgTextArea;
-	},
-
-	_updateDialogInput: function(dlgId) {
-		if (!this._currentDeck.input)
-			return;
-
-		var strId = this._toStrId(dlgId);
-		var left = parseInt(L.DomUtil.getStyle(this._currentDeck.cursor, 'left'));
-		var top = parseInt(L.DomUtil.getStyle(this._currentDeck.cursor, 'top'));
-		var dlgContainer = L.DomUtil.get(strId + '-clipboard-container');
-		L.DomUtil.setPosition(dlgContainer, new L.Point(left, top));
-	},
-
-	focus: function(dlgId) {
-		if (!this._isOpen(dlgId) || !this._currentDeck.input)
-			return;
-
-		this._currentDeck.input.focus();
-	},
-
-	_setCanvasWidthHeight: function(canvas, width, height) {
-		// FIXME: Setting the style width/height is messing up the cursor.
-		// L.DomUtil.setStyle(canvas, 'width', width + 'px');
-		// L.DomUtil.setStyle(canvas, 'height', height + 'px');
-
-		var scale = L.getDpiScaleFactor();
-		canvas.width = width * scale;
-		canvas.height = height * scale;
-	},
-
-	_launchSidebar: function(id, left, top, width, height) {
-
-		if (!left)
-			left = 0;
-		if (!top)
-			top = 0;
-
-		var strId = this._toStrId(id);
-
-		if (this._currentDeck)
-		{
-			if (width > 0)
-			{
-				this._resizeSidebar(strId, width);
-			}
-
-			// Render window.
-			this._sendPaintWindowRect(id);
-			return;
-		}
-
-		var panelContainer = L.DomUtil.create('div', 'panel', L.DomUtil.get('sidebar-panel'));
-		L.DomUtil.setStyle(panelContainer, 'padding', '0px');
-		L.DomUtil.setStyle(panelContainer, 'margin', '0px');
-		L.DomUtil.setStyle(panelContainer, 'position', 'relative');
-		panelContainer.width = width;
-		panelContainer.height = height;
-		panelContainer.id = strId;
-
-		// Create the panel canvas.
-		var panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
-		L.DomUtil.setStyle(panelCanvas, 'position', 'absolute');
-		this._setCanvasWidthHeight(panelCanvas, width, height);
-		panelCanvas.id = strId + '-canvas';
-
-		// Create the child canvas now, to make it on top of the main panel canvas.
-		var floatingCanvas = L.DomUtil.create('canvas', 'lokdialogchild-canvas', panelContainer);
-		L.DomUtil.setStyle(floatingCanvas, 'position', 'absolute');
-		floatingCanvas.width = 0;
-		floatingCanvas.height = 0;
-		floatingCanvas.id = strId + '-floating';
-
-		// Don't show the sidebar until we get the contents.
-		$(panelContainer).parent().hide();
-
-		this._currentDeck = {
-			id: id,
-			strId: strId,
-			left: left,
-			top: top,
-			width: width,
-			height: height,
-			cursor: null,
-			input: null,
-			child: null // One child, typically drop-down list
-		};
-
-		// don't make 'TAB' focus on this button; we want to cycle focus in the lok dialog with each TAB
-		// $('.lokdialog_container button.ui-dialog-titlebar-close').attr('tabindex', '-1').blur();
-
-		this._createDialogCursor(strId);
-		var dlgInput = this._createDialogInput(strId);
-		this._setupWindowEvents(id, panelCanvas, dlgInput);
-
-		L.DomEvent.on(panelCanvas, 'resize', function() {
-			this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelCanvas.width + ',' + panelCanvas.height);
-		}, this);
-		L.DomEvent.on(panelContainer, 'resize', function() {
-			var sidebarpanel = L.DomUtil.get('sidebar-panel');
-			if (sidebarpanel) {
-				var sidebar = sidebarpanel.children[0];
-				if (sidebar) {
-					this._map._socket.sendMessage('resizewindow ' + id + ' size=' + sidebar.width + ',' + sidebar.height);
-				}
-			}
-		}, this);
-		L.DomEvent.on(panelContainer, 'mouseleave', function() {
-			// Move the mouse off-screen when we leave the sidebar
-			// so we don't leave edge-elements highlighted as if
-			// the mouse is still over them.
-			this._map.lastActiveTime = Date.now();
-			this._postWindowMouseEvent('move', id, -1, -1, 1, 0, 0);
-		}, this);
-
-		// Render window.
-		this._sendPaintWindowRect(id);
-	},
-
-	_setupWindowEvents: function(id, canvas, dlgInput) {
-		L.DomEvent.on(canvas, 'contextmenu', L.DomEvent.preventDefault);
-		L.DomEvent.on(canvas, 'mousemove', function(e) {
-			this._map.lastActiveTime = Date.now();
-			this._postWindowMouseEvent('move', id, e.offsetX, e.offsetY, 1, 0, 0);
-		}, this);
-		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {
-			L.DomEvent.stopPropagation(e);
-			var buttons = 0;
-			buttons |= e.button === this._map['mouse'].JSButtons.left ? this._map['mouse'].LOButtons.left : 0;
-			buttons |= e.button === this._map['mouse'].JSButtons.middle ? this._map['mouse'].LOButtons.middle : 0;
-			buttons |= e.button === this._map['mouse'].JSButtons.right ? this._map['mouse'].LOButtons.right : 0;
-			// 'mousedown' -> 'buttondown'
-			var lokEventType = e.type.replace('mouse', 'button');
-			this._postWindowMouseEvent(lokEventType, id, e.offsetX, e.offsetY, 1, buttons, 0);
-			dlgInput.focus();
-		}, this);
-
-		L.DomEvent.on(dlgInput,
-		              'keyup keypress keydown compositionstart compositionupdate compositionend textInput',
-		              function(e) {
-			              e.originalEvent = e; // _onKeyDown fn below requires real event in e.originalEvent
-			              this._map['keyboard']._onKeyDown(e,
-			                                         L.bind(this._postWindowKeyboardEvent,
-			                                                this,
-			                                                id),
-			                                         L.bind(this._postWindowCompositionEvent,
-			                                                this,
-			                                                id),
-			                                         dlgInput);
-
-			              // Keep map active while user is playing with window.
-			              this._map.lastActiveTime = Date.now();
-		              }, this);
-		L.DomEvent.on(dlgInput, 'contextmenu', function() {
-			return false;
-		});
-	},
-
-	_postWindowCompositionEvent: function(winid, type, text) {
-		this._map._docLayer._postCompositionEvent(winid, type, text);
-	},
-
-	_postWindowMouseEvent: function(type, winid, x, y, count, buttons, modifier) {
-		this._map._socket.sendMessage('windowmouse id=' + winid +  ' type=' + type +
-		                              ' x=' + x + ' y=' + y + ' count=' + count +
-		                              ' buttons=' + buttons + ' modifier=' + modifier);
-	},
-
-	_postWindowKeyboardEvent: function(winid, type, charcode, keycode) {
-		this._map._socket.sendMessage('windowkey id=' + winid + ' type=' + type +
-		                              ' char=' + charcode + ' key=' + keycode);
-	},
-
-	_onPanelClose: function(id, notifyBackend) {
-		if (notifyBackend)
-			this._sendCloseWindow(id);
-		$('#' + this._toStrId(id)).remove();
-		var sidebar = L.DomUtil.get(this._currentDeck.strId);
-		if (sidebar)
-			sidebar.style.width = '0px';
-		var docContainer = this._map.options.documentContainer;
-		docContainer.style.right = '0px';
-		var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
-		if (spreadsheetRowColumnFrame)
-			spreadsheetRowColumnFrame.style.right = '0px';
-		this._map.focus();
-		this._currentDeck = null;
-	},
-
-	/// Rendered image sent from Core.
-	_paintPanel: function (parentId, rectangle, imgData) {
-
-		var strId = this._toStrId(parentId);
-		var canvas = document.getElementById(strId + '-canvas');
-		if (!canvas)
-			return; // no window to paint to
-
-		// The actual image of the window may be larger/smaller than the dimension we get on size_changed.
-		var width = this._currentDeck.width;
-
-		var ctx = canvas.getContext('2d');
-
-		var that = this;
-		var img = new Image();
-		img.onload = function() {
-			var x = 0;
-			var y = 0;
-			if (rectangle) {
-				rectangle = rectangle.split(',');
-				x = parseInt(rectangle[0]);
-				y = parseInt(rectangle[1]);
-			}
-
-			that._resizeSidebar(strId, width);
-
-			// Render.
-			ctx.drawImage(img, x, y);
-
-			// If sidebar panel is hidden, show it.
-			var container = L.DomUtil.get(strId);
-			if (container)
-				$(container).parent().show();
-			that.focus(parentId);
-		};
-		img.src = imgData;
-	},
-
-	/// Rendered image sent from Core.
-	_onWindowPaint: function (e) {
-		var parent = this._getParentId(e.id);
-		if (parent) {
-			this._paintPanelChild(parent, e.width, e.height, e.rectangle, e.img);
-		} else {
-			this._paintPanel(e.id, e.rectangle, e.img);
-		}
-	},
-
-	_paintPanelChild: function(parentId, width, height, rectangle, imgData) {
-		var strId = this._toStrId(parentId);
-		var img = new Image();
-		var canvas = L.DomUtil.get(strId + '-floating');
-		if (!canvas)
-			return; // no floating window to paint to
-
-		this._setCanvasWidthHeight(canvas, width, height);
-
-		var ctx = canvas.getContext('2d');
-		img.onload = function() {
-			ctx.drawImage(img, 0, 0);
-		};
-		img.src = imgData;
-	},
-
-	_resizeSidebar: function(strId, width) {
-		this._currentDeck.width = width;
-		var sidebar = L.DomUtil.get(strId);
-		sidebar.width = width;
-		sidebar.style.width = width.toString() + 'px';
-		this._map.options.documentContainer.style.right = sidebar.style.width;
-		var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
-		if (spreadsheetRowColumnFrame)
-			spreadsheetRowColumnFrame.style.right = sidebar.style.width;
-	},
-
-	_onPanelChildClose: function(parentId) {
-		this._removeChild(parentId);
-
-		// remove any extra height allocated for the parent container
-		var canvasHeight = document.getElementById(parentId + '-canvas').height;
-		$('#' + parentId).height(canvasHeight + 'px');
-	},
-
-	_removeChild: function(parentId) {
-		if (typeof parentId === 'number')
-			parentId = this._toStrId(parentId);
-		var floatingCanvas = L.DomUtil.get(parentId + '-floating');
-		floatingCanvas.width = 0;
-		floatingCanvas.height = 0;
-	},
-
-	_createChild: function(childId, parentId, top, left) {
-		var strId = this._toStrId(parentId);
-		var floatingCanvas = L.DomUtil.get(strId + '-floating');
-		L.DomUtil.setStyle(floatingCanvas, 'position', 'relative'); // Relative to the sidebar
-		L.DomUtil.setStyle(floatingCanvas, 'left', left + 'px'); // yes, it's necessary to append 'px'
-		L.DomUtil.setStyle(floatingCanvas, 'top', top + 'px');
-
-		// attach events
-		this._setupChildEvents(childId, floatingCanvas);
-	},
-
-	_setupChildEvents: function(childId, canvas) {
-		L.DomEvent.on(canvas, 'contextmenu', L.DomEvent.preventDefault);
-
-		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {
-			var buttons = 0;
-			buttons |= e.button === this._map['mouse'].JSButtons.left ? this._map['mouse'].LOButtons.left : 0;
-			buttons |= e.button === this._map['mouse'].JSButtons.middle ? this._map['mouse'].LOButtons.middle : 0;
-			buttons |= e.button === this._map['mouse'].JSButtons.right ? this._map['mouse'].LOButtons.right : 0;
-			var lokEventType = e.type.replace('mouse', 'button');
-			this._postWindowMouseEvent(lokEventType, childId, e.offsetX, e.offsetY, 1, buttons, 0);
-		}, this);
-		L.DomEvent.on(canvas, 'mousemove', function(e) {
-			this._postWindowMouseEvent('move', childId, e.offsetX, e.offsetY, 1, 0, 0);
-		}, this);
-		L.DomEvent.on(canvas, 'contextmenu', function() {
-			return false;
-		});
-	}
-});
-
-L.control.sidebar = function (options) {
-	return new L.Control.Sidebar(options);
-};
commit 0145b2e49a8e47f2164f4ca73bbd0b648a8a616c
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 22:51:46 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: move sidebar handling in dialogs
    
    Change-Id: Ibe9aa9d58b7bc2b91bfb4700d506f6b782c2fd28

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index ddcbfe6a3..54755677b 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -118,6 +118,10 @@ L.Control.LokDialog = L.Control.extend({
 			$('#' + this._toStrId(id)).length > 0;
 	},
 
+	_isSidebar: function(id) {
+		return this._dialogs[id].isSidebar;
+	},
+
 	// Given a prefixed dialog id like 'lokdialog-323', gives a raw id, 323.
 	_toIntId: function(id) {
 		if (typeof(id) === 'string')
@@ -151,6 +155,26 @@ L.Control.LokDialog = L.Control.extend({
 		return [x * dpiscale, y * dpiscale, width * dpiscale, height * dpiscale].join(',');
 	},
 
+	_sendPaintWindowRect: function(id, x, y, width, height) {
+		if (!width)
+			width = this._dialogs[id].width;
+		if (width <= 0)
+			return;	// Don't request rendering an empty area.
+		if (!height)
+			height = this._dialogs[id].height;
+		if (height <= 0)
+			return;	// Don't request rendering an empty area.
+		if (!x)
+			x = 0;
+		if (!y)
+			y = 0;
+
+		// pre-multiplied by the scale factor
+		var dpiscale = L.getDpiScaleFactor();
+		var rect = [x * dpiscale, y * dpiscale, width * dpiscale, height * dpiscale].join(',');
+		this._sendPaintWindow(id, rect);
+	},
+
 	_sendPaintWindow: function(id, rectangle) {
 		if (!rectangle)
 			return; // Don't request rendering an empty area.
@@ -175,8 +199,7 @@ L.Control.LokDialog = L.Control.extend({
 	},
 
 	_onDialogMsg: function(e) {
-		if (e.winType != undefined && e.winType !== 'dialog' && e.winType !== 'child') {
-			// We only handle pop-up dialogs here (see Control.Sidebar.js)
+		if (e.winType != undefined && e.winType !== 'dialog' && e.winType !== 'child' && e.winType !== 'deck') {
 			return;
 		}
 
@@ -200,6 +223,8 @@ L.Control.LokDialog = L.Control.extend({
 		if (e.action === 'created') {
 			if (e.winType === 'dialog') {
 				this._launchDialog(e.id, left, top, width, height, e.title);
+			} else if (e.winType === 'deck') {
+				this._launchSidebar(e.id, left, top, width, height);
 			} else if (e.winType === 'child') {
 				var parentId = parseInt(e.parentId);
 				if (!this._isOpen(parentId))
@@ -410,8 +435,13 @@ L.Control.LokDialog = L.Control.extend({
 		L.DomUtil.setStyle(dialogContainer, 'minHeight', height + 'px');
 
 		this._dialogs[id] = {
+			id: id,
+			strId: strId,
+			isSidebar: false,
 			width: width,
 			height: height,
+			cursor: null,
+			input: null,
 			title: title
 		};
 
@@ -427,6 +457,96 @@ L.Control.LokDialog = L.Control.extend({
 		this._sendPaintWindow(id, this._createRectStr(id));
 	},
 
+	_launchSidebar: function(id, left, top, width, height) {
+
+		if (!left)
+			left = 0;
+		if (!top)
+			top = 0;
+
+		var strId = this._toStrId(id);
+
+		if (this._currentDeck)
+		{
+			if (width > 0)
+			{
+				this._resizeSidebar(strId, width);
+			}
+
+			// Render window.
+			this._sendPaintWindowRect(id);
+			return;
+		}
+
+		var panelContainer = L.DomUtil.create('div', 'panel', L.DomUtil.get('sidebar-panel'));
+		L.DomUtil.setStyle(panelContainer, 'padding', '0px');
+		L.DomUtil.setStyle(panelContainer, 'margin', '0px');
+		L.DomUtil.setStyle(panelContainer, 'position', 'relative');
+		panelContainer.width = width;
+		panelContainer.height = height;
+		panelContainer.id = strId;
+
+		// Create the panel canvas.
+		var panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
+		L.DomUtil.setStyle(panelCanvas, 'position', 'absolute');
+		this._setCanvasWidthHeight(panelCanvas, width, height);
+		panelCanvas.id = strId + '-canvas';
+
+		// Create the child canvas now, to make it on top of the main panel canvas.
+		var floatingCanvas = L.DomUtil.create('canvas', 'lokdialogchild-canvas', panelContainer);
+		L.DomUtil.setStyle(floatingCanvas, 'position', 'absolute');
+		floatingCanvas.width = 0;
+		floatingCanvas.height = 0;
+		floatingCanvas.id = strId + '-floating';
+
+		// Don't show the sidebar until we get the contents.
+		$(panelContainer).parent().hide();
+
+		this._dialogs[id] = {
+			open: true,
+			id: id,
+			strId: strId,
+			isSidebar: true,
+			left: left,
+			top: top,
+			width: width,
+			height: height,
+			cursor: null,
+			input: null,
+			child: null, // One child, typically drop-down list
+			title: null  // Never used for sidebars
+		};
+
+		this._currentDeck = this._dialogs[id];
+
+		this._createDialogCursor(strId);
+		var dlgInput = this._createDialogInput(strId);
+		this._setupWindowEvents(id, panelCanvas, dlgInput);
+
+		L.DomEvent.on(panelCanvas, 'resize', function() {
+			this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelCanvas.width + ',' + panelCanvas.height);
+		}, this);
+		L.DomEvent.on(panelContainer, 'resize', function() {
+			var sidebarpanel = L.DomUtil.get('sidebar-panel');
+			if (sidebarpanel) {
+				var sidebar = sidebarpanel.children[0];
+				if (sidebar) {
+					this._map._socket.sendMessage('resizewindow ' + id + ' size=' + sidebar.width + ',' + sidebar.height);
+				}
+			}
+		}, this);
+		L.DomEvent.on(panelContainer, 'mouseleave', function() {
+			// Move the mouse off-screen when we leave the sidebar
+			// so we don't leave edge-elements highlighted as if
+			// the mouse is still over them.
+			this._map.lastActiveTime = Date.now();
+			this._postWindowMouseEvent('move', id, -1, -1, 1, 0, 0);
+		}, this);
+
+		// Render window.
+		this._sendPaintWindowRect(id);
+	},
+
 	_setupWindowEvents: function(id, canvas, dlgInput) {
 		L.DomEvent.on(canvas, 'contextmenu', L.DomEvent.preventDefault);
 		L.DomEvent.on(canvas, 'mousemove', function(e) {
@@ -591,6 +711,10 @@ L.Control.LokDialog = L.Control.extend({
 				y = parseInt(rectangle[1]);
 			}
 
+			// Sidebars find out their size and become visible on first paint.
+			if (that._isSidebar(parentId))
+				that._resizeSidebar(strId, that._currentDeck.width);
+
 			ctx.drawImage(img, x, y);
 
 			// if dialog is hidden, show it
@@ -636,6 +760,17 @@ L.Control.LokDialog = L.Control.extend({
 		img.src = imgData;
 	},
 
+	_resizeSidebar: function(strId, width) {
+		this._currentDeck.width = width;
+		var sidebar = L.DomUtil.get(strId);
+		sidebar.width = width;
+		sidebar.style.width = width.toString() + 'px';
+		this._map.options.documentContainer.style.right = sidebar.style.width;
+		var spreadsheetRowColumnFrame = L.DomUtil.get('spreadsheet-row-column-frame');
+		if (spreadsheetRowColumnFrame)
+			spreadsheetRowColumnFrame.style.right = sidebar.style.width;
+	},
+
 	_onDialogChildClose: function(dialogId) {
 		$('#' + this._toStrId(dialogId) + '-floating').remove();
 		// remove any extra height allocated for the parent container
diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 694559aba..c14069805 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -8,8 +8,9 @@ L.Control.Sidebar = L.Control.extend({
 	panelIdPrefix: 'sidebarpanel-',
 
 	onAdd: function (map) {
-		map.on('window', this._onWindowMsg, this);
-		map.on('windowpaint', this._onWindowPaint, this);
+		map;
+		// map.on('window', this._onWindowMsg, this);
+		// map.on('windowpaint', this._onWindowPaint, this);
 	},
 
 	_isParent: function(id) {
commit d06c646416f039684d5cda307e0a062f3c57913b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 23:03:15 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: dialog and sidebar open flag not used
    
    Change-Id: I3a1a4308df7f874e5b56fb24509a506f294d8bd2

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 964218135..694559aba 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -117,7 +117,6 @@ L.Control.Sidebar = L.Control.extend({
 
 				this._removeChild(parentId);
 				this._currentDeck.child = {
-					open: true,
 					id: e.id,
 					strId: strId,
 					left: left,
@@ -301,7 +300,6 @@ L.Control.Sidebar = L.Control.extend({
 		$(panelContainer).parent().hide();
 
 		this._currentDeck = {
-			open: true,
 			id: id,
 			strId: strId,
 			left: left,
commit e526273a2f8513b82db753169d59b199f7590b4f
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 22:23:56 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: parse dialog dimentions and position once
    
    Change-Id: I573db6f81f5bcd98cc0c97507ea49e89e9089769

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 021336869..964218135 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -90,15 +90,21 @@ L.Control.Sidebar = L.Control.extend({
 		e.id = parseInt(e.id);
 		var strId = this._toStrId(e.id);
 
-		if (e.action === 'created') {
-			var width = parseInt(e.size.split(',')[0]);
-			var height = parseInt(e.size.split(',')[1]);
+		var width = 0;
+		var height = 0;
+		if (e.size) {
+			width = parseInt(e.size.split(',')[0]);
+			height = parseInt(e.size.split(',')[1]);
+		}
 
-			if (e.position) {
-				var left = parseInt(e.position.split(',')[0]);
-				var top = parseInt(e.position.split(',')[1]);
-			}
+		var left = 0;
+		var top = 0;
+		if (e.position) {
+			left = parseInt(e.position.split(',')[0]);
+			top = parseInt(e.position.split(',')[1]);
+		}
 
+		if (e.action === 'created') {
 			if (e.winType === 'deck') {
 				this._launchSidebar(e.id, left, top, width, height);
 			} else if (e.winType === 'child') {
@@ -159,10 +165,6 @@ L.Control.Sidebar = L.Control.extend({
 				this._sendPaintWindowRect(e.id, rectangle[0], rectangle[1], rectangle[2], rectangle[3]);
 			}
 		} else if (e.action === 'size_changed') {
-			width = parseInt(e.size.split(',')[0]);
-			height = parseInt(e.size.split(',')[1]);
-			left = parseInt(e.position.split(',')[0]);
-			top = parseInt(e.position.split(',')[1]);
 			this._launchSidebar(e.id, left, top, width, height);
 		} else if (e.action === 'cursor_invalidate') {
 			if (this._isOpen(e.id) && !!e.rectangle) {
commit 980bd952a2095ceeab2e448d05943a38ac2945f2
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 21:24:18 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: dialog and sidebar paint functions made similar
    
    Change-Id: I699a83468b4a240d05ad48467e931f3932d21373

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 0a2aa41c3..021336869 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -442,9 +442,10 @@ L.Control.Sidebar = L.Control.extend({
 			ctx.drawImage(img, x, y);
 
 			// If sidebar panel is hidden, show it.
-			var sidebarContainer = L.DomUtil.get(strId);
-			if (sidebarContainer)
-				$(sidebarContainer).parent().show();
+			var container = L.DomUtil.get(strId);
+			if (container)
+				$(container).parent().show();
+			that.focus(parentId);
 		};
 		img.src = imgData;
 	},
commit e972191a79ba98437b9fe8ffd45a6b50b872f917
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 19:23:37 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: dialog: sidebar: factor out window event handling
    
    Change-Id: Idddc405f9c85d0db144aedf5d6b41aa512578ed5

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 05abbd056..0a2aa41c3 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -316,6 +316,7 @@ L.Control.Sidebar = L.Control.extend({
 
 		this._createDialogCursor(strId);
 		var dlgInput = this._createDialogInput(strId);
+		this._setupWindowEvents(id, panelCanvas, dlgInput);
 
 		L.DomEvent.on(panelCanvas, 'resize', function() {
 			this._map._socket.sendMessage('resizewindow ' + id + ' size=' + panelCanvas.width + ',' + panelCanvas.height);
@@ -329,8 +330,6 @@ L.Control.Sidebar = L.Control.extend({
 				}
 			}
 		}, this);
-
-		L.DomEvent.on(panelCanvas, 'contextmenu', L.DomEvent.preventDefault);
 		L.DomEvent.on(panelContainer, 'mouseleave', function() {
 			// Move the mouse off-screen when we leave the sidebar
 			// so we don't leave edge-elements highlighted as if
@@ -338,11 +337,18 @@ L.Control.Sidebar = L.Control.extend({
 			this._map.lastActiveTime = Date.now();
 			this._postWindowMouseEvent('move', id, -1, -1, 1, 0, 0);
 		}, this);
-		L.DomEvent.on(panelCanvas, 'mousemove', function(e) {
+
+		// Render window.
+		this._sendPaintWindowRect(id);
+	},
+
+	_setupWindowEvents: function(id, canvas, dlgInput) {
+		L.DomEvent.on(canvas, 'contextmenu', L.DomEvent.preventDefault);
+		L.DomEvent.on(canvas, 'mousemove', function(e) {
 			this._map.lastActiveTime = Date.now();
 			this._postWindowMouseEvent('move', id, e.offsetX, e.offsetY, 1, 0, 0);
 		}, this);
-		L.DomEvent.on(panelCanvas, 'mousedown mouseup', function(e) {
+		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {
 			L.DomEvent.stopPropagation(e);
 			var buttons = 0;
 			buttons |= e.button === this._map['mouse'].JSButtons.left ? this._map['mouse'].LOButtons.left : 0;
@@ -367,15 +373,12 @@ L.Control.Sidebar = L.Control.extend({
 			                                                id),
 			                                         dlgInput);
 
-			              // keep map active while user is playing with panel
+			              // Keep map active while user is playing with window.
 			              this._map.lastActiveTime = Date.now();
 		              }, this);
 		L.DomEvent.on(dlgInput, 'contextmenu', function() {
 			return false;
 		});
-
-		// Render window.
-		this._sendPaintWindowRect(id);
 	},
 
 	_postWindowCompositionEvent: function(winid, type, text) {
commit 49ec8667e0a67936629c0748ff7e9dd5678188b9
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 19:00:52 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: dialog: sidebar: factor out child window event handling
    
    Change-Id: I07938d54b504f20f2508be9f8d50e59a3dcc82e8

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 982709432..05abbd056 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -506,10 +506,14 @@ L.Control.Sidebar = L.Control.extend({
 		L.DomUtil.setStyle(floatingCanvas, 'left', left + 'px'); // yes, it's necessary to append 'px'
 		L.DomUtil.setStyle(floatingCanvas, 'top', top + 'px');
 
-		L.DomEvent.on(floatingCanvas, 'contextmenu', L.DomEvent.preventDefault);
-
 		// attach events
-		L.DomEvent.on(floatingCanvas, 'mousedown mouseup', function(e) {
+		this._setupChildEvents(childId, floatingCanvas);
+	},
+
+	_setupChildEvents: function(childId, canvas) {
+		L.DomEvent.on(canvas, 'contextmenu', L.DomEvent.preventDefault);
+
+		L.DomEvent.on(canvas, 'mousedown mouseup', function(e) {
 			var buttons = 0;
 			buttons |= e.button === this._map['mouse'].JSButtons.left ? this._map['mouse'].LOButtons.left : 0;
 			buttons |= e.button === this._map['mouse'].JSButtons.middle ? this._map['mouse'].LOButtons.middle : 0;
@@ -517,10 +521,10 @@ L.Control.Sidebar = L.Control.extend({
 			var lokEventType = e.type.replace('mouse', 'button');
 			this._postWindowMouseEvent(lokEventType, childId, e.offsetX, e.offsetY, 1, buttons, 0);
 		}, this);
-		L.DomEvent.on(floatingCanvas, 'mousemove', function(e) {
+		L.DomEvent.on(canvas, 'mousemove', function(e) {
 			this._postWindowMouseEvent('move', childId, e.offsetX, e.offsetY, 1, 0, 0);
 		}, this);
-		L.DomEvent.on(floatingCanvas, 'contextmenu', function() {
+		L.DomEvent.on(canvas, 'contextmenu', function() {
 			return false;
 		});
 	}
commit 7f066212dc3eed43c885ecf097118c7323619a8e
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 18:52:08 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: rearangle sidebar functions to minimize diff with dialogs
    
    Change-Id: Ie0218a6dc03ce64bec3dde8871aa95cc5d3c4e6f

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index e12a956cc..982709432 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -16,6 +16,13 @@ L.Control.Sidebar = L.Control.extend({
 		return this._currentDeck != null && this._currentDeck.id === id;
 	},
 
+	// If returns non-null, then id is that of a panels and we have a parent (with the returned id).
+	_getParentId: function(id) {
+		if (this._isChild(parseInt(id)))
+			return this._currentDeck.id;
+		return null;
+	},
+
 	_isOpen: function(id) {
 		return this._isParent(id) && $('#' + this._toStrId(id)).length > 0;
 	},
@@ -40,13 +47,6 @@ L.Control.Sidebar = L.Control.extend({
 		return this._isChild(id) && $('#' + this._currentDeck.strId + '-floating').length > 0;
 	},
 
-	// If returns non-null, then id is that of a panels and we have a parent (with the returned id).
-	_getParentId: function(id) {
-		if (this._isChild(parseInt(id)))
-			return this._currentDeck.id;
-		return null;
-	},
-
 	_sendPaintWindowRect: function(id, x, y, width, height) {
 		if (!width)
 			width = this._currentDeck.width;
commit 4810d53f3f827c3205b388030bd69bdbdf0072cd
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 18:32:16 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: rearangle sidebar functions to minimize diff with dialogs
    
    Change-Id: I0be181006dc398f75a5efd3dd89cf39d20402da5

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index f88265f92..e12a956cc 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -12,6 +12,14 @@ L.Control.Sidebar = L.Control.extend({
 		map.on('windowpaint', this._onWindowPaint, this);
 	},
 
+	_isParent: function(id) {
+		return this._currentDeck != null && this._currentDeck.id === id;
+	},
+
+	_isOpen: function(id) {
+		return this._isParent(id) && $('#' + this._toStrId(id)).length > 0;
+	},
+
 	// Converts an string Id to its raw integer Id.
 	_toIntId: function(id) {
 		if (typeof(id) === 'string')
@@ -24,14 +32,6 @@ L.Control.Sidebar = L.Control.extend({
 		return this.panelIdPrefix + id;
 	},
 
-	_isParent: function(id) {
-		return this._currentDeck != null && this._currentDeck.id === id;
-	},
-
-	_isOpen: function(id) {
-		return this._isParent(id) && $('#' + this._toStrId(id)).length > 0;
-	},
-
 	_isChild: function(id) {
 		return this._currentDeck != null && this._currentDeck.child != null && this._currentDeck.child.id === id;
 	},
commit 1f06050fdb56a106adb743430a9a89d0ce2008b2
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 16:57:45 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: minor cleanup of dialog and sidebar
    
    Change-Id: I59954c7478f6df62082d35b9d17203ab44f51b9a

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 00157e155..f88265f92 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -5,23 +5,11 @@
 
 /* global $ */
 L.Control.Sidebar = L.Control.extend({
-	options: {
-		autoUpdate: true
-	},
-
 	panelIdPrefix: 'sidebarpanel-',
 
 	onAdd: function (map) {
 		map.on('window', this._onWindowMsg, this);
 		map.on('windowpaint', this._onWindowPaint, this);
-		map.on('docloaded', this._docLoaded, this);
-	},
-
-	_docLoaded: function(e) {
-		if (!e.status) {
-			// $('.lokdialog_container').remove();
-			// $('.lokdialogchild-canvas').remove();
-		}
 	},
 
 	// Converts an string Id to its raw integer Id.
@@ -287,7 +275,6 @@ L.Control.Sidebar = L.Control.extend({
 		}
 
 		var panelContainer = L.DomUtil.create('div', 'panel', L.DomUtil.get('sidebar-panel'));
-		// var panelContainer = L.DomUtil.create('div', 'panel', L.DomUtil.get('slide-sorter'));
 		L.DomUtil.setStyle(panelContainer, 'padding', '0px');
 		L.DomUtil.setStyle(panelContainer, 'margin', '0px');
 		L.DomUtil.setStyle(panelContainer, 'position', 'relative');
@@ -498,7 +485,7 @@ L.Control.Sidebar = L.Control.extend({
 
 	_onPanelChildClose: function(parentId) {
 		this._removeChild(parentId);
-		// $('#' + parentId + '-floating').remove();
+
 		// remove any extra height allocated for the parent container
 		var canvasHeight = document.getElementById(parentId + '-canvas').height;
 		$('#' + parentId).height(canvasHeight + 'px');
@@ -510,7 +497,6 @@ L.Control.Sidebar = L.Control.extend({
 		var floatingCanvas = L.DomUtil.get(parentId + '-floating');
 		floatingCanvas.width = 0;
 		floatingCanvas.height = 0;
-		// $('#' + parentId + '-floating').remove();
 	},
 
 	_createChild: function(childId, parentId, top, left) {
commit c361cbd427050233086f0c251055dd174d813942
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 16:31:09 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: high-dpi support for sidebars
    
    Had to comment-out setting the canvas width/height
    via the styles, which is messing up the cursor (in
    normal dpi mode at least).
    Specifically, clicking on an editbox sometimes
    doesn't insert the cursor, depending on which
    control was in focus prior to clicking on said
    editbox.
    
    Reproducible via the Transitions sidebar: click
    on the Variant combobox (Vertical), after it
    opens the list close it and then click on the
    Duration editbox.
    Expected: Cursor blinks where the mouse-click was.
    Actual: No cursor at all nor any sign of focus change
    from the Variant combobox (it remain in focus).
    
    Change-Id: I2879651dfcab5d8d2773b436279c9076572c3d38

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 0ed934dfd..00157e155 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -73,7 +73,10 @@ L.Control.Sidebar = L.Control.extend({
 		if (!y)
 			y = 0;
 
-		this._sendPaintWindow(id, [x, y, width, height].join(','));
+		// pre-multiplied by the scale factor
+		var dpiscale = L.getDpiScaleFactor();
+		var rect = [x * dpiscale, y * dpiscale, width * dpiscale, height * dpiscale].join(',');
+		this._sendPaintWindow(id, rect);
 	},
 
 	_sendPaintWindow: function(id, rectangle) {
@@ -84,7 +87,9 @@ L.Control.Sidebar = L.Control.extend({
 		if (!rectangle)
 			return; // Don't request rendering an empty area.
 
-		this._map._socket.sendMessage('paintwindow ' + id + (rectangle ? ' rectangle=' + rectangle : ''));
+		var dpiscale = L.getDpiScaleFactor();
+		console.log('_sendPaintWindow: rectangle: ' + rectangle + ', dpiscale: ' + dpiscale);
+		this._map._socket.sendMessage('paintwindow ' + id + ' rectangle=' + rectangle + ' dpiscale=' + dpiscale);
 	},
 
 	_isRectangleValid: function(rect) {
@@ -250,6 +255,16 @@ L.Control.Sidebar = L.Control.extend({
 		this._currentDeck.input.focus();
 	},
 
+	_setCanvasWidthHeight: function(canvas, width, height) {
+		// FIXME: Setting the style width/height is messing up the cursor.
+		// L.DomUtil.setStyle(canvas, 'width', width + 'px');
+		// L.DomUtil.setStyle(canvas, 'height', height + 'px');
+
+		var scale = L.getDpiScaleFactor();
+		canvas.width = width * scale;
+		canvas.height = height * scale;
+	},
+
 	_launchSidebar: function(id, left, top, width, height) {
 
 		if (!left)
@@ -283,8 +298,7 @@ L.Control.Sidebar = L.Control.extend({
 		// Create the panel canvas.
 		var panelCanvas = L.DomUtil.create('canvas', 'panel_canvas', panelContainer);
 		L.DomUtil.setStyle(panelCanvas, 'position', 'absolute');
-		panelCanvas.width = width;
-		panelCanvas.height = height;
+		this._setCanvasWidthHeight(panelCanvas, width, height);
 		panelCanvas.id = strId + '-canvas';
 
 		// Create the child canvas now, to make it on top of the main panel canvas.
@@ -294,9 +308,6 @@ L.Control.Sidebar = L.Control.extend({
 		floatingCanvas.height = 0;
 		floatingCanvas.id = strId + '-floating';
 
-
-		L.DomEvent.on(panelCanvas, 'contextmenu', L.DomEvent.preventDefault);
-
 		// Don't show the sidebar until we get the contents.
 		$(panelContainer).parent().hide();
 
@@ -465,10 +476,8 @@ L.Control.Sidebar = L.Control.extend({
 		if (!canvas)
 			return; // no floating window to paint to
 
-		if (width !== canvas.width)
-			canvas.width = width;
-		if (height !== canvas.height)
-			canvas.height = height;
+		this._setCanvasWidthHeight(canvas, width, height);
+
 		var ctx = canvas.getContext('2d');
 		img.onload = function() {
 			ctx.drawImage(img, 0, 0);
commit fc70ae404a37ca2586e1a29efb9c10328f53aebb
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 15:18:45 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: dialogs: don't request rendering empty areas
    
    Change-Id: Iebfd3308e300c8d2ce3e9e86210c48f039769092

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 1521d3b33..0ed934dfd 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -62,21 +62,27 @@ L.Control.Sidebar = L.Control.extend({
 	_sendPaintWindowRect: function(id, x, y, width, height) {
 		if (!width)
 			width = this._currentDeck.width;
+		if (width <= 0)
+			return;	// Don't request rendering an empty area.
 		if (!height)
 			height = this._currentDeck.height;
+		if (height <= 0)
+			return;	// Don't request rendering an empty area.
 		if (!x)
 			x = 0;
 		if (!y)
 			y = 0;
 
-		// Don't request empty area rendering.
-		if (width > 0 && height > 0)
-			this._sendPaintWindow(id, [x, y, width, height].join(','));
+		this._sendPaintWindow(id, [x, y, width, height].join(','));
 	},
 
 	_sendPaintWindow: function(id, rectangle) {
-		if (rectangle)
-			rectangle = rectangle.replace(/ /g, '');
+		if (!rectangle)
+			return; // Don't request rendering an empty area.
+
+		rectangle = rectangle.replace(/ /g, '');
+		if (!rectangle)
+			return; // Don't request rendering an empty area.
 
 		this._map._socket.sendMessage('paintwindow ' + id + (rectangle ? ' rectangle=' + rectangle : ''));
 	},
commit 154b7ba2be01e6211f2f35b18ba7a5a6540028ab
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 15:20:53 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: rearangle sidebar functions to minimize diff with dialogs
    
    Change-Id: I7e786458f01ce3f7a243d0214b23de7680d460da

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index 10a90cd58..1521d3b33 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -59,13 +59,6 @@ L.Control.Sidebar = L.Control.extend({
 		return null;
 	},
 
-	_sendPaintWindow: function(id, rectangle) {
-		if (rectangle)
-			rectangle = rectangle.replace(/ /g, '');
-
-		this._map._socket.sendMessage('paintwindow ' + id + (rectangle ? ' rectangle=' + rectangle : ''));
-	},
-
 	_sendPaintWindowRect: function(id, x, y, width, height) {
 		if (!width)
 			width = this._currentDeck.width;
@@ -81,6 +74,13 @@ L.Control.Sidebar = L.Control.extend({
 			this._sendPaintWindow(id, [x, y, width, height].join(','));
 	},
 
+	_sendPaintWindow: function(id, rectangle) {
+		if (rectangle)
+			rectangle = rectangle.replace(/ /g, '');
+
+		this._map._socket.sendMessage('paintwindow ' + id + (rectangle ? ' rectangle=' + rectangle : ''));
+	},
+
 	_isRectangleValid: function(rect) {
 		rect = rect.split(',');
 		return (parseInt(rect[0]) >= 0 && parseInt(rect[1]) >= 0 &&
commit 83ef6ed3516a1891671613b2b8a410286c566c77
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 15:06:07 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: sidebar sendPaintWindowStr -> sendPaintWindow
    
    Change-Id: Ieb2fda911ae36cec8f1f50e7ce46607202bb3250

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index b3e6a7e36..10a90cd58 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -59,7 +59,7 @@ L.Control.Sidebar = L.Control.extend({
 		return null;
 	},
 
-	_sendPaintWindowStr: function(id, rectangle) {
+	_sendPaintWindow: function(id, rectangle) {
 		if (rectangle)
 			rectangle = rectangle.replace(/ /g, '');
 
@@ -78,7 +78,7 @@ L.Control.Sidebar = L.Control.extend({
 
 		// Don't request empty area rendering.
 		if (width > 0 && height > 0)
-			this._sendPaintWindowStr(id, [x, y, width, height].join(','));
+			this._sendPaintWindow(id, [x, y, width, height].join(','));
 	},
 
 	_isRectangleValid: function(rect) {
@@ -144,12 +144,12 @@ L.Control.Sidebar = L.Control.extend({
 				else
 					rectangle = '0,0,' + this._currentDeck.width + ',' + this._currentDeck.height;
 
-				this._sendPaintWindowStr(e.id, rectangle);
+				this._sendPaintWindow(e.id, rectangle);
 			}
 			else if (this._isChild(e.id))
 			{
 				// Child windows are given relative coordinates.
-				this._sendPaintWindowStr(e.id, rectangle);
+				this._sendPaintWindow(e.id, rectangle);
 			}
 			else
 			{
commit 988c1db558bd80960b6a6be7b7bb0d6541769af7
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 15:05:50 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: sidebar sendPaintWindow -> sendPaintWindowRect
    
    Change-Id: I5a751b6aa5e290d5f1292c70e52bef954f99ff57

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index aa2d23022..b3e6a7e36 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -66,7 +66,7 @@ L.Control.Sidebar = L.Control.extend({
 		this._map._socket.sendMessage('paintwindow ' + id + (rectangle ? ' rectangle=' + rectangle : ''));
 	},
 
-	_sendPaintWindow: function(id, x, y, width, height) {
+	_sendPaintWindowRect: function(id, x, y, width, height) {
 		if (!width)
 			width = this._currentDeck.width;
 		if (!height)
@@ -123,7 +123,7 @@ L.Control.Sidebar = L.Control.extend({
 				};
 
 				this._createChild(e.id, parentId, top, left);
-				this._sendPaintWindow(e.id, 0, 0, width, height);
+				this._sendPaintWindowRect(e.id, 0, 0, width, height);
 			}
 			else {
 				// We only handle sidebar panels here (see Control.LokDialog.js)
@@ -157,7 +157,7 @@ L.Control.Sidebar = L.Control.extend({
 				rectangle = rectangle.split(',');
 				rectangle[0] = parseInt(rectangle[0]) - this._currentDeck.left;
 				rectangle[1] = parseInt(rectangle[1]) - this._currentDeck.top;
-				this._sendPaintWindow(e.id, rectangle[0], rectangle[1], rectangle[2], rectangle[3]);
+				this._sendPaintWindowRect(e.id, rectangle[0], rectangle[1], rectangle[2], rectangle[3]);
 			}
 		} else if (e.action === 'size_changed') {
 			width = parseInt(e.size.split(',')[0]);
@@ -261,7 +261,7 @@ L.Control.Sidebar = L.Control.extend({
 			}
 
 			// Render window.
-			this._sendPaintWindow(id);
+			this._sendPaintWindowRect(id);
 			return;
 		}
 
@@ -371,7 +371,7 @@ L.Control.Sidebar = L.Control.extend({
 		});
 
 		// Render window.
-		this._sendPaintWindow(id);
+		this._sendPaintWindowRect(id);
 	},
 
 	_postWindowCompositionEvent: function(winid, type, text) {
commit 00af87849c497030d01480cdc5ec703281fbed71
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 17 12:20:03 2018 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 13:54:13 2019 +0200

    leaflet: dialog and sidebar strDlgId -> strId
    
    Change-Id: Iae1cb02da3162225b7670c1102d45cc7afcc3119

diff --git a/loleaflet/src/control/Control.Sidebar.js b/loleaflet/src/control/Control.Sidebar.js
index da5e9a84b..aa2d23022 100644
--- a/loleaflet/src/control/Control.Sidebar.js
+++ b/loleaflet/src/control/Control.Sidebar.js
@@ -193,8 +193,8 @@ L.Control.Sidebar = L.Control.extend({
 	},
 
 	_updateDialogCursor: function(dlgId, x, y, height) {
-		var strDlgId = this._toStrId(dlgId);
-		var dialogCursor = L.DomUtil.get(strDlgId + '-cursor');
+		var strId = this._toStrId(dlgId);
+		var dialogCursor = L.DomUtil.get(strId + '-cursor');
 		L.DomUtil.setStyle(dialogCursor, 'height', height + 'px');

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list