From a6b5717b8e31ff939c69d16918b75a8aa2b2910b Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 31 Jan 2012 23:11:40 -0500 Subject: [PATCH] Fix Linux focus bugs entirely and also (hopefully) fix the white bar issue --- .../content/zotero/integration/quickFormat.js | 30 +++++++++++-------- .../zotero/integration/quickFormat.xul | 3 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index b72fbd480..305a7074f 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -97,6 +97,12 @@ var Zotero_QuickFormat = new function () { panelLocatorLabel = document.getElementById("locator-label"); panelLocator = document.getElementById("locator"); panelInfo = document.getElementById("citation-properties-info"); + + + // Don't need to set noautohide dynamically on these platforms, so do it now + if(Zotero.isMac || Zotero.isWin) { + tabPanel.setAttribute("noautohide", true); + } } else if(event.target === qfi.contentDocument) { qfiWindow = qfi.contentWindow; qfiDocument = qfi.contentDocument; @@ -769,21 +775,21 @@ var Zotero_QuickFormat = new function () { * Opens the reference panel and potentially refocuses the main text box */ function _openReferencePanel() { + if(!Zotero.isMac && !Zotero.isWin) { + // noautohide and noautofocus are incompatible on Linux + // https://bugzilla.mozilla.org/show_bug.cgi?id=545265 + referencePanel.setAttribute("noautohide", "false"); + } + referencePanel.openPopup(document.documentElement, "after_start", 15, null, false, false, null); + if(!Zotero.isMac && !Zotero.isWin) { - // When the reference panel opens, we may lose focus on Linux. We thus look for a - // deactivate event within 1 second of the panel open request. - var eventHandler = function(e) { - if(e.target !== window) return; - window.removeEventListener("deactivate", eventHandler, false); - window.clearTimeout(timeoutID); - window.setTimeout(function() { _refocusQfe(); }, 0); - }; - window.addEventListener("deactivate", eventHandler, false); - var timeoutID = window.setTimeout(function() { - window.removeEventListener("deactivate", eventHandler, false); - }, 1000); + // reinstate noautohide after the window is shown + referencePanel.addEventListener("popupshowing", function() { + referencePanel.removeEventListener("popupshowing", arguments.callee, false); + referencePanel.setAttribute("noautohide", "true"); + }, false); } } diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul index fd96cd2eb..859a15959 100644 --- a/chrome/content/zotero/integration/quickFormat.xul +++ b/chrome/content/zotero/integration/quickFormat.xul @@ -67,7 +67,8 @@ - +