-
Notifications
You must be signed in to change notification settings - Fork 9
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
1106 digital inputs add type for touch input control #1293
Conversation
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 |
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.
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.
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.
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.
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.
Ah, I see, the default is zero in the showToastNotification method
To test on a cerbo, change Settings/Gui/TouchEnabled with dbus-spy |
if (Global.isGxDevice && !touchEnabled.value) { | ||
//% "Touch input disabled" | ||
Global.showToastNotification(VenusOS.Notification_Info, qsTrId("application_content_touch_input_disabled"), 1000) | ||
mouse.accepted = true |
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.
This is one way to do it. Another way might be to set the application's root item's enabled property to false.
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.
Ah, I see, you want to show the toast notification every time someone touches the screen.
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.
Ok, LGTM.
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.
@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.
ApplicationContent.qml
Outdated
@@ -60,9 +60,30 @@ Item { | |||
|
|||
MouseArea { | |||
id: idleModeMouseArea | |||
|
|||
property VeQuickItem touchEnabled: VeQuickItem { |
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.
touchEnabled
doesn't need to be a property, as the parent is Item
.
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.
Updated as suggested
35a2775
to
e79ecc8
Compare
Nothing writes to it in gui-v1, either. I think the |
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 |
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 :) |
No description provided.