Skip to content

Commit b61e20f

Browse files
committed
Add default shortcut for "Emoji & Symbols".
1 parent caf1670 commit b61e20f

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
@@ -1341,6 +1341,16 @@
13411341
Default [InputEventAction] to move down in the UI.
13421342
[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.
13431343
</member>
1344+
<member name="input/ui_emoji_and_symbols" type="Dictionary" setter="" getter="">
1345+
Default [InputEventAction] to open emoji and symbol picker menu.
1346+
[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.
1347+
</member>
1348+
<member name="input/ui_emoji_and_symbols.macos" type="Dictionary" setter="" getter="">
1349+
macOS specific override for the shortcut to open emoji and symbol picker menu.
1350+
</member>
1351+
<member name="input/ui_emoji_and_symbols.windows" type="Dictionary" setter="" getter="">
1352+
Windows specific override for the shortcut to open emoji and symbol picker menu.
1353+
</member>
13441354
<member name="input/ui_end" type="Dictionary" setter="" getter="">
13451355
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.
13461356
[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
@@ -1920,7 +1920,7 @@ void TextShaderEditor::_shader_preview_item_pressed(int p_idx) {
19201920
void TextShaderEditor::_make_context_menu(bool p_selection, Vector2 p_position) {
19211921
context_menu->clear();
19221922
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
1923-
context_menu->add_item(TTRC("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
1923+
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_emoji_and_symbols"), EDIT_EMOJI_AND_SYMBOL);
19241924
context_menu->add_separator();
19251925
}
19261926
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();
@@ -3301,7 +3307,7 @@ void LineEdit::_update_context_menu() {
33013307
}
33023308

33033309
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
3304-
MENU_ITEM_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, !editable || !emoji_menu_enabled)
3310+
MENU_ITEM_ACTION_DISABLED(menu, MENU_EMOJI_AND_SYMBOL, "ui_emoji_and_symbols", !editable || !emoji_menu_enabled)
33053311
}
33063312
MENU_ITEM_ACTION_DISABLED(menu, MENU_CUT, "ui_cut", !editable)
33073313
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)