Commit Graph

46 Commits

Author SHA1 Message Date
david.ongenaert
f968ed153b Accessibility configurable from project settings
- Move settings from separate .INI to project settings
- Replace autoloaded TTS instance with dependency injection
- Make loggin configurable

Inspiration for how to do project settings: WAT-Sharp
2021-05-18 22:06:26 +02:00
54c01c5381 Allow a global override to determine if the next focus event should interrupt speech.
There seem to be a small handful of cases where we want this--controls that gain focus immediately after a dialog appears, for instance. We allow these edge cases to indicate that the next focus shouldn't stop speech, then clear it on cases where speech isn't stopped. This is a bit hacky, but seems cleaner than anything else I came up with.
2020-08-10 13:26:57 -05:00
6beeaa01bd Redirect "ui_accept" input for specific Tree edge cases.
Trees appear to eat "ui_accept" before `gui_input` receives it. This makes certain use cases--triggering buttons in cells--impossible via the keyboard.

Here, `ScreenReader` attempts to intercept recent presses of "ui_accept" and, if a button in a cell should receive focus, redirects the `InputEvent` to the custom handler for `Tree`.

Unfortunately, this loses the ability to click buttons in cells in the editor's node tree for some reason. It restores, or maybe gets working in the first place, clicking on the _Remove_ button in the input mapping screen. Not sure how to restore the former functionality--these trees are complex and not well-documented.
2020-07-22 12:13:19 -05:00
ccc79c93f6 Begin moving more functionality from ScreenReader/Accessible into the editor plugin. 2020-06-16 18:03:13 -05:00
76d1926385 Remove unnecessary code to set an initial scene focus. 2020-06-16 17:55:52 -05:00
a24255e3c4 Move focus loss prevention code from ScreenReader to Plugin.
That behavior is only specific to the editor. Any game UI that loses focus should be fixed by intelligently setting focus, not by magic in the accessibility addon.
2020-06-10 11:45:32 -05:00
ce4b9c94f2 Fix null comparison. 2020-06-09 14:30:08 -05:00
ce8d429336 Fix regression where actions not being faked via keyboard didn't work. 2020-06-09 13:45:00 -05:00
8ee1c05512 Add basic touchscreen support for sliders. 2020-06-09 13:23:58 -05:00
5852285dd4 Ensure screen reader always runs, even when game is paused. 2020-06-08 10:45:38 -05:00
d7b4744c6a Switch focus mode toggle to shift+escape to avoid conflict with Windows. 2020-05-29 11:07:56 -05:00
229353b37f Try to support disabling the screen reader by deleting all Accessibles. 2020-05-28 13:21:31 -05:00
95bbbff780 Unify event generation to support both simple and keyfake strategies, using the latter on Android where necessary. 2020-05-28 13:00:42 -05:00
4281e3777d Standardize focus mode on _press_and_release until input event generation is cleaned up. 2020-05-28 11:25:21 -05:00
d7040c25bf Add focus/UI modes and clean up event generation.
UI controls occasionally trap focus and make navigation impossible. Now, Ctrl+escape toggles a mode that attempts to intercept and generate UI focus events and bypass the control's own handling. This can probably be refined, but for now it allows escaping of `TextEdit` via tab. It also won't work everywhere--inn particular, arrowing around still traps focus in trees. But it is at least possible to tab out of most traps.

Further, event generation was cleaned up some. We specifically need to generate `KeyEvents` under Android because, IIRC, it wasn't enough to simply create and send some types of events. We now have two distinct generation strategies. These can probably be combined and streamlined, but for now this works.
2020-05-28 10:58:36 -05:00
9e2e99349c Reformat. 2020-05-19 12:03:59 -05:00
6279f1a3c9 Replace a couple print calls with print_debug. 2020-05-17 18:18:18 -05:00
fb56a4e37d Begin adding support to enable/disable screen reader. 2020-03-30 15:15:00 -05:00
fa9e10b1ea Change Accessible initialization strategy.
`Accessible` is now a child of its `Control`. This helps to ensure that everything gets cleaned up as it should. Further, node additions no longer scrape the entire scene.

