-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: pointer movement/scrolling #2027
Open
petejohanson
wants to merge
14
commits into
zmkfirmware:main
Choose a base branch
from
petejohanson:feat/pointers-move-scroll
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
94c17d6
feat(mouse): Add mouse move and scroll support [WIP]
caksoylar 04022d2
feat(mouse): Split move/scroll & x/y acceleration
caksoylar c26b481
fix(mouse): Bump up default mouse tick duration to prevent crashes
caksoylar e38fd78
refactor: Use input system for pointer events.
petejohanson b2f6163
feat(mouse): Add input configs for data mods.
petejohanson 4e53004
refactor(mouse): Remove mouse work queue, Kconfig
petejohanson 77acca1
fix(mouse): Fixes for logging.
petejohanson 5513584
refactor: Proper per-device input listeners.
petejohanson f8fa8aa
chore: Minor input behavior clean-up.
petejohanson dad5926
fix: Testing fixes for listener refactor.
petejohanson 0c3536c
refactor(mouse): Tweak behavior inclusion, listener code
petejohanson 37ba9eb
fix(mouse): Fix up tests and make ZMK_MOUSE explicit.
petejohanson d45cb3c
feat(mouse): Updated mouse keys docs.
petejohanson bc75de5
fix: Various fixes for building.
petejohanson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright (c) 2024 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include "mouse_key_press.dtsi" | ||
#include "mouse_move.dtsi" | ||
#include "mouse_scroll.dtsi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2024 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
|
||
/ { | ||
behaviors { | ||
/omit-if-no-ref/ mmv: mouse_move { | ||
compatible = "zmk,behavior-input-two-axis"; | ||
#binding-cells = <1>; | ||
x-input-code = <INPUT_REL_X>; | ||
y-input-code = <INPUT_REL_Y>; | ||
time-to-max-speed-ms = <300>; | ||
acceleration-exponent = <1>; | ||
}; | ||
}; | ||
|
||
mmv_input_listener: mmv_input_listener { | ||
compatible = "zmk,input-listener"; | ||
device = <&mmv>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
/* | ||
* Copyright (c) 2024 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
|
||
/ { | ||
behaviors { | ||
/omit-if-no-ref/ msc: mouse_scroll { | ||
compatible = "zmk,behavior-input-two-axis"; | ||
#binding-cells = <1>; | ||
x-input-code = <INPUT_REL_HWHEEL>; | ||
y-input-code = <INPUT_REL_WHEEL>; | ||
time-to-max-speed-ms = <300>; | ||
acceleration-exponent = <0>; | ||
}; | ||
}; | ||
|
||
msc_input_listener: msc_input_listener { | ||
compatible = "zmk,input-listener"; | ||
device = <&msc>; | ||
}; | ||
}; |
25 changes: 25 additions & 0 deletions
25
app/dts/bindings/behaviors/zmk,behavior-input-two-axis.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
description: Two axis input behavior | ||
|
||
compatible: "zmk,behavior-input-two-axis" | ||
|
||
include: one_param.yaml | ||
|
||
properties: | ||
x-input-code: | ||
type: int | ||
required: true | ||
y-input-code: | ||
type: int | ||
required: true | ||
trigger-period-ms: | ||
type: int | ||
default: 16 | ||
description: The time (in ms) between generated inputs when an input has non-zero speed. | ||
delay-ms: | ||
type: int | ||
time-to-max-speed-ms: | ||
type: int | ||
required: true | ||
acceleration-exponent: | ||
type: int | ||
default: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
description: | | ||
Listener to subscribe to input events and send HID updates after processing | ||
|
||
compatible: "zmk,input-listener" | ||
|
||
properties: | ||
device: | ||
type: phandle | ||
required: true | ||
xy-swap: | ||
type: boolean | ||
x-invert: | ||
type: boolean | ||
y-invert: | ||
type: boolean | ||
scale-multiplier: | ||
type: int | ||
default: 1 | ||
scale-divisor: | ||
type: int | ||
default: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might make sense to move these decode defines outside the dt-bindings header, and to either plain mouse.h or the corresponding event headers they are used in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, they are complementary and should live together.... I think keeping them here is appropriate.