Skip to content

Commit

Permalink
fix: revert feat(port): UI, accessibility updates, tweaks (#4709)
Browse files Browse the repository at this point in the history
* Revert "feat(port): UI, accessibility updates, tweaks (#4636)"

This reverts commit db18424.

* Revert "feat(port): UI, accessibility updates, tweaks (#4636)"

This reverts commit db18424.
  • Loading branch information
chaosvolt committed May 30, 2024
1 parent db18424 commit 27cf366
Show file tree
Hide file tree
Showing 100 changed files with 2,341 additions and 3,666 deletions.
1,422 changes: 463 additions & 959 deletions data/raw/keybindings/keybindings.json

Large diffs are not rendered by default.

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

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.
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.
7 changes: 3 additions & 4 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, input_event_t::keyboard_char );
const input_event event( ch, CATA_INPUT_KEYBOARD );
const std::string &action = ctxt.input_to_action( event );
return look_up_action( action );
}
Expand Down Expand Up @@ -926,8 +926,7 @@ 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 @@ -948,7 +947,7 @@ action_id handle_main_menu()

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

0 comments on commit 27cf366

Please sign in to comment.