loleaflet: activate upon reconnection, reconnect upon activation
Change-Id: I047b4e25a90dab25f92920f2cba272051e08c90c Reviewed-on: https://gerrit.libreoffice.org/24354 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
8f7ddbc495
commit
80429c6c1d
2 changed files with 36 additions and 5 deletions
|
@ -96,6 +96,8 @@ L.Socket = L.Class.extend({
|
|||
this._doSend(this._msgQueue[i].msg, this._msgQueue[i].coords);
|
||||
}
|
||||
this._msgQueue = [];
|
||||
|
||||
this._map._activate();
|
||||
},
|
||||
|
||||
_onMessage: function (e) {
|
||||
|
|
|
@ -64,6 +64,8 @@ L.Map = L.Evented.extend({
|
|||
this._bDisableKeyboard = false;
|
||||
this._active = true;
|
||||
|
||||
vex.dialog_id = -1;
|
||||
|
||||
this.callInitHooks();
|
||||
|
||||
if (this.options.imagePath) {
|
||||
|
@ -690,17 +692,44 @@ L.Map = L.Evented.extend({
|
|||
|
||||
_activate: function () {
|
||||
clearTimeout(vex.timer);
|
||||
this._socket.sendMessage('useractive');
|
||||
this._docLayer._onMessage('invalidatetiles: part=0 x=0 y=0 width=2147483647 height=2147483647', null);
|
||||
|
||||
return vex.close(vex.globalID - 1);
|
||||
if (!this._active) {
|
||||
this._socket.sendMessage('useractive');
|
||||
|
||||
// Only activate when we are connected.
|
||||
if (this._socket.connected()) {
|
||||
this._docLayer._onMessage('invalidatetiles: part=0 x=0 y=0 width=2147483647 height=2147483647', null);
|
||||
this._active = true;
|
||||
|
||||
if (vex.dialog_id > 0) {
|
||||
id = vex.dialog_id;
|
||||
vex.dialog_id = -1;
|
||||
return vex.close(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_deactivate: function () {
|
||||
clearTimeout(vex.timer);
|
||||
|
||||
if (!this._active || vex.dialog_id > 0) {
|
||||
// A dialog is already dimming the screen and probably
|
||||
// shows an error message. Leave it alone.
|
||||
this._active = false;
|
||||
this._docLayer._onMessage('textselection:', null);
|
||||
if (this._socket.connected()) {
|
||||
this._socket.sendMessage('userinactive');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var map = this;
|
||||
vex.timer = setTimeout(function() {
|
||||
L.Log.log("Deactivating");
|
||||
this._active = false;
|
||||
map._active = false;
|
||||
clearTimeout(vex.timer);
|
||||
|
||||
options = $.extend({}, vex.defaultOptions, {contentCSS: {"background":"rgba(0, 0, 0, 0)"}});
|
||||
|
|
Loading…
Reference in a new issue