summaryrefslogtreecommitdiffstats
path: root/platform/x11/joypad_linux.cpp
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-03-26 15:59:13 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-03-26 15:59:32 +0200
commitc0b67568757ccc22811e16348713ef3119e18f3e (patch)
treec2f13f324454478a76c623141611f79628d52ce6 /platform/x11/joypad_linux.cpp
parenta0b0dff6fdbdc4be78087aa572f3da5dbb8daa01 (diff)
downloadredot-engine-c0b67568757ccc22811e16348713ef3119e18f3e.tar.gz
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/x11/joypad_linux.cpp')
-rw-r--r--platform/x11/joypad_linux.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 62ece58f58..db4a501b4c 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -454,10 +454,10 @@ InputDefault::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int
return jx;
}
-uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
+void JoypadLinux::process_joypads() {
if (joy_mutex->try_lock() != OK) {
- return p_event_id;
+ return;
}
for (int i = 0; i < JOYPADS_MAX; i++) {
@@ -477,11 +477,11 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
// ev may be tainted and out of MAX_KEY range, which will cause
// joy->key_map[ev.code] to crash
if (ev.code < 0 || ev.code >= MAX_KEY)
- return p_event_id;
+ return;
switch (ev.type) {
case EV_KEY:
- p_event_id = input->joy_button(p_event_id, i, joy->key_map[ev.code], ev.value);
+ input->joy_button(i, joy->key_map[ev.code], ev.value);
break;
case EV_ABS:
@@ -496,7 +496,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
} else
joy->dpad &= ~(InputDefault::HAT_MASK_LEFT | InputDefault::HAT_MASK_RIGHT);
- p_event_id = input->joy_hat(p_event_id, i, joy->dpad);
+ input->joy_hat(i, joy->dpad);
break;
case ABS_HAT0Y:
@@ -508,7 +508,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
} else
joy->dpad &= ~(InputDefault::HAT_MASK_UP | InputDefault::HAT_MASK_DOWN);
- p_event_id = input->joy_hat(p_event_id, i, joy->dpad);
+ input->joy_hat(i, joy->dpad);
break;
default:
@@ -525,7 +525,7 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
for (int j = 0; j < MAX_ABS; j++) {
int index = joy->abs_map[j];
if (index != -1) {
- p_event_id = input->joy_axis(p_event_id, i, index, joy->curr_axis[index]);
+ input->joy_axis(i, index, joy->curr_axis[index]);
}
}
if (len == 0 || (len < 0 && errno != EAGAIN)) {
@@ -546,6 +546,5 @@ uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
}
}
joy_mutex->unlock();
- return p_event_id;
}
#endif