Browse Source

Merge pull request #105314 from bruvzg/ac_set_sep

Add separate editor accessibility mode setting.
Rémi Verschelde 1 month ago
parent
commit
fae09980bd
4 changed files with 31 additions and 7 deletions
  1. 7 0
      doc/classes/EditorSettings.xml
  2. 4 4
      doc/classes/ProjectSettings.xml
  3. 3 0
      editor/editor_settings.cpp
  4. 17 3
      main/main.cpp

+ 7 - 0
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.
 			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.
 			[b]Note:[/b] Input accumulation is [i]enabled[/i] by default.
 		</member>
 		</member>
+		<member name="interface/accessibility/accessibility_support" type="int" setter="" getter="">
+			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].
+		</member>
 		<member name="interface/editor/accept_dialog_cancel_ok_buttons" type="int" setter="" getter="">
 		<member name="interface/editor/accept_dialog_cancel_ok_buttons" type="int" setter="" getter="">
 			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.
 			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.
 			- [b]Auto[/b] follows the platform convention: OK first on Windows, KDE, and LXQt, Cancel first on macOS and other Linux desktop environments.

+ 4 - 4
doc/classes/ProjectSettings.xml

@@ -261,10 +261,10 @@
 	<members>
 	<members>
 		<member name="accessibility/general/accessibility_support" type="int" setter="" getter="" default="0">
 		<member name="accessibility/general/accessibility_support" type="int" setter="" getter="" default="0">
 			Accessibility support mode:
 			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].
 		</member>
 		</member>
 		<member name="accessibility/general/updates_per_second" type="int" setter="" getter="" default="60">
 		<member name="accessibility/general/updates_per_second" type="int" setter="" getter="" default="60">
 			The number of accessibility information updates per second.
 			The number of accessibility information updates per second.

+ 3 - 0
editor/editor_settings.cpp

@@ -568,6 +568,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
 	open_in_new_inspector_defaults.push_back("MeshLibrary");
 	open_in_new_inspector_defaults.push_back("MeshLibrary");
 	_initial_set("interface/inspector/resources_to_open_in_new_inspector", open_in_new_inspector_defaults);
 	_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_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,OK HS Rectangle:5,OK HL Rectangle") // `SHAPE_NONE` is 4.
 	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,OK HS Rectangle:5,OK HL Rectangle") // `SHAPE_NONE` is 4.
 	EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "interface/inspector/color_picker_show_intensity", true, "");
 	EDITOR_SETTING_BASIC(Variant::BOOL, PROPERTY_HINT_NONE, "interface/inspector/color_picker_show_intensity", true, "");

+ 17 - 3
main/main.cpp

@@ -2909,6 +2909,7 @@ Error Main::setup2(bool p_show_boot_logo) {
 	print_header(false);
 	print_header(false);
 
 
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
+	int accessibility_mode_editor = 0;
 	int tablet_driver_editor = -1;
 	int tablet_driver_editor = -1;
 	if (editor || project_manager || cmdline_tool) {
 	if (editor || project_manager || cmdline_tool) {
 		OS::get_singleton()->benchmark_begin_measure("Startup", "Initialize Early Settings");
 		OS::get_singleton()->benchmark_begin_measure("Startup", "Initialize Early Settings");
@@ -2946,6 +2947,8 @@ Error Main::setup2(bool p_show_boot_logo) {
 
 
 					bool tablet_found = false;
 					bool tablet_found = false;
 
 
+					bool ac_found = false;
+
 					if (editor) {
 					if (editor) {
 						screen_property = "interface/editor/editor_screen";
 						screen_property = "interface/editor/editor_screen";
 					} else if (project_manager) {
 					} else if (project_manager) {
@@ -2960,7 +2963,7 @@ Error Main::setup2(bool p_show_boot_logo) {
 						prefer_wayland_found = true;
 						prefer_wayland_found = true;
 					}
 					}
 
 
-					while (!screen_found || !prefer_wayland_found || !tablet_found) {
+					while (!screen_found || !prefer_wayland_found || !tablet_found || !ac_found) {
 						assign = Variant();
 						assign = Variant();
 						next_tag.fields.clear();
 						next_tag.fields.clear();
 						next_tag.name = String();
 						next_tag.name = String();
@@ -2979,7 +2982,10 @@ Error Main::setup2(bool p_show_boot_logo) {
 									restore_editor_window_layout = value.operator int() == EditorSettings::InitialScreen::INITIAL_SCREEN_AUTO;
 									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;
 								init_expand_to_title = value;
 							} else if (assign == "interface/editor/display_scale") {
 							} else if (assign == "interface/editor/display_scale") {
 								init_display_scale = value;
 								init_display_scale = value;
@@ -3154,7 +3160,15 @@ Error Main::setup2(bool p_show_boot_logo) {
 #endif
 #endif
 
 
 		if (!accessibility_mode_set) {
 		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);
 		DisplayServer::accessibility_set_mode(accessibility_mode);