Skip to content

Commit bf5d1e6

Browse files
committed
Add default shortcut for "Emoji & Symbols".
1 parent 321b8c9 commit bf5d1e6

6 files changed

Lines changed: 37 additions & 4 deletions

File tree

core/input/input_map.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ static const _BuiltinActionDisplayName _builtin_action_display_names[] = {
433433
{ "ui_unicode_start", TTRC("Start Unicode Character Input") },
434434
{ "ui_colorpicker_delete_preset", TTRC("ColorPicker: Delete Preset") },
435435
{ "ui_accessibility_drag_and_drop", TTRC("Accessibility: Keyboard Drag and Drop") },
436+
{ "ui_emoji_and_symbols", TTRC("Emoji & Symbols") },
436437
{ "", ""}
437438
/* clang-format on */
438439
};
@@ -542,6 +543,17 @@ const HashMap<String, List<Ref<InputEvent>>> &InputMap::get_builtins() {
542543
inputs.push_back(InputEventKey::create_reference(Key::INSERT | KeyModifierMask::CMD_OR_CTRL));
543544
default_builtin_cache.insert("ui_copy", inputs);
544545

546+
inputs = List<Ref<InputEvent>>();
547+
default_builtin_cache.insert("ui_emoji_and_symbols", inputs);
548+
549+
inputs = List<Ref<InputEvent>>();
550+
inputs.push_back(InputEventKey::create_reference(Key::SPACE | KeyModifierMask::META | KeyModifierMask::CTRL));
551+
default_builtin_cache.insert("ui_emoji_and_symbols.macos", inputs);
552+
553+
inputs = List<Ref<InputEvent>>();
554+
inputs.push_back(InputEventKey::create_reference(Key::PERIOD | KeyModifierMask::META));
555+
default_builtin_cache.insert("ui_emoji_and_symbols.windows", inputs);
556+
545557
inputs = List<Ref<InputEvent>>();
546558
inputs.push_back(InputEventKey::create_reference(Key::M | KeyModifierMask::CTRL));
547559
default_builtin_cache.insert("ui_focus_mode", inputs);

doc/classes/ProjectSettings.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,16 @@
13441344
Default [InputEventAction] to move down in the UI.
13451345
[b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.
13461346
</member>
1347+
<member name="input/ui_emoji_and_symbols" type="Dictionary" setter="" getter="">
1348+
Default [InputEventAction] to open the emoji and symbol picker menu.
1349+
[b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.
1350+
</member>
1351+
<member name="input/ui_emoji_and_symbols.macos" type="Dictionary" setter="" getter="">
1352+
macOS specific override for the shortcut to open the emoji and symbol picker menu.
1353+
</member>
1354+
<member name="input/ui_emoji_and_symbols.windows" type="Dictionary" setter="" getter="">
1355+
Windows specific override for the shortcut to open the emoji and symbol picker menu.
1356+
</member>
13471357
<member name="input/ui_end" type="Dictionary" setter="" getter="">
13481358
Default [InputEventAction] to go to the end position of a [Control] (e.g. last item in an [ItemList] or a [Tree]), matching the behavior of [constant KEY_END] on typical desktop UI systems.
13491359
[b]Note:[/b] Default [code]ui_*[/code] actions cannot be removed as they are necessary for the internal logic of several [Control]s. The events assigned to the action can however be modified.

editor/script/script_editor_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ TextEditorBase::EditMenus::EditMenus() {
283283
void TextEditorBase::_make_context_menu(bool p_selection, bool p_foldable, const Vector2 &p_position, bool p_show) {
284284
context_menu->clear();
285285
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
286-
context_menu->add_item(TTRC("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
286+
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_emoji_and_symbols"), EDIT_EMOJI_AND_SYMBOL);
287287
context_menu->add_separator();
288288
}
289289
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_undo"), EDIT_UNDO);

editor/shader/text_shader_editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2109,7 +2109,7 @@ void TextShaderEditor::_shader_preview_item_pressed(int p_idx) {
21092109
void TextShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position) {
21102110
context_menu->clear();
21112111
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
2112-
context_menu->add_item(TTRC("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
2112+
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_emoji_and_symbols"), EDIT_EMOJI_AND_SYMBOL);
21132113
context_menu->add_separator();
21142114
}
21152115
if (p_selection) {

scene/gui/line_edit.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,12 @@ void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
688688
}
689689

690690
if (is_shortcut_keys_enabled()) {
691+
if (p_event->is_action("ui_emoji_and_symbols", true)) {
692+
show_emoji_and_symbol_picker();
693+
accept_event();
694+
return;
695+
}
696+
691697
if (p_event->is_action("ui_copy", true)) {
692698
copy_text();
693699
accept_event();
@@ -3303,7 +3309,7 @@ void LineEdit::_update_context_menu() {
33033309
}
33043310

33053311
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
3306-
MENU_ITEM_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, !editable || !emoji_menu_enabled)
3312+
MENU_ITEM_ACTION_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, "ui_emoji_and_symbols", !editable || !emoji_menu_enabled)
33073313
}
33083314
MENU_ITEM_ACTION_DISABLED(menu, MENU_CUT, "ui_cut", !editable)
33093315
MENU_ITEM_ACTION(menu, MENU_COPY, "ui_copy")

scene/gui/text_edit.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2722,6 +2722,11 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
27222722
accept_event();
27232723
return;
27242724
}
2725+
if (k->is_action("ui_emoji_and_symbols", true)) {
2726+
show_emoji_and_symbol_picker();
2727+
accept_event();
2728+
return;
2729+
}
27252730
if (k->is_action("ui_copy", true)) {
27262731
copy();
27272732
accept_event();
@@ -8149,7 +8154,7 @@ void TextEdit::_update_context_menu() {
81498154
}
81508155

81518156
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
8152-
MENU_ITEM_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, !editable || !emoji_menu_enabled)
8157+
MENU_ITEM_ACTION_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, "ui_emoji_and_symbols", !editable || !emoji_menu_enabled);
81538158
}
81548159
MENU_ITEM_ACTION_DISABLED(menu, MENU_CUT, "ui_cut", !editable)
81558160
MENU_ITEM_ACTION(menu, MENU_COPY, "ui_copy")

0 commit comments

Comments
 (0)