From d6b132527e864d9a1272df8168b40db2e2b470f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Sat, 12 Apr 2025 16:10:01 +0300 Subject: [PATCH] Add separate editor accessibility mode setting. --- doc/classes/EditorSettings.xml | 7 +++++++ doc/classes/ProjectSettings.xml | 8 ++++---- editor/editor_settings.cpp | 3 +++ main/main.cpp | 20 +++++++++++++++++--- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 906cec03b7a..1bf19b06cea 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -812,6 +812,13 @@ Input accumulation can be disabled to get slightly more precise/reactive input at the cost of increased CPU usage. [b]Note:[/b] Input accumulation is [i]enabled[/i] by default. + + Editor accessibility support mode: + - [b]Auto[/b] ([code]0[/code]): Accessibility support is enabled, but updates to the accessibility information are processed only if an assistive app (such as a screen reader or a Braille display) is active (default). + - [b]Always Active[/b] ([code]1[/code]): Accessibility support is enabled, and updates to the accessibility information are always processed, regardless of the status of assistive apps. + - [b]Disabled[/b] ([code]2[/code]): Accessibility support is fully disabled. + [b]Note:[/b] Accessibility debugging tools, such as Accessibility Insights for Windows, Accessibility Inspector (macOS), or AT-SPI Browser (Linux/BSD) do not count as assistive apps. To test your project with these tools, use [b]Always Active[/b]. + How to position the Cancel and OK buttons in the editor's [AcceptDialog]s. Different platforms have different standard behaviors for this, which can be overridden using this setting. This is useful if you use Godot both on Windows and macOS/Linux and your Godot muscle memory is stronger than your OS specific one. - [b]Auto[/b] follows the platform convention: OK first on Windows, KDE, and LXQt, Cancel first on macOS and other Linux desktop environments. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 42c2316f486..f85f5beb4d7 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -261,10 +261,10 @@ Accessibility support mode: - - [b]Auto[/b] ([code]0[/code]): accessibility support is enabled, but accessibility information updates are processed only if an assistive app (e.g. screen reader or Braille display) is active (default). - - [b]Always Active[/b] ([code]1[/code]): accessibility support is enabled, and accessibility information updates are processed regardless of current assistive apps' status. - - [b]Disabled[/b] ([code]2[/code]): accessibility support is fully disabled. - [b]Note:[/b] Accessibility debugging tools, such as Accessibility Insights for Windows, macOS Accessibility Inspector, or AT-SPI Browser do not count as assistive apps. To test your app with these tools, use [code]1[/code]. + - [b]Auto[/b] ([code]0[/code]): Accessibility support is enabled, but updates to the accessibility information are processed only if an assistive app (such as a screen reader or a Braille display) is active (default). + - [b]Always Active[/b] ([code]1[/code]): Accessibility support is enabled, and updates to the accessibility information are always processed, regardless of the status of assistive apps. + - [b]Disabled[/b] ([code]2[/code]): Accessibility support is fully disabled. + [b]Note:[/b] Accessibility debugging tools, such as Accessibility Insights for Windows, Accessibility Inspector (macOS), or AT-SPI Browser (Linux/BSD) do not count as assistive apps. To test your project with these tools, use [b]Always Active[/b]. The number of accessibility information updates per second. diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 7a97dc5902a..69292a1e888 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -568,6 +568,9 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { open_in_new_inspector_defaults.push_back("MeshLibrary"); _initial_set("interface/inspector/resources_to_open_in_new_inspector", open_in_new_inspector_defaults); + EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "interface/accessibility/accessibility_support", 0, "Auto (When Screen Reader is Running),Always Active,Disabled") + set_restart_if_changed("interface/accessibility/accessibility_support", true); + EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "interface/inspector/default_color_picker_mode", (int32_t)ColorPicker::MODE_RGB, "RGB,HSV,RAW,OKHSL") EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "interface/inspector/default_color_picker_shape", (int32_t)ColorPicker::SHAPE_OKHSL_CIRCLE, "HSV Rectangle,HSV Rectangle Wheel,VHS Circle,OKHSL Circle") EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "interface/inspector/color_picker_show_intensity", true, ""); diff --git a/main/main.cpp b/main/main.cpp index 6cec9abeebb..1f732ddc4f4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2908,6 +2908,7 @@ Error Main::setup2(bool p_show_boot_logo) { print_header(false); #ifdef TOOLS_ENABLED + int accessibility_mode_editor = 0; int tablet_driver_editor = -1; if (editor || project_manager || cmdline_tool) { OS::get_singleton()->benchmark_begin_measure("Startup", "Initialize Early Settings"); @@ -2945,6 +2946,8 @@ Error Main::setup2(bool p_show_boot_logo) { bool tablet_found = false; + bool ac_found = false; + if (editor) { screen_property = "interface/editor/editor_screen"; } else if (project_manager) { @@ -2959,7 +2962,7 @@ Error Main::setup2(bool p_show_boot_logo) { prefer_wayland_found = true; } - while (!screen_found || !prefer_wayland_found || !tablet_found) { + while (!screen_found || !prefer_wayland_found || !tablet_found || !ac_found) { assign = Variant(); next_tag.fields.clear(); next_tag.name = String(); @@ -2978,7 +2981,10 @@ Error Main::setup2(bool p_show_boot_logo) { restore_editor_window_layout = value.operator int() == EditorSettings::InitialScreen::INITIAL_SCREEN_AUTO; } } - if (assign == "interface/editor/expand_to_title") { + if (assign == "interface/accessibility/accessibility_support") { + accessibility_mode_editor = value; + ac_found = true; + } else if (assign == "interface/editor/expand_to_title") { init_expand_to_title = value; } else if (assign == "interface/editor/display_scale") { init_display_scale = value; @@ -3153,7 +3159,15 @@ Error Main::setup2(bool p_show_boot_logo) { #endif if (!accessibility_mode_set) { - accessibility_mode = (DisplayServer::AccessibilityMode)GLOBAL_GET("accessibility/general/accessibility_support").operator int64_t(); +#ifdef TOOLS_ENABLED + if (editor || project_manager || cmdline_tool) { + accessibility_mode = (DisplayServer::AccessibilityMode)accessibility_mode_editor; + } else { +#else + { +#endif + accessibility_mode = (DisplayServer::AccessibilityMode)GLOBAL_GET("accessibility/general/accessibility_support").operator int64_t(); + } } DisplayServer::accessibility_set_mode(accessibility_mode);