1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-06 19:41:11 +00:00

Replace repetitive meta/ctrl condition with a method

This commit is contained in:
kobewi
2025-07-05 15:45:04 +02:00
parent 2d86b69bf1
commit 98141c3d73
11 changed files with 25 additions and 13 deletions

View File

@@ -1997,7 +1997,7 @@ void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, c
for (int i = 0; i < p_keycodes.size(); i++) {
Key keycode = (Key)p_keycodes[i];
if (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) {
if (OS::prefer_meta_over_ctrl()) {
// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
if (keycode == Key::KEY_DELETE) {
keycode = KeyModifierMask::META | Key::BACKSPACE;
@@ -2031,7 +2031,7 @@ Ref<Shortcut> ED_SHORTCUT_ARRAY(const String &p_path, const String &p_name, cons
for (int i = 0; i < p_keycodes.size(); i++) {
Key keycode = (Key)p_keycodes[i];
if (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) {
if (OS::prefer_meta_over_ctrl()) {
// Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS
if (keycode == Key::KEY_DELETE) {
keycode = KeyModifierMask::META | Key::BACKSPACE;

View File

@@ -66,7 +66,7 @@ String EventListenerLineEdit::get_event_text(const Ref<InputEvent> &p_event, boo
String mods_text = key->InputEventWithModifiers::as_text();
mods_text = mods_text.is_empty() ? mods_text : mods_text + "+";
if (key->is_command_or_control_autoremap()) {
if (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) {
if (OS::prefer_meta_over_ctrl()) {
mods_text = mods_text.replace("Command", "Command/Ctrl");
} else {
mods_text = mods_text.replace("Ctrl", "Command/Ctrl");