Add is_valid() check for InputEventKey in CanvasItemEditor.

This commit is contained in:
Eric M 2020-09-17 11:46:04 +10:00
parent efe5c250d5
commit 7941235e06
2 changed files with 17 additions and 15 deletions

View file

@ -479,6 +479,7 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
return;
}
if (k.is_valid()) {
if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
viewport->update();
}
@ -497,6 +498,7 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
viewport->update();
}
}
}
}
Object *CanvasItemEditor::_get_editor_data(Object *p_what) {

View file

@ -123,7 +123,7 @@ MenuButton::MenuButton() {
set_toggle_mode(true);
set_disable_shortcuts(false);
set_process_unhandled_key_input(true);
set_enabled_focus_mode(FOCUS_NONE);
set_focus_mode(FOCUS_NONE);
set_action_mode(ACTION_MODE_BUTTON_PRESS);
popup = memnew(PopupMenu);