This may introduce regressions and has only been lightly tested, but without it, `ScreenReader` leaked in various circumstances, including some that caused segfaults on exit.
2020-03-18 08:56:45 -05:00
8ffcaf970e Generate correct ui_focus_next and ui_focus_prev events. 2020-01-14 16:41:35 -06:00
5b2c16f342 Filter out InputEventMouseButton with device ID of -1, which seems to indicate an origin of touchscreen. Only pass through if explore-by-touch is active. 2019-12-30 08:27:20 -06:00
fbbbb1e06e Revert "Apparently, focused is triggered on mouse_enter as well, so this code isn't needed."
Necessary for next commit, which selectively ignores mouse events and needs this code for explore-by-touch.

This reverts commit dc6186c583.
2019-12-30 08:25:57 -06:00
dc6186c583 Apparently, focused is triggered on mouse_enter as well, so this code isn't needed. 2019-12-29 21:53:35 -06:00
50ea09d7f7 And bring back old cleanup code, which now seems to work better post-yield-abandonment. 2019-12-29 20:14:11 -06:00
96e7153410 Back to storing Accessible as array in ScreenReader, since otherwise the SceneTree is thrashed. 2019-12-29 19:53:15 -06:00
4ff6b51114 Double-tap runs ui_accept. 2019-12-29 18:52:44 -06:00
f17c070887 Swiping right/left moves focus between controls. 2019-12-29 18:44:15 -06:00
462cd08bbc Add hook to initiate explore-by-touch. 2019-12-29 18:23:51 -06:00
71318fe938 Count number of taps, and add stub code to dispatch action. 2019-12-29 18:18:09 -06:00
6542994a25 Initial support for touchscreen swipe left/right/up/down. 2019-12-29 17:59:48 -06:00
14e1832803 Remove stray whitespace. 2019-12-27 12:54:27 -06:00
75433eb5d6 Migrate focus restoration to _process. 2019-12-27 12:50:33 -06:00
b5a83e1c25 Add stub for detecting touchscreen events. 2019-12-27 11:19:49 -06:00
d9c740abd6 Return to having Accessible be a Node under ScreenReader, and having _exit_tree free resources.
This eliminates the need to track and iterate through a separate array of `Accessible`s in `ScreenReader`.

The previous performance issues are resolved by ensuring that any nodes processed aren't children of the `ScreenReader` node. I don't know of another way to avoid triggering signals on a child node than checking ancestry and failing fast.
2019-12-26 18:25:26 -06:00
24483e4453 Patch another leak. 2019-12-23 09:59:12 -06:00
606766e0e8 Store list of Accessibles and clean up manually. 2019-12-22 21:01:47 -06:00
dfe0c8179e Make Accessible extend Node and parent it to ScreenReader for easier cleanup. 2019-12-22 18:55:45 -06:00
0a96ddb2e4 Don't hard-code rate to maximum. 2019-10-18 12:10:11 -05:00
792504deb6 Set default rate to 100. 2019-10-10 09:49:33 -05:00
d0d80b1cb2 If unfocused, don't set an initial focus if one was restored in the meantime. 2019-10-03 09:52:41 -05:00
0783dfb548 Add global signal-catching for better handling of cases where focus is lost. 2019-10-03 09:34:22 -05:00
0e8b6ae9e8 Use global TTS singleton to avoid passing around instances. 2019-10-02 16:20:25 -05:00
1faed4fee1 Speak a bit more context when switching screens, and don't pre-empt. 2019-09-30 14:28:36 -05:00
5bf3bb285b Set rate to maximum for now. 2019-09-30 09:46:16 -05:00
e82fd7f8b8 Add ScreenReader as a custom node in the editor plugin. 2019-09-24 09:20:45 -05:00
981606ab21 Refactor to support running both in the editor and in game UIs.
Here I add a `ScreenReader` `Node` which, when added to the `SceneTree`, should read the contents of any supported `Control`. I also do a bit of cleanup on filenames, as well as breaking the editor plugin support into its own class.
2019-09-24 09:01:37 -05:00