Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 12 additions & 1 deletion .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# Global Settings
env:
GODOT_CPP_BRANCH: 4.4
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.15.1/"
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
TSAN_OPTIONS: suppressions=${{ github.workspace }}/misc/error_suppressions/tsan.txt
Expand Down Expand Up @@ -151,6 +151,17 @@ jobs:
# Targeting the oldest version we want to support to ensure it still builds.
dotnet-version: 8.0.100

- name: Download pre-built AccessKit
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: AccessKit/accesskit-c
version: tags/0.15.1
file: accesskit-c-0.15.1.zip
target: accesskit-c-0.15.1/accesskit_c.zip

- name: Extract pre-built AccessKit
run: unzip -o accesskit-c-0.15.1/accesskit_c.zip

- name: Compilation
uses: ./.github/actions/godot-build
with:
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

# Global Settings
env:
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.15.1/"

jobs:
build-macos:
Expand Down Expand Up @@ -43,6 +43,17 @@ jobs:
- name: Setup Python and SCons
uses: ./.github/actions/godot-deps

- name: Download pre-built AccessKit
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: AccessKit/accesskit-c
version: tags/0.15.1
file: accesskit-c-0.15.1.zip
target: accesskit-c-0.15.1/accesskit_c.zip

- name: Extract pre-built AccessKit
run: unzip -o accesskit-c-0.15.1/accesskit_c.zip

- name: Setup Vulkan SDK
id: vulkan-sdk
run: |
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# Global Settings
# SCONS_CACHE for windows must be set in the build environment
env:
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes d3d12=yes strict_checks=yes "angle_libs=${{ github.workspace }}/"
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes d3d12=yes strict_checks=yes "angle_libs=${{ github.workspace }}/" "accesskit_sdk_path=${{ github.workspace }}/accesskit-c-0.15.1/"
SCONS_CACHE_MSVC_CONFIG: true

jobs:
Expand Down Expand Up @@ -81,6 +81,17 @@ jobs:
- name: Extract pre-built ANGLE static libraries
run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/

- name: Download pre-built AccessKit
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: AccessKit/accesskit-c
version: tags/0.15.1
file: accesskit-c-0.15.1.zip
target: accesskit-c-0.15.1/accesskit_c.zip

- name: Extract pre-built AccessKit
run: unzip -o accesskit-c-0.15.1/accesskit_c.zip

- name: Compilation
uses: ./.github/actions/godot-build
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default_language_version:
exclude: |
(?x)^(
.*thirdparty/.*|
.*-so_wrap\.(h|c)|
.*-(dll|dylib|so)_wrap\.[ch]|
platform/android/java/editor/src/main/java/com/android/.*|
platform/android/java/lib/src/com/google/.*
)$
Expand Down
5 changes: 5 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ Comment: Temporal Anti-Aliasing resolve implementation
Copyright: 2016, Panos Karabelas
License: Expat

Files: thirdparty/accesskit/*
Comment: AccessKit
Copyright: 2023, The AccessKit Authors.
License: Expat

Files: thirdparty/amd-fsr/*
Comment: AMD FidelityFX Super Resolution
Copyright: 2021, Advanced Micro Devices, Inc.
Expand Down
2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loade
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
opts.Add(BoolVariable("accesskit", "Use AccessKit C SDK", True))
opts.Add(("accesskit_sdk_path", "Path to the AccessKit C SDK", ""))

# Advanced options
opts.Add(
Expand Down
3 changes: 3 additions & 0 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,9 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("application/config/auto_accept_quit", true);
GLOBAL_DEF("application/config/quit_on_go_back", true);

GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "accessibility/general/accessibility_support", PROPERTY_HINT_ENUM, "Auto (When Screen Reader is Running),Always Active,Disabled"), 0);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "accessibility/general/updates_per_second", PROPERTY_HINT_RANGE, "1,100,1"), 60);

// The default window size is tuned to:
// - Have a 16:9 aspect ratio,
// - Have both dimensions divisible by 8 to better play along with video recording,
Expand Down
50 changes: 49 additions & 1 deletion core/input/input_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ void InputMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_action", "action", "deadzone"), &InputMap::add_action, DEFVAL(DEFAULT_DEADZONE));
ClassDB::bind_method(D_METHOD("erase_action", "action"), &InputMap::erase_action);

ClassDB::bind_method(D_METHOD("get_action_description", "action"), &InputMap::get_action_description);

ClassDB::bind_method(D_METHOD("action_set_deadzone", "action", "deadzone"), &InputMap::action_set_deadzone);
ClassDB::bind_method(D_METHOD("action_get_deadzone", "action"), &InputMap::action_get_deadzone);
ClassDB::bind_method(D_METHOD("action_add_event", "action", "event"), &InputMap::action_add_event);
Expand Down Expand Up @@ -181,6 +183,25 @@ bool InputMap::has_action(const StringName &p_action) const {
return input_map.has(p_action);
}

String InputMap::get_action_description(const StringName &p_action) const {
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), String(), suggest_actions(p_action));

String ret;
const List<Ref<InputEvent>> &inputs = input_map[p_action].inputs;
for (Ref<InputEventKey> iek : inputs) {
if (iek.is_valid()) {
if (!ret.is_empty()) {
ret += RTR(" or ");
}
ret += iek->as_text();
}
}
if (ret.is_empty()) {
ret = RTR("Action has no bound inputs");
}
return ret;
}

float InputMap::action_get_deadzone(const StringName &p_action) {
ERR_FAIL_COND_V_MSG(!input_map.has(p_action), 0.0f, suggest_actions(p_action));

Expand Down Expand Up @@ -344,6 +365,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
{ "ui_cut", TTRC("Cut") },
{ "ui_copy", TTRC("Copy") },
{ "ui_paste", TTRC("Paste") },
{ "ui_focus_mode", TTRC("Toggle Tab Focus Mode") },
{ "ui_undo", TTRC("Undo") },
{ "ui_redo", TTRC("Redo") },
{ "ui_text_completion_query", TTRC("Completion Query") },
Expand Down Expand Up @@ -397,12 +419,15 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
{ "ui_text_submit", TTRC("Submit Text") },
{ "ui_graph_duplicate", TTRC("Duplicate Nodes") },
{ "ui_graph_delete", TTRC("Delete Nodes") },
{ "ui_graph_follow_left", TTRC("Follow Input Port Connection") },
{ "ui_graph_follow_right", TTRC("Follow Output Port Connection") },
{ "ui_filedialog_up_one_level", TTRC("Go Up One Level") },
{ "ui_filedialog_refresh", TTRC("Refresh") },
{ "ui_filedialog_show_hidden", TTRC("Show Hidden") },
{ "ui_swap_input_direction ", TTRC("Swap Input Direction") },
{ "ui_unicode_start", TTRC("Start Unicode Character Input") },
{ "ui_colorpicker_delete_preset", TTRC("Toggle License Notices") },
{ "ui_colorpicker_delete_preset", TTRC("Toggle License Notices") },
{ "ui_accessibility_drag_and_drop", TTRC("Accessibility: Keyboard Drag and Drop") },
{ "", ""}
/* clang-format on */
};
Expand Down Expand Up @@ -488,6 +513,9 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs.push_back(InputEventKey::create_reference(Key::END));
default_builtin_cache.insert("ui_end", inputs);

inputs = List<Ref<InputEvent>>();
default_builtin_cache.insert("ui_accessibility_drag_and_drop", inputs);

// ///// UI basic Shortcuts /////

inputs = List<Ref<InputEvent>>();
Expand All @@ -500,6 +528,10 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_copy", inputs);

inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::M | KeyModifierMask::CTRL));
default_builtin_cache.insert("ui_focus_mode", inputs);

inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::V | KeyModifierMask::CMD_OR_CTRL));
inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::SHIFT));
Expand Down Expand Up @@ -773,6 +805,22 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
inputs.push_back(InputEventKey::create_reference(Key::KEY_DELETE));
default_builtin_cache.insert("ui_graph_delete", inputs);

inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_graph_follow_left", inputs);

inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::LEFT | KeyModifierMask::ALT));
default_builtin_cache.insert("ui_graph_follow_left.macos", inputs);

inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::CMD_OR_CTRL));
default_builtin_cache.insert("ui_graph_follow_right", inputs);

inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::RIGHT | KeyModifierMask::ALT));
default_builtin_cache.insert("ui_graph_follow_right.macos", inputs);

// ///// UI File Dialog Shortcuts /////
inputs = List<Ref<InputEvent>>();
inputs.push_back(InputEventKey::create_reference(Key::BACKSPACE));
Expand Down
2 changes: 2 additions & 0 deletions core/input/input_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class InputMap : public Object {
void add_action(const StringName &p_action, float p_deadzone = DEFAULT_DEADZONE);
void erase_action(const StringName &p_action);

String get_action_description(const StringName &p_action) const;

float action_get_deadzone(const StringName &p_action);
void action_set_deadzone(const StringName &p_action, float p_deadzone);
void action_add_event(const StringName &p_action, const Ref<InputEvent> &p_event);
Expand Down
27 changes: 19 additions & 8 deletions core/string/ustring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2073,34 +2073,45 @@ Error String::append_utf8(const char *p_utf8, int p_len, bool p_skip_cr) {
return result;
}

CharString String::utf8() const {
CharString String::utf8(Vector<uint8_t> *r_ch_length_map) const {
int l = length();
if (!l) {
return CharString();
}

uint8_t *map_ptr = nullptr;
if (r_ch_length_map) {
r_ch_length_map->resize(l);
map_ptr = r_ch_length_map->ptrw();
}

const char32_t *d = &operator[](0);
int fl = 0;
for (int i = 0; i < l; i++) {
uint32_t c = d[i];
int ch_w = 1;
if (c <= 0x7f) { // 7 bits.
fl += 1;
ch_w = 1;
} else if (c <= 0x7ff) { // 11 bits
fl += 2;
ch_w = 2;
} else if (c <= 0xffff) { // 16 bits
fl += 3;
ch_w = 3;
} else if (c <= 0x001fffff) { // 21 bits
fl += 4;
ch_w = 4;
} else if (c <= 0x03ffffff) { // 26 bits
fl += 5;
ch_w = 5;
print_unicode_error(vformat("Invalid unicode codepoint (%x)", c));
} else if (c <= 0x7fffffff) { // 31 bits
fl += 6;
ch_w = 6;
print_unicode_error(vformat("Invalid unicode codepoint (%x)", c));
} else {
fl += 1;
ch_w = 1;
print_unicode_error(vformat("Invalid unicode codepoint (%x), cannot represent as UTF-8", c), true);
}
fl += ch_w;
if (map_ptr) {
map_ptr[i] = ch_w;
}
}

CharString utf8s;
Expand Down
2 changes: 1 addition & 1 deletion core/string/ustring.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class String {
return string;
}

CharString utf8() const;
CharString utf8(Vector<uint8_t> *r_ch_length_map = nullptr) const;
Error append_utf8(const char *p_utf8, int p_len = -1, bool p_skip_cr = false);
Error append_utf8(const Span<char> &p_range, bool p_skip_cr = false) {
return append_utf8(p_range.ptr(), p_range.size(), p_skip_cr);
Expand Down
24 changes: 24 additions & 0 deletions doc/classes/Control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@
<link title="All GUI Demos">https://github.com/godotengine/godot-demo-projects/tree/master/gui</link>
</tutorials>
<methods>
<method name="_accessibility_get_contextual_info" qualifiers="virtual const">
<return type="String" />
<description>
Return the description of the keyboard shortcuts and other contextual help for this control.
</description>
</method>
<method name="_can_drop_data" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="at_position" type="Vector2" />
<param index="1" name="data" type="Variant" />
<description>
Godot calls this method to test if [param data] from a control's [method _get_drag_data] can be dropped at [param at_position]. [param at_position] is local to this control.
This method should only be used to test the data. Process the data in [method _drop_data].
[b]Note:[/b] If drag was initiated by keyboard shortcut or [method accessibility_drag], [param at_position] is set to [code]Vector2(INFINITY, INFINITY)[/code] and the currently selected item/text position should be used as drop position.
[codeblocks]
[gdscript]
func _can_drop_data(position, data):
Expand All @@ -55,6 +62,7 @@
<param index="1" name="data" type="Variant" />
<description>
Godot calls this method to pass you the [param data] from a control's [method _get_drag_data] result. Godot first calls [method _can_drop_data] to test if [param data] is allowed to drop at [param at_position] where [param at_position] is local to this control.
[b]Note:[/b] If drag was initiated by keyboard shortcut or [method accessibility_drag], [param at_position] is set to [code]Vector2(INFINITY, INFINITY)[/code] and the currently selected item/text position should be used as drop position.
[codeblocks]
[gdscript]
func _can_drop_data(position, data):
Expand Down Expand Up @@ -83,6 +91,7 @@
<description>
Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method _can_drop_data] and [method _drop_data]. [param at_position] is local to this control. Drag may be forced with [method force_drag].
A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method.
[b]Note:[/b] If drag was initiated by keyboard shortcut or [method accessibility_drag], [param at_position] is set to [code]Vector2(INFINITY, INFINITY)[/code] and the currently selected item/text position should be used as drop position.
[codeblocks]
[gdscript]
func _get_drag_data(position):
Expand Down Expand Up @@ -223,6 +232,18 @@
[b]Note:[/b] This does not affect the methods in [Input], only the way events are propagated.
</description>
</method>
<method name="accessibility_drag">
<return type="void" />
<description>
Starts drag-and-drop operation without using a mouse.
</description>
</method>
<method name="accessibility_drop">
<return type="void" />
<description>
Ends drag-and-drop operation without using a mouse.
</description>
</method>
<method name="add_theme_color_override">
<return type="void" />
<param index="0" name="name" type="StringName" />
Expand Down Expand Up @@ -1174,6 +1195,9 @@
<constant name="FOCUS_ALL" value="2" enum="FocusMode">
The node can grab focus on mouse click, using the arrows and the Tab keys on the keyboard, or using the D-pad buttons on a gamepad. Use with [member focus_mode].
</constant>
<constant name="FOCUS_ACCESSIBILITY" value="3" enum="FocusMode">
The node can grab focus only when screen reader is active. Use with [member focus_mode].
</constant>
<constant name="RECURSIVE_BEHAVIOR_INHERITED" value="0" enum="RecursiveBehavior">
Inherits the associated behavior from the control's parent. This is the default for any newly created control.
</constant>
Expand Down
Loading