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

@ -361,7 +361,7 @@ bool keycode_has_unicode(Key p_keycode) {
String keycode_get_string(Key p_code) {
Vector<String> keycode_string;
if ((p_code & KeyModifierMask::CMD_OR_CTRL) != Key::NONE && !(OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios"))) {
if ((p_code & KeyModifierMask::CMD_OR_CTRL) != Key::NONE && !OS::prefer_meta_over_ctrl()) {
keycode_string.push_back(find_keycode_name(Key::CTRL));
}
if ((p_code & KeyModifierMask::CTRL) != Key::NONE) {
@ -373,7 +373,7 @@ String keycode_get_string(Key p_code) {
if ((p_code & KeyModifierMask::SHIFT) != Key::NONE) {
keycode_string.push_back(find_keycode_name(Key::SHIFT));
}
if ((p_code & KeyModifierMask::CMD_OR_CTRL) != Key::NONE && (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios"))) {
if ((p_code & KeyModifierMask::CMD_OR_CTRL) != Key::NONE && OS::prefer_meta_over_ctrl()) {
keycode_string.push_back(find_keycode_name(Key::META));
}
if ((p_code & KeyModifierMask::META) != Key::NONE) {