Only pass INJECTED keys through, if we are already active. This way, another
plugin can trigger us by injecting a SYSTER key.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Move the hooks inside the `MouseKeys_` object, and drop the
`handle_mouse_key_event` function, by inlining it into the event handler hook.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of calculating separate acceleration for the x and y axes, use only a
single one, that applies to both axes. Thus, holding mouse up, and then pressing
and holding right will move the mouse cursor in a straight diagonal line,
instead of a curve.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of acting on mouse movement keys immediately in the event handler hook,
just store them, and act on them during a loop hook. This has the effect of
collecting all movement intents noticed in a full scan, and acting on them in
one go, rather than acting individually.
This makes diagonal movement (up & right keys pressed at the same time) a lot
smoother, at the cost of a few ms of delay. The delay is not noticeable, and the
smoothing would be a good trade anyway. No more jerky diagonal movements!
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Bail out if the key did NOT toggle on, instead of bailing out only if it did.
This addresses the key count computation part of #1. (Shifting looks fine, after
this change)
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
`TOGGLENUMLOCK` is the index of the macro, to be used in the `macroAction`
function, and `Key_ToggleNumlock` is to be used in the keymap, instead of
`M(0)`. This is considerably friendlier than before.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
To make the signature of `macroAction` simple, the `row` and `col` properties
are not passed in every time anymore, but they are available as `Macros.row` and
`Macros.col`, respectively.
This keeps the function simple, but still allows access to these properties for
the rarer case of needing them.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of just switching to a layer, make it a macro. The macro will toggle the
layer and the LED effect.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This way the end-user does not have to explicitly call
`Keyboardio.use(&LEDControl)`, it is enough to use a LED effect.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
All of the plugins have been updated, there is no need to keep the deprecated
functions around anymore.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>