summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-02-26 21:30:24 +0100
committerGitHub <noreply@github.com>2017-02-26 21:30:24 +0100
commit34a0aa6900880235f2ca78a7631f30cd3e3ecb2c (patch)
tree3287927e4f90dc9a6c0c1d9487780407fdc610fc /platform/x11
parent3de1415b6a0e3ad5bb39b6bcc3958305b0d415d4 (diff)
parenta175ac7032407af8e0ffe9fcb23edd5b57c6548f (diff)
Merge pull request #7862 from Hinsbart/joypad_connections
Better handling of joypad device IDs.
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/joypad_linux.cpp11
-rw-r--r--platform/x11/joypad_linux.h1
2 files changed, 1 insertions, 11 deletions
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 362999661e..bdbd2912a6 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -219,15 +219,6 @@ void JoypadLinux::monitor_joypads() {
}
}
-int JoypadLinux::get_free_joy_slot() const {
-
- for (int i = 0; i < JOYPADS_MAX; i++) {
-
- if (joypads[i].fd == -1) return i;
- }
- return -1;
-}
-
int JoypadLinux::get_joy_from_path(String p_path) const {
for (int i = 0; i < JOYPADS_MAX; i++) {
@@ -329,7 +320,7 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
void JoypadLinux::open_joypad(const char *p_path) {
- int joy_num = get_free_joy_slot();
+ int joy_num = input->get_unused_joy_id();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
if (fd != -1 && joy_num != -1) {
diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h
index 18ad199f6b..310f5c1488 100644
--- a/platform/x11/joypad_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -81,7 +81,6 @@ private:
static void joy_thread_func(void *p_user);
int get_joy_from_path(String path) const;
- int get_free_joy_slot() const;
void setup_joypad_properties(int p_id);
void close_joypad(int p_id = -1);