From ad768598b123d54484d04a5dd8c41057482a290b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sun, 14 Jun 2015 17:29:17 -0700 Subject: [PATCH] x11: Fixed joystick read. --- examples/common/entry/entry_x11.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/common/entry/entry_x11.cpp b/examples/common/entry/entry_x11.cpp index ff1768c7..e0254884 100644 --- a/examples/common/entry/entry_x11.cpp +++ b/examples/common/entry/entry_x11.cpp @@ -63,6 +63,11 @@ namespace entry struct Joystick { + Joystick() + : m_fd(-1) + { + } + void init() { m_fd = open("/dev/input/js0", O_RDONLY | O_NONBLOCK); @@ -80,7 +85,7 @@ namespace entry void shutdown() { - if (0 != m_fd) + if (-1 != m_fd) { close(m_fd); } @@ -99,7 +104,7 @@ namespace entry bool update(EventQueue& _eventQueue) { - if (0 == m_fd) + if (-1 == m_fd) { return false; }