Skip to content
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

1106 digital inputs add type for touch input control #1293

Merged

Conversation

DanielMcInnes
Copy link
Contributor

No description provided.

When a digital input is configured as 'Touch input control', and that digital
input is 0, gui-v2 should ignore touch events if running on the cerbo. Other
build types such as wasm should be unaffected, and handle touch inputs as
usual.

Show toast notifications on all build types when the touch input is enabled or
disabled.

Cerbo builds should show a notification 'Touch input disabled' when the screen
is touched while disabled.

Fixes #1106
@@ -111,6 +111,7 @@ Item {
Timer {
id: timer

interval: 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default, 'interval' is 1000. So, if we created a 1-second auto-closing toast notification, 'onIntervalChanged' would never be triggered, and the timer would never start.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anyone trigger this timer without specifying a specific new interval? if so, it will trigger immediately upon returning to event loop in that case, rather than having a (default) interval of 1000.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, the default is zero in the showToastNotification method

@DanielMcInnes
Copy link
Contributor Author

To test on a cerbo, change Settings/Gui/TouchEnabled with dbus-spy

@DanielMcInnes DanielMcInnes self-assigned this Jul 3, 2024
chriadam
chriadam previously approved these changes Jul 4, 2024
@chriadam chriadam dismissed their stale review July 4, 2024 05:23

Second thoughts

if (Global.isGxDevice && !touchEnabled.value) {
//% "Touch input disabled"
Global.showToastNotification(VenusOS.Notification_Info, qsTrId("application_content_touch_input_disabled"), 1000)
mouse.accepted = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one way to do it. Another way might be to set the application's root item's enabled property to false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, you want to show the toast notification every time someone touches the screen.

Copy link
Contributor

@chriadam chriadam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, LGTM.

Copy link
Contributor

@blammit blammit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanielMcInnes is there more to come in fixing this issue? The commit says this fixes #1106, and that "gui-v2 should ignore touch events if running on the cerbo" when Digital Input 0 is "Touch input control". However, gui-v2 never changes Settings/Gui/TouchEnabled, so touch events continue to work on the device.

@@ -60,9 +60,30 @@ Item {

MouseArea {
id: idleModeMouseArea

property VeQuickItem touchEnabled: VeQuickItem {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

touchEnabled doesn't need to be a property, as the parent is Item.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested

@DanielMcInnes DanielMcInnes force-pushed the 1106-digital-inputs-add-type-for-touch-input-control branch from 35a2775 to e79ecc8 Compare July 5, 2024 05:09
@DanielMcInnes
Copy link
Contributor Author

TouchEnabled

Nothing writes to it in gui-v1, either. I think the dbus_digitalinputs process handles reading the digital inputs and writing the value to dbus

@blammit
Copy link
Contributor

blammit commented Jul 8, 2024

Nothing writes to it in gui-v1, either. I think the dbus_digitalinputs process handles reading the digital inputs and writing the value to dbus

Oh, I see. What do you suggest for testing this via wasm or on device?

@DanielMcInnes
Copy link
Contributor Author

DanielMcInnes commented Jul 8, 2024

Nothing writes to it in gui-v1, either. I think the dbus_digitalinputs process handles reading the digital inputs and writing the value to dbus

Oh, I see. What do you suggest for testing this via wasm or on device?

It needs to be tested on both wasm builds and device builds, they behave differently. I thought it was good enough to merge as-is. Rein has a cerbo set up with digital input switches, I was going to test it there. dbus_digitalinputs reads the digital inputs, and when the input is configured as 'touch input control', it writes to /Settings/Gui/TouchEnabled. I 'tested' it by modifying /Settings/Gui/TouchEnabled with dbus-spy, and device builds and cerbo builds behave as expected.

If you would prefer, I can send Rein a device build, and get him to test it

@blammit
Copy link
Contributor

blammit commented Jul 8, 2024

Okay, that makes sense then, so we need the external dbus_digitalinputs process to be triggered, and that only happens when real digital inputs are plugged in. LGTM then :)

@DanielMcInnes DanielMcInnes merged commit 6668450 into main Jul 8, 2024
1 check passed
@DanielMcInnes DanielMcInnes deleted the 1106-digital-inputs-add-type-for-touch-input-control branch July 8, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants