mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 11:47:58 +01:00
Skip setting elem.dactylKeyPress in passthrough-type modes. Closes issue #341.
This commit is contained in:
@@ -39,6 +39,7 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
|
||||
execute: function execute(result, force) {
|
||||
function dbg() {}
|
||||
let dbg = util.closure.dump;
|
||||
|
||||
if (force && this.actions.length)
|
||||
this.processors.length = 0;
|
||||
@@ -79,7 +80,7 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
Events.kill(this.events[this.events.length - 1]);
|
||||
|
||||
if (result === Events.PASS || result === Events.ABORT) {
|
||||
dbg("REREED: " + this.events.filter(function (e) e.getPreventDefault()).map(events.closure.toString).join(""));
|
||||
dbg("REFEED: " + this.events.filter(function (e) e.getPreventDefault()).map(events.closure.toString).join(""));
|
||||
this.events.filter(function (e) e.getPreventDefault())
|
||||
.forEach(function (event, i) {
|
||||
let elem = event.originalTarget;
|
||||
@@ -101,6 +102,7 @@ var ProcessorStack = Class("ProcessorStack", {
|
||||
|
||||
process: function process(event) {
|
||||
function dbg() {}
|
||||
let dbg = util.closure.dump;
|
||||
|
||||
if (this.timer)
|
||||
this.timer.cancel();
|
||||
@@ -963,6 +965,7 @@ var Events = Module("events", {
|
||||
},
|
||||
|
||||
blur: function onBlur(event) {
|
||||
let elem = event.originalTarget;
|
||||
if (event.originalTarget instanceof Window && services.focus.activeWindow == null) {
|
||||
// Deals with circumstances where, after the main window
|
||||
// blurs while a collapsed frame has focus, re-activating
|
||||
@@ -1032,18 +1035,6 @@ var Events = Module("events", {
|
||||
keypress: function onKeyPress(event) {
|
||||
event.dactylDefaultPrevented = event.getPreventDefault();
|
||||
|
||||
// Hack to deal with <BS> and so forth not dispatching input
|
||||
// events
|
||||
if (event.originalTarget instanceof HTMLInputElement) {
|
||||
let elem = event.originalTarget;
|
||||
elem.dactylKeyPress = elem.value;
|
||||
util.timeout(function () {
|
||||
if (elem.dactylKeyPress !== undefined && elem.value !== elem.dactylKeyPress)
|
||||
events.dispatch(elem, events.create(elem.ownerDocument, "input"));
|
||||
delete events.dactylKeyPress;
|
||||
});
|
||||
}
|
||||
|
||||
let duringFeed = this.duringFeed || [];
|
||||
this.duringFeed = [];
|
||||
try {
|
||||
@@ -1054,6 +1045,19 @@ var Events = Module("events", {
|
||||
this.feedingEvent = null;
|
||||
|
||||
let key = events.toString(event);
|
||||
|
||||
// Hack to deal with <BS> and so forth not dispatching input
|
||||
// events
|
||||
if (event.originalTarget instanceof HTMLInputElement && !modes.main.passthrough) {
|
||||
let elem = event.originalTarget;
|
||||
elem.dactylKeyPress = elem.value;
|
||||
util.timeout(function () {
|
||||
if (elem.dactylKeyPress !== undefined && elem.value !== elem.dactylKeyPress)
|
||||
events.dispatch(elem, events.create(elem.ownerDocument, "input"));
|
||||
elem.dactylKeyPress = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
if (!key)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -123,18 +123,21 @@ var Modes = Module("modes", {
|
||||
this.addMode("EMBED", {
|
||||
input: true,
|
||||
description: "Active when an <embed> or <object> element is focused",
|
||||
ownsFocus: true
|
||||
ownsFocus: true,
|
||||
passthrough: true
|
||||
});
|
||||
|
||||
this.addMode("PASS_THROUGH", {
|
||||
description: "All keys but <C-v> are ignored by " + config.appName,
|
||||
bases: [this.BASE],
|
||||
hidden: true
|
||||
hidden: true,
|
||||
passthrough: true
|
||||
});
|
||||
this.addMode("QUOTE", {
|
||||
hidden: true,
|
||||
description: "The next key sequence is ignored by " + config.appName + ", unless in Pass Through mode",
|
||||
bases: [this.BASE],
|
||||
hidden: true,
|
||||
passthrough: true,
|
||||
display: function () modes.getStack(1).main == modes.PASS_THROUGH
|
||||
? (modes.getStack(2).main.display() || modes.getStack(2).main.name) + " (next)"
|
||||
: "PASS THROUGH (next)"
|
||||
@@ -146,12 +149,14 @@ var Modes = Module("modes", {
|
||||
});
|
||||
this.addMode("IGNORE", { hidden: true }, {
|
||||
onKeyPress: function (event) Events.KILL,
|
||||
bases: []
|
||||
bases: [],
|
||||
passthrough: true
|
||||
});
|
||||
|
||||
this.addMode("MENU", {
|
||||
description: "Active when a menu or other pop-up is open",
|
||||
input: true
|
||||
input: true,
|
||||
passthrough: true
|
||||
});
|
||||
|
||||
this.addMode("LINE", {
|
||||
|
||||
Reference in New Issue
Block a user