File: 03_freebsd-joystick.patch

package info (click to toggle)
libsfml 2.1%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,324 kB
  • ctags: 9,338
  • sloc: cpp: 16,452; ansic: 15,205; objc: 308; makefile: 17
file content (79 lines) | stat: -rw-r--r-- 1,708 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Description: Replace JoystickImpl.cpp code with dummy code on FreeBSD
 The joystick code in SFML assumes linux headers (sys/inotify.h and
 linux/joystick.h) which are not available in FreeBSD or GNU/Hurd.
 Until upstream can fix this, I've changed JoystickImpl.cpp to give
 a dummy implementation on FreeBSD and Hurd so that it compiles.
Author: James Cowgill <james410@cowgill.org.uk>
Last-Update: 2013-10-03
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/SFML/Window/Linux/JoystickImpl.cpp
+++ b/src/SFML/Window/Linux/JoystickImpl.cpp
@@ -27,12 +27,60 @@
 ////////////////////////////////////////////////////////////
 #include <SFML/Window/JoystickImpl.hpp>
 #include <SFML/System/Err.hpp>
-#include <sys/inotify.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <errno.h>
 #include <cstdio>
 
+#ifndef SFML_SYSTEM_LINUX
+
+// Dummy joystick implementation since there is no support for
+//  joysticks (yet) on FreeBSD and Hurd
+
+namespace sf
+{
+namespace priv
+{
+
+void JoystickImpl::initialize()
+{
+    err() << "Joystick support is not implemented on FreeBSD and GNU/Hurd" << std::endl;
+}
+
+void JoystickImpl::cleanup()
+{
+}
+
+bool JoystickImpl::isConnected(unsigned int index)
+{
+    return false;
+}
+
+bool JoystickImpl::open(unsigned int index)
+{
+    return false;
+}
+
+void JoystickImpl::close()
+{
+}
+
+JoystickCaps JoystickImpl::getCapabilities() const
+{
+    return JoystickCaps();
+}
+
+JoystickState JoystickImpl::JoystickImpl::update()
+{
+    return JoystickState();
+}
+
+} // namespace priv
+} // namespace sf
+
+#else
+
+#include <sys/inotify.h>
 
 namespace
 {
@@ -254,3 +302,5 @@
 } // namespace priv
 
 } // namespace sf
+
+#endif