소스 검색

Merge pull request #9002 from Hinsbart/key_action_match

InputEvent: Restore old behaviour for matching key events to actions.
Rémi Verschelde 8 년 전
부모
커밋
b52466f793
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      core/os/input_event.cpp

+ 4 - 1
core/os/input_event.cpp

@@ -282,7 +282,10 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event) const {
 	if (key.is_null())
 	if (key.is_null())
 		return false;
 		return false;
 
 
-	return get_scancode_with_modifiers() == key->get_scancode_with_modifiers();
+	uint32_t code = get_scancode_with_modifiers();
+	uint32_t event_code = key->get_scancode_with_modifiers();
+
+	return get_scancode() == key->get_scancode() && (!key->is_pressed() || (code & event_code) == code);
 }
 }
 
 
 void InputEventKey::_bind_methods() {
 void InputEventKey::_bind_methods() {