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