diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-03-26 15:59:13 +0200 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-03-26 15:59:32 +0200 |
commit | c0b67568757ccc22811e16348713ef3119e18f3e (patch) | |
tree | c2f13f324454478a76c623141611f79628d52ce6 /platform/osx | |
parent | a0b0dff6fdbdc4be78087aa572f3da5dbb8daa01 (diff) |
Input: Remove usage of platform dependent event IDs.
The ID property for InputEvents is set by `SceneTree` when sending the event down the tree.
So there's no need for the platform specific code to set this value when it will later be overriden anyway...
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/joypad_osx.cpp | 9 | ||||
-rw-r--r-- | platform/osx/joypad_osx.h | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.h | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 4 |
4 files changed, 6 insertions, 11 deletions
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index c2b0e1f052..7b77f3bb68 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -458,7 +458,7 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma return jx; } -uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) { +void JoypadOSX::process_joypads() { poll_joypads(); for (int i = 0; i < device_list.size(); i++) { @@ -467,17 +467,17 @@ uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) { for (int j = 0; j < joy.axis_elements.size(); j++) { rec_element &elem = joy.axis_elements[j]; int value = joy.get_hid_element_state(&elem); - p_last_id = input->joy_axis(p_last_id, joy.id, j, axis_correct(value, elem.min, elem.max)); + input->joy_axis(joy.id, j, axis_correct(value, elem.min, elem.max)); } for (int j = 0; j < joy.button_elements.size(); j++) { int value = joy.get_hid_element_state(&joy.button_elements[j]); - p_last_id = input->joy_button(p_last_id, joy.id, j, (value >= 1)); + input->joy_button(joy.id, j, (value >= 1)); } for (int j = 0; j < joy.hat_elements.size(); j++) { rec_element &elem = joy.hat_elements[j]; int value = joy.get_hid_element_state(&elem); int hat_value = process_hat_value(elem.min, elem.max, value); - p_last_id = input->joy_hat(p_last_id, joy.id, hat_value); + input->joy_hat(joy.id, hat_value); } if (joy.ffservice) { @@ -494,7 +494,6 @@ uint32_t JoypadOSX::process_joypads(uint32_t p_last_id) { } } } - return p_last_id; } void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) { diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index dabd1b8aec..e565f4f46d 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -110,7 +110,7 @@ private: void joypad_vibration_stop(int p_id, uint64_t p_timestamp); public: - uint32_t process_joypads(uint32_t p_last_id); + void process_joypads(); void _device_added(IOReturn p_res, IOHIDDeviceRef p_device); void _device_removed(int p_id); diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 2c7ad09b89..8676c86131 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -61,7 +61,6 @@ public: List<String> args; MainLoop *main_loop; - unsigned int event_id; PhysicsServer *physics_server; Physics2DServer *physics_2d_server; @@ -83,7 +82,6 @@ public: // pthread_key_t current; bool mouse_grab; Point2 mouse_pos; - uint32_t last_id; id delegate; id window_delegate; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 0699978caf..8411bdb114 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1698,7 +1698,6 @@ void OS_OSX::process_events() { void OS_OSX::push_input(const InputEvent& p_event) { InputEvent ev=p_event; - ev.ID=last_id++; //print_line("EV: "+String(ev)); input->parse_input_event(ev); } @@ -1725,7 +1724,7 @@ void OS_OSX::run() { while (!force_quit) { process_events(); // get rid of pending events - last_id = joypad_osx->process_joypads(last_id); + joypad_osx->process_joypads(); if (Main::iteration()==true) break; }; @@ -1822,7 +1821,6 @@ OS_OSX::OS_OSX() { [NSApp setDelegate:delegate]; - last_id=1; cursor_shape=CURSOR_ARROW; current_screen = 0; |