A slightly less sketchy reactivate hack
This commit is contained in:
parent
e10c3e2e72
commit
9d20e2a827
1 changed files with 12 additions and 12 deletions
|
@ -772,18 +772,18 @@ var Zotero_QuickFormat = new function () {
|
||||||
referencePanel.openPopup(document.documentElement, "after_start", 15,
|
referencePanel.openPopup(document.documentElement, "after_start", 15,
|
||||||
null, false, false, null);
|
null, false, false, null);
|
||||||
if(!Zotero.isMac && !Zotero.isWin) {
|
if(!Zotero.isMac && !Zotero.isWin) {
|
||||||
// When it opens, we will lose focus
|
// When the reference panel opens, we may lose focus on Linux. We thus look for a
|
||||||
referencePanel.addEventListener("popupshown", function() {
|
// deactivate event within 1 second of the panel open request.
|
||||||
referencePanel.removeEventListener("popupshown", arguments.callee, false);
|
var eventHandler = function(e) {
|
||||||
_refocusQfe();
|
if(e.target !== window) return;
|
||||||
|
window.removeEventListener("deactivate", eventHandler, false);
|
||||||
// This is a nasty hack, but seems to be necessary to fix loss of focus on Linux
|
window.clearTimeout(timeoutID);
|
||||||
window.setTimeout(function() { _refocusQfe(); }, 25);
|
window.setTimeout(function() { _refocusQfe(); }, 0);
|
||||||
window.setTimeout(function() { _refocusQfe(); }, 50);
|
};
|
||||||
window.setTimeout(function() { _refocusQfe(); }, 100);
|
window.addEventListener("deactivate", eventHandler, false);
|
||||||
window.setTimeout(function() { _refocusQfe(); }, 175);
|
var timeoutID = window.setTimeout(function() {
|
||||||
window.setTimeout(function() { _refocusQfe(); }, 250);
|
window.removeEventListener("deactivate", eventHandler, false);
|
||||||
}, false);
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue