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

feat(port): UI, accessibility updates/updates, optimization updates/tweaks, keyboard format updates/tweaks #4636

Merged
merged 22 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
de7991f
Port UI, accessibility updates, tweaks
Kenan2000 May 11, 2024
1a3a0b8
style(autofix.ci): automated formatting
autofix-ci[bot] May 11, 2024
b67717e
Misc tweaks update
Kenan2000 May 15, 2024
0cdb7c3
Merge branch 'UIaccessibility_port_update3' of https://github.com/cat…
Kenan2000 May 15, 2024
f80512b
Misc tweaks update
Kenan2000 May 15, 2024
821a7f0
Merge branch 'main' into UIaccessibility_port_update3
Kenan2000 May 15, 2024
63bd330
style(autofix.ci): automated formatting
autofix-ci[bot] May 15, 2024
d5705ad
Misc tweaks update
Kenan2000 May 15, 2024
e25e672
Merge branch 'UIaccessibility_port_update3' of https://github.com/cat…
Kenan2000 May 15, 2024
c4de6bb
Misc tweaks update
Kenan2000 May 16, 2024
914a3ce
Misc tweaks update
Kenan2000 May 16, 2024
f7ee0c4
Misc tweaks update
Kenan2000 May 18, 2024
3cf3d27
style(autofix.ci): automated formatting
autofix-ci[bot] May 18, 2024
93fd571
Misc tweaks update
Kenan2000 May 18, 2024
5ed2a98
Misc tweaks update
Kenan2000 May 18, 2024
c3a7583
style(autofix.ci): automated formatting
autofix-ci[bot] May 18, 2024
f277e33
Misc tweaks update
Kenan2000 May 27, 2024
903fca9
Merge branch 'UIaccessibility_port_update3' of https://github.com/cat…
Kenan2000 May 27, 2024
bad27b5
style(autofix.ci): automated formatting
autofix-ci[bot] May 27, 2024
d896daa
Misc tweaks update
Kenan2000 May 28, 2024
b1a3064
Merge branch 'UIaccessibility_port_update3' of https://github.com/cat…
Kenan2000 May 28, 2024
4fd6243
Misc tweaks update
Kenan2000 May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,422 changes: 959 additions & 463 deletions data/raw/keybindings/keybindings.json

Large diffs are not rendered by default.

83 changes: 45 additions & 38 deletions data/raw/keybindings/vehicle.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,265 +4,272 @@
"type": "keybinding",
"category": "VEHICLE",
"name": "Control multiple electronics",
"bindings": [ { "input_method": "keyboard", "key": "E" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "E" }, { "input_method": "keyboard_code", "key": "e", "mod": [ "shift" ] } ]
},
{
"id": "CONTROL_ENGINES",
"type": "keybinding",
"category": "VEHICLE",
"name": "Control individual engines",
"bindings": [ { "input_method": "keyboard", "key": "y" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "y" } ]
},
{
"id": "FOLD_VEHICLE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Fold vehicle",
"bindings": [ { "input_method": "keyboard", "key": "f" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "f" } ]
},
{
"id": "RELEASE_CONTROLS",
"type": "keybinding",
"category": "VEHICLE",
"name": "Release controls",
"bindings": [ { "input_method": "keyboard", "key": "l" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "l" } ]
},
{
"id": "SOUND_HORN",
"type": "keybinding",
"category": "VEHICLE",
"name": "Sound horn",
"bindings": [ { "input_method": "keyboard", "key": "n" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "n" } ]
},
{
"id": "TOGGLE_AISLE_LIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle aisle lights",
"bindings": [ { "input_method": "keyboard", "key": "L" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "L" }, { "input_method": "keyboard_code", "key": "l", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_ALARM",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle alarm",
"bindings": [ { "input_method": "keyboard", "key": "z" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "z" } ]
},
{
"id": "TOGGLE_ATOMIC_LIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle atomic lights",
"bindings": [ { "input_method": "keyboard", "key": "A" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "A" }, { "input_method": "keyboard_code", "key": "a", "mod": [ "shift" ] } ]
},
{
"id": "CONTROL_AUTOPILOT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Control autopilot",
"bindings": [ { "input_method": "keyboard", "key": "a" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "a" } ]
},
{
"id": "TOGGLE_CAMERA",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle camera system",
"bindings": [ { "input_method": "keyboard", "key": "M" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "M" }, { "input_method": "keyboard_code", "key": "m", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_CHIMES",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle chimes",
"bindings": [ { "input_method": "keyboard", "key": "i" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "i" } ]
},
{
"id": "TOGGLE_CRUISE_CONTROL",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle cruise control",
"bindings": [ { "input_method": "keyboard", "key": "c" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "c" } ]
},
{
"id": "TOGGLE_DOME_LIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle dome lights",
"bindings": [ { "input_method": "keyboard", "key": "d" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "d" } ]
},
{
"id": "TOGGLE_DOORS",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle doors",
"bindings": [ { "input_method": "keyboard", "key": "D" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "D" }, { "input_method": "keyboard_code", "key": "d", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_ENGINE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle engine",
"bindings": [ { "input_method": "keyboard", "key": "e" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "e" } ]
},
{
"id": "TOGGLE_FRIDGE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle fridge",
"bindings": [ { "input_method": "keyboard", "key": "f" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "f" } ]
},
{
"id": "TOGGLE_FREEZER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle freezer",
"bindings": [ { "input_method": "keyboard", "key": "r" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "r" } ]
},
{
"id": "TOGGLE_SPACE_HEATER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle space heater",
"bindings": [ { "input_method": "keyboard", "key": "s" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "s" } ]
},
{
"id": "TOGGLE_COOLER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle cooler",
"bindings": [ { "input_method": "keyboard", "key": "C" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "C" }, { "input_method": "keyboard_code", "key": "c", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_HEADLIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle headlights",
"bindings": [ { "input_method": "keyboard", "key": "h" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "h" } ]
},
{
"id": "TOGGLE_WIDE_HEADLIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle wide-angle headlights",
"bindings": [ { "input_method": "keyboard", "key": "b" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "b" } ]
},
{
"id": "TOGGLE_HALF_OVERHEAD_LIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle directional overhead lights",
"bindings": [ { "input_method": "keyboard", "key": "O" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "O" }, { "input_method": "keyboard_code", "key": "o", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_OVERHEAD_LIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle overhead lights",
"bindings": [ { "input_method": "keyboard", "key": "o" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "o" } ]
},
{
"id": "TOGGLE_PLANTER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle planter",
"bindings": [ { "input_method": "keyboard", "key": "P" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "P" }, { "input_method": "keyboard_code", "key": "p", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_PLOW",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle plow",
"bindings": [ { "input_method": "keyboard", "key": "w" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "w" } ]
},
{
"id": "TOGGLE_REACTOR",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle reactor",
"bindings": [ { "input_method": "keyboard", "key": "k" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "k" } ]
},
{
"id": "TOGGLE_REAPER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle reaper",
"bindings": [ { "input_method": "keyboard", "key": "H" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "H" }, { "input_method": "keyboard_code", "key": "h", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_RECHARGER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle recharger",
"bindings": [ { "input_method": "keyboard", "key": "g" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "g" } ]
},
{
"id": "TOGGLE_SCOOP",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle scoop",
"bindings": [ { "input_method": "keyboard", "key": "S" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "S" }, { "input_method": "keyboard_code", "key": "s", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_STEREO",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle stereo",
"bindings": [ { "input_method": "keyboard", "key": "m" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "m" } ]
},
{
"id": "TOGGLE_WATER_PURIFIER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle water purifiers",
"bindings": [ { "input_method": "keyboard", "key": "p" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "p" } ]
},
{
"id": "TOGGLE_TRACKING",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle tracking",
"bindings": [ { "input_method": "keyboard", "key": "K" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "K" }, { "input_method": "keyboard_code", "key": "k", "mod": [ "shift" ] } ]
},
{
"id": "TOGGLE_SMART_ENGINE_CONTROLLER",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle smart engine controller",
"bindings": [ { "input_method": "keyboard_char", "key": "Y" }, { "input_method": "keyboard_code", "key": "y", "mod": [ "shift" ] } ]
},
{
"id": "TURRET_FIRE_MODE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Set turret firing modes",
"bindings": [ { "input_method": "keyboard", "key": "x" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "x" } ]
},
{
"id": "TURRET_MANUAL_AIM",
"type": "keybinding",
"category": "VEHICLE",
"name": "Aim manual turrets",
"bindings": [ { "input_method": "keyboard", "key": "X" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "X" }, { "input_method": "keyboard_code", "key": "x", "mod": [ "shift" ] } ]
},
{
"id": "TURRET_MANUAL_OVERRIDE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Aim automatic turrets",
"bindings": [ { "input_method": "keyboard", "key": "V" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "V" }, { "input_method": "keyboard_code", "key": "v", "mod": [ "shift" ] } ]
},
{
"id": "TURRET_ALL_OVERRIDE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Aim all turrets",
"bindings": [ { "input_method": "keyboard", "key": "v" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "v" } ]
},
{
"id": "TURRET_SINGLE_FIRE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Aim individual turret",
"bindings": [ { "input_method": "keyboard", "key": "T" } ]
"bindings": [ { "input_method": "keyboard_char", "key": "T" }, { "input_method": "keyboard_code", "key": "t", "mod": [ "shift" ] } ]
},
{
"id": "TURRET_TARGET_MODE",
"type": "keybinding",
"category": "VEHICLE",
"name": "Set turret targeting modes",
"bindings": [ { "input_method": "keyboard", "key": "t" } ]
"bindings": [ { "input_method": "keyboard_any", "key": "t" } ]
}
]
45 changes: 11 additions & 34 deletions doc/src/content/docs/en/dev/explanation/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,14 @@
title: Compatibility with screen readers
---

There are people who uses screen readers to play Cataclysm DDA. In order for screen readers to
announce the most important information in a UI, the terminal cursor has to be placed at the correct
location. This information may be text such as selected item names in a list, etc, and the cursor
has to be placed exactly at the beginning of the text for screen readers to announce it.

`wmove` in `output.h|cpp` is the function to move the cursor to a specific location. After calling
`wmove` with the target `catacurses::window` and cursor position, `wrefresh` needs to be called
immediately afterwards for `wmove` to take effect.

Here is an example of placing the cursor explicitly at the beginning of a piece of text:

```cpp
catacurses::window win = ...; // target window

...

// display code
point cursor_position = ...; // default cursor position

...

cursor_position = point_zero; // record the start position of the text
fold_and_print( win, cursor_position, getmaxx( win ), c_white, _( "This text is important" ) );

...

// at the end of display code
wmove( win, cursor_position );
wrefresh( win );
// no output code should follow as they might change the cursor position
```

As shown in the above example, it is preferable to record the intended cursor position in a variable
when the text is printed, and move the cursor later using the variable to ensure consisitency.
There are people who use screen readers to play Cataclysm Bright Nights. In order for screen readers
to announce the most important information in a UI, the terminal cursor has to be placed at the
correct location. This information may be text such as selected item names in a list, etc, and the
cursor has to be placed exactly at the beginning of the text for screen readers to announce it.

The recommended way to place the cursor is to use `ui_adaptor`. This ensures the desired cursor
position is preserved when subsequent output code changes the cursor position. You can call
`ui_adaptor::set_cursor` and similar methods at any position in a redrawing callback, and the last
cursor position of the topmost UI set via the call will be used as the final cursor position. You
can also call `ui_adaptor::disable_cursor` to prevent a UI's cursor from being used as the final
cursor position.
7 changes: 4 additions & 3 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ std::vector<char> keys_bound_to( action_id act, const bool restrict_to_printable
action_id action_from_key( char ch )
{
input_context ctxt = get_default_mode_input_context();
const input_event event( ch, CATA_INPUT_KEYBOARD );
const input_event event( ch, input_event_t::keyboard_char );
const std::string &action = ctxt.input_to_action( event );
return look_up_action( action );
}
Expand Down Expand Up @@ -926,7 +926,8 @@ action_id handle_main_menu()
const auto register_actions = make_register_actions( entries, ctxt );

register_actions( {
ACTION_OPEN_WIKI, ACTION_HELP, ACTION_KEYBINDINGS, ACTION_OPTIONS, ACTION_AUTOPICKUP, ACTION_AUTONOTES,
ACTION_OPEN_WIKI, ACTION_HELP,
ACTION_KEYBINDINGS, ACTION_OPTIONS, ACTION_AUTOPICKUP, ACTION_AUTONOTES,
ACTION_SAFEMODE, ACTION_DISTRACTION_MANAGER, ACTION_COLOR, ACTION_WORLD_MODS,
ACTION_ACTIONMENU, ACTION_QUICKSAVE, ACTION_SAVE, ACTION_DEBUG, ACTION_LUA_CONSOLE,
ACTION_LUA_RELOAD
Expand All @@ -947,7 +948,7 @@ action_id handle_main_menu()

std::optional<tripoint> choose_direction( const std::string &message, const bool allow_vertical )
{
input_context ctxt( "DEFAULTMODE" );
input_context ctxt( "DEFAULTMODE", keyboard_mode::keychar );
ctxt.set_iso( true );
ctxt.register_directions();
ctxt.register_action( "pause" );
Expand Down
Loading
Loading