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

Fix strictfocus edgecase when the content window is editable.

--HG--
branch : key-processing
This commit is contained in:
Kris Maglione
2011-01-26 19:53:46 -05:00
parent f4cc496dbe
commit 8c0d070d94
3 changed files with 19 additions and 19 deletions

View File

@@ -551,7 +551,7 @@ var Buffer = Module("buffer", {
* @returns {boolean}
*/
focusAllowed: function (elem) {
if (elem instanceof Window && !Editor.getEditor(window))
if (elem instanceof Window && !Editor.getEditor(elem))
return true;
let doc = elem.ownerDocument || elem.document || elem;
return !options["strictfocus"] || doc.dactylFocusAllowed;

View File

@@ -482,6 +482,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let win = document.commandDispatcher.focusedWindow;
let elem = config.mainWidget || content;
// TODO: make more generic
try {
if (this.has("mail") && !config.isComposeWindow) {

View File

@@ -960,15 +960,13 @@ var Events = Module("events", {
// the main window does not restore focus and we lose key
// input.
services.focus.clearFocus(window);
document.commandDispatcher.focusedWindow = content;
document.commandDispatcher.focusedWindow = Editor.getEditor(content) ? window : content;
}
},
// TODO: Merge with onFocusChange
focus: function onFocus(event) {
let elem = event.originalTarget;
if (elem instanceof Element) {
let win = elem.ownerDocument.defaultView;
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
for (let e = elem; e instanceof Element; e = e.parentNode)
@@ -978,14 +976,15 @@ var Events = Module("events", {
break;
}
let win = (elem.ownerDocument || elem).defaultView || elem;
if (events.isContentNode(elem) && !buffer.focusAllowed(elem)
&& !(services.focus.getLastFocusMethod(win) & 0x7000)
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
if (elem.frameElement)
dactyl.focusContent(true);
else if (!(elem instanceof Window) || Editor.getEditor(elem))
elem.blur();
}
dactyl.focus(window);
}
},