Use mouse and joypad enums instead of plain integers

Also MIDIMessage
This commit is contained in:
Aaron Franke 2021-03-25 16:56:12 -04:00
parent e919d894f8
commit 0ce49800ac
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
38 changed files with 188 additions and 181 deletions

View file

@ -229,8 +229,8 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E
}
Input *input = Input::get_singleton();
int mask = input->get_mouse_button_mask();
int button_flag = 1 << (ev->get_button_index() - 1);
MouseButton mask = input->get_mouse_button_mask();
MouseButton button_flag = MouseButton(1 << (ev->get_button_index() - 1));
if (ev->is_pressed()) {
// Since the event is consumed, focus manually. The containing iframe,
// if exists, may not have focus yet, so focus even if already focused.
@ -478,11 +478,11 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript
int button_flag = 1 << (ev->get_button_index() - 1);
ev->set_pressed(true);
ev->set_button_mask(input->get_mouse_button_mask() | button_flag);
ev->set_button_mask(MouseButton(input->get_mouse_button_mask() | button_flag));
input->parse_input_event(ev);
ev->set_pressed(false);
ev->set_button_mask(input->get_mouse_button_mask() & ~button_flag);
ev->set_button_mask(MouseButton(input->get_mouse_button_mask() & ~button_flag));
input->parse_input_event(ev);
return true;