-
-
Notifications
You must be signed in to change notification settings - Fork 2k
InkHUD: Allow non-system applets to subscribe to input events #9514
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
base: develop
Are you sure you want to change the base?
Conversation
Adds a way for applets to subscribe to input events while keeping it off by default to preserve compatibility and expected behaviours. Adds example for use as well.
@Vortetty, Welcome to Meshtastic!Thanks for opening your first pull request. We really appreciate it. We discuss work as a team in discord, please join us in the #firmware channel. Welcome to the team 😄 |
|
I like the idea of having hooks enough that users can add their own apps! |
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.
Pull request overview
This pull request adds an opt-in input event subscription system for InkHUD user applets, enabling them to handle input events directly without triggering system applet popups. This is useful for interactive user applets that need more than just displaying information.
Changes:
- Added input subscription mechanism with per-input-type granularity using bitmask flags (InputMask enum)
- Modified all input event handlers in Events.cpp to check if the active user applet wants to consume the input before falling back to default behavior
- Added example applet (UserAppletInputExample) demonstrating how to subscribe to and handle various input events
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/graphics/niche/InkHUD/Applet.h | Adds InputMask enum, subscribedInputs field, and methods isInputEnabled() and setInput() to support input subscription |
| src/graphics/niche/InkHUD/Applet.cpp | Implements setInput() and isInputEnabled() methods for managing input subscriptions using bitwise operations |
| src/graphics/niche/InkHUD/WindowManager.h | Adds getActiveApplet() method declaration to expose the currently focused user applet |
| src/graphics/niche/InkHUD/WindowManager.cpp | Implements getActiveApplet() to return the applet assigned to the currently focused tile |
| src/graphics/niche/InkHUD/InkHUD.h | Exposes getActiveApplet() at the InkHUD API level |
| src/graphics/niche/InkHUD/InkHUD.cpp | Implements InkHUD::getActiveApplet() wrapper that delegates to WindowManager |
| src/graphics/niche/InkHUD/Events.cpp | Modifies all input event handlers to query the active user applet and route events to it if subscribed, otherwise using default behavior |
| src/graphics/niche/InkHUD/Applets/Examples/UserAppletInputExample/UserAppletInputExample.h | Header for example applet demonstrating input subscription feature |
| src/graphics/niche/InkHUD/Applets/Examples/UserAppletInputExample/UserAppletInputExample.cpp | Implementation of example applet that toggles input grabbing and displays last received input |
src/graphics/niche/InkHUD/Applets/Examples/UserAppletInputExample/UserAppletInputExample.cpp
Outdated
Show resolved
Hide resolved
That's the idea with it. The Applet system already has user I'd be curious if anyone else has any potential usecases or suggestions for this? The API's naming scheme was recently made more consistent, though it may need more work. And i am not 100% sure if adding |
|
To expand on the above, using a One downside to this system is that it currently has no way to force release of control, so a poorly programmed |
Adds a way for applets to subscribe to input events, with the default being that no inputs being consumed to preserve compatibility and expected behaviours. Adds example for use/testing as well. Discussed here prior to pr.
Useful for user applets that need to do more than display information, without creating a system applet popup when you want to use controls. Users of this will need to remember to provide a way to stop capturing inputs and/or a way to go to the next user applet. They will also need to account for control scheme differences with vs without joystick.
🤝 Attestations
Will need tested on another inkhud device, likely one without a joystick.