This commit is contained in:
2026-01-21 09:05:02 -06:00
parent 18ca9e14ba
commit f7be9c3344
30 changed files with 237 additions and 246 deletions

View File

@@ -40,7 +40,7 @@ function gesture_stage(config) {
// Only process gamepad touchpad events
if (ev.control != 'gamepad_touchpad') {
output.push(ev)
push(output, ev)
continue
}
@@ -72,7 +72,7 @@ function gesture_stage(config) {
var d = currentDist - start_dist
if (Math.abs(d) >= pinch_th / 100) {
output.push({
push(output, {
kind: 'gesture',
device_id: ev.device_id,
control: d > 0 ? 'pinch_out' : 'pinch_in',
@@ -103,7 +103,7 @@ function gesture_stage(config) {
? (dx > 0 ? 'swipe_right' : 'swipe_left')
: (dy > 0 ? 'swipe_down' : 'swipe_up')
output.push({
push(output, {
kind: 'gesture',
device_id: ev.device_id,
control: dir,
@@ -139,18 +139,18 @@ function emacs_stage() {
// Only process keyboard button events
if (ev.device_id != 'kbm' || ev.kind != 'button' || !ev.pressed) {
output.push(ev)
push(output, ev)
continue
}
if (find(valid_emacs_keys, ev.control) == null) {
output.push(ev)
push(output, ev)
continue
}
// Only process if we have modifiers OR waiting for chord
if (!ev.mods?.ctrl && !ev.mods?.alt && !prefix) {
output.push(ev)
push(output, ev)
continue
}
@@ -174,7 +174,7 @@ function emacs_stage() {
if (prefix) {
var chord = prefix + " " + notation
prefix = null
output.push({
push(output, {
kind: 'chord',
device_id: ev.device_id,
control: chord,
@@ -183,7 +183,7 @@ function emacs_stage() {
time: ev.time
})
} else {
output.push({
push(output, {
kind: 'chord',
device_id: ev.device_id,
control: notation,
@@ -213,14 +213,14 @@ function action_stage(bindings) {
// Pass through non-button events
if (ev.kind != 'button' && ev.kind != 'chord' && ev.kind != 'gesture') {
output.push(ev)
push(output, ev)
continue
}
var actions = bindings.get_actions(ev.control)
if (length(actions) == 0) {
output.push(ev)
push(output, ev)
continue
}
@@ -230,7 +230,7 @@ function action_stage(bindings) {
if (ev.pressed) down[action] = true
else if (ev.released) down[action] = false
output.push({
push(output, {
kind: 'action',
device_id: ev.device_id,
control: action,
@@ -277,16 +277,16 @@ function make(user, config) {
var action = null
if (config.gestures != false) {
stages.push(gesture_stage(config))
push(stages, gesture_stage(config))
}
if (config.emacs != false) {
stages.push(emacs_stage())
push(stages, emacs_stage())
}
action = action_stage(user.bindings)
stages.push(action)
stages.push(delivery_stage(user))
push(stages, action)
push(stages, delivery_stage(user))
return {
stages: stages,