1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 09:37:58 +01:00

[bootstrap] Fix highlighting the statusline and visual bell after rehash.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-28 15:19:07 -05:00
parent aec00dd4be
commit 53f9181b09
4 changed files with 29 additions and 20 deletions

View File

@@ -192,21 +192,30 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
*/ */
beep: function () { beep: function () {
if (options["visualbell"]) { if (options["visualbell"]) {
let bell = document.getElementById("dactyl-bell"); let elems = {
let strut = document.getElementById("dactyl-bell-strut"); bell: document.getElementById("dactyl-bell"),
if (!bell) { strut: document.getElementById("dactyl-bell-strut")
bell = document.documentElement.insertBefore(
util.xmlToDom(<hbox xmlns={XUL} style="display: none" highlight="Bell" id="dactyl-bell"/>, document),
document.documentElement.firstChild);
strut = document.documentElement.appendChild(
util.xmlToDom(<hbox xmlns={XUL} style="display: none" highlight="Bell" id="dactyl-bell-strut"/>, document));
} }
if (!elems.bell)
util.overlayWindow(window, {
objects: elems,
prepend: <>
<window id={document.documentElement.id} xmlns={XUL}>
<hbox style="display: none" highlight="Bell" id="dactyl-bell" key="bell"/>
</window>
</>,
append: <>
<window id={document.documentElement.id} xmlns={XUL}>
<hbox style="display: none" highlight="Bell" id="dactyl-bell-strut" key="strut"/>
</window>
</>
}, elems);
bell.style.height = window.innerHeight + "px"; elems.bell.style.height = window.innerHeight + "px";
strut.style.marginBottom = -window.innerHeight + "px"; elems.strut.style.marginBottom = -window.innerHeight + "px";
strut.style.display = bell.style.display = ""; elems.strut.style.display = elems.bell.style.display = "";
util.timeout(function () { strut.style.display = bell.style.display = "none"; }, 20); util.timeout(function () { elems.strut.style.display = elems.bell.style.display = "none"; }, 20);
} }
else { else {
let soundService = Cc["@mozilla.org/sound;1"].getService(Ci.nsISound); let soundService = Cc["@mozilla.org/sound;1"].getService(Ci.nsISound);

View File

@@ -82,7 +82,7 @@ var Option = Class("Option", {
get isDefault() this.stringValue === this.stringDefaultValue, get isDefault() this.stringValue === this.stringDefaultValue,
/** @property {value} The option's global value. @see #scope */ /** @property {value} The option's global value. @see #scope */
get globalValue() options.store.get(this.name, {}).value, get globalValue() { try { return options.store.get(this.name, {}).value } catch (e) { util.reportError(e); throw e; } },
set globalValue(val) { options.store.set(this.name, { value: val, time: Date.now() }); }, set globalValue(val) { options.store.set(this.name, { value: val, time: Date.now() }); },
/** /**

View File

@@ -26,7 +26,7 @@ var StatusLine = Module("statusline", {
let _commandline = "if (window.dactyl) return dactyl.modules.commandline"; let _commandline = "if (window.dactyl) return dactyl.modules.commandline";
let prepend = <e4x xmlns={XUL} xmlns:dactyl={NS}> let prepend = <e4x xmlns={XUL} xmlns:dactyl={NS}>
<statusbar id="status-bar" highlight="StatusLine StatusNormal"> <statusbar id="status-bar" highlight="StatusLine StatusLineNormal">
<!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" --> <!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" -->
<hbox style="background: inherit;" key="container" flex="1" hidden="false" align="center"> <hbox style="background: inherit;" key="container" flex="1" hidden="false" align="center">
<stack orient="horizontal" align="stretch" flex="1" class="dactyl-container" highlight="CmdLine StatusCmdLine"> <stack orient="horizontal" align="stretch" flex="1" class="dactyl-container" highlight="CmdLine StatusCmdLine">

View File

@@ -996,7 +996,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
doc.dactylOverlayElements.push(n); doc.dactylOverlayElements.push(n);
fn(elem, node); fn(elem, node);
for each (let attr in attr || []) // FIXME: Cleanup... for each (let attr in attr || []) // FIXME: Cleanup...
elem.setAttributeNS(attr.namespace(), attr.localName(), attr); if (attr.name() != "highlight")
elem.setAttributeNS(attr.namespace(), attr.localName(), String(attr));
else
highlight.highlightNode(elem, String(attr));
} }
} }
} }
@@ -1461,11 +1464,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
for each (let attr in node.@*::*) for each (let attr in node.@*::*)
if (attr.name() != "highlight") if (attr.name() != "highlight")
domnode.setAttributeNS(attr.namespace(), attr.localName(), String(attr)); domnode.setAttributeNS(attr.namespace(), attr.localName(), String(attr));
else { else
domnode.setAttributeNS(NS.uri, "highlight", String(attr)); highlight.highlightNode(domnode, String(attr));
for each (let h in String.split(attr, " "))
highlight.loaded[h] = true;
}
for each (let child in node.*::*) for each (let child in node.*::*)
domnode.appendChild(xmlToDom(child, doc, nodes)); domnode.appendChild(xmlToDom(child, doc, nodes));