Movement support in quadtap-both-click.cfg

This commit is contained in:
Vftdan 2024-08-19 11:03:42 +02:00
parent 12af4b35c7
commit f19732d364
1 changed files with 128 additions and 1 deletions

View File

@ -30,6 +30,28 @@ predicates = {
} }
); );
}; };
abs_event = {
type = "and";
args = (
"is_evdev",
{
type = "code_major";
min = "event_type.ABS";
max = "event_type.ABS";
}
);
};
misc_event = {
type = "and";
args = (
"is_evdev",
{
type = "code_major";
min = "event_type.MSC";
max = "event_type.MSC";
}
);
};
btn_quadtap_event = { btn_quadtap_event = {
type = "and"; type = "and";
args = ( args = (
@ -41,6 +63,57 @@ predicates = {
} }
); );
}; };
misc_timestamp = {
type = "and";
args = (
"misc_event",
{
type = "code_minor";
min = "misc_event.TIMESTAMP";
max = "misc_event.TIMESTAMP";
}
);
};
abs_x = {
type = "and";
args = (
"abs_event",
{
type = "code_minor";
min = "absolute_axis.X";
max = "absolute_axis.X";
}
);
};
abs_y = {
type = "and";
args = (
"abs_event",
{
type = "code_minor";
min = "absolute_axis.Y";
max = "absolute_axis.Y";
}
);
};
quadtap_held = {
type = "accept";
inverted = 1;
};
bypass = {
type = "or";
args = ["syn_event", "misc_timestamp"];
};
payload_zero = {
type = "payload";
min = 0;
max = 0;
};
payload_one = {
type = "payload";
min = 1;
max = 1;
};
}; };
nodes = { nodes = {
@ -54,7 +127,7 @@ nodes = {
select_interesting_events = { select_interesting_events = {
type = "router"; type = "router";
options = { options = {
predicates = ["syn_event", "btn_quadtap_event"]; predicates = ["bypass", "btn_quadtap_event", "abs_x", "abs_y"];
}; };
}; };
quadtap_subst_seq = { quadtap_subst_seq = {
@ -85,10 +158,43 @@ nodes = {
{major: "event_type.KEY"; minor: "button_event.RIGHT"} {major: "event_type.KEY"; minor: "button_event.RIGHT"}
, ,
{major: "event_type.KEY"; minor: "button_event.MIDDLE"} {major: "event_type.KEY"; minor: "button_event.MIDDLE"}
,
{major: "event_type.REL"; minor: "relative_axis.X"}
,
{major: "event_type.REL"; minor: "relative_axis.Y"}
,
{major: "event_type.MSC"; minor: "misc_event.TIMESTAMP"}
); );
properties = ["input_property.POINTER", "input_property.BUTTONPAD"]; properties = ["input_property.POINTER", "input_property.BUTTONPAD"];
}; };
}; };
update_quadtap_held = {
type = "modify_predicate";
options = {
target = "quadtap_held";
uninvert_on = "payload_one";
invert_on = "payload_zero";
};
};
differentiate_x = {
type = "differentiate";
};
differentiate_y = {
type = "differentiate";
};
morph_rel = {
type = "assign";
options = {
major = "event_type.REL";
// Preserve minor, because relative_axis.X = absolute_axis.X, relative_axis.Y = absolute_axis.Y
};
};
while_quadtap_held = {
type = "router";
options = {
predicates = ["quadtap_held"];
};
};
}; };
channels = ({ channels = ({
@ -112,9 +218,30 @@ channels = ({
}, { }, {
from: ("morph_right_click", 0); from: ("morph_right_click", 0);
to: ("merge", 2); to: ("merge", 2);
}, {
from: ("select_interesting_events", 2); // ABS_X
to: ("differentiate_x", 0);
}, {
from: ("select_interesting_events", 3); // ABS_Y
to: ("differentiate_y", 0);
}, {
from: ("differentiate_x", 0);
to: ("while_quadtap_held", 0);
}, {
from: ("differentiate_y", 0);
to: ("while_quadtap_held", 1);
}, {
from: ("while_quadtap_held", 0);
to: ("morph_rel", 0);
}, {
from: ("morph_rel", 0);
to: ("merge", 3);
}, { }, {
from: ("merge", 0); from: ("merge", 0);
to: ("virtual_out", 0); to: ("virtual_out", 0);
}, {
from: ("quadtap_subst_seq", 4);
to: ("update_quadtap_held", 0);
}); });
// vim: ft=libconfig // vim: ft=libconfig