From baa49ad14550f73ef232c11cdef0f6bf2cf9b284 Mon Sep 17 00:00:00 2001
From: ehofman <ehofman>
Date: Tue, 27 Apr 2004 08:43:20 +0000
Subject: [PATCH] Make it possible to define a <target-platform> tag in the
 joystick configuration file. This would make it possible to have different
 configuration files for Windows. Possible values are: Windows, UNIX or All.
 Not specifying the tag equals to 'All'.

---
 src/Input/input.cxx | 6 ++++++
 src/Input/input.hxx | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/Input/input.cxx b/src/Input/input.cxx
index 4a4853def..04b356a38 100644
--- a/src/Input/input.cxx
+++ b/src/Input/input.cxx
@@ -404,6 +404,12 @@ FGInput::_init_joystick ()
       vector<SGPropertyNode_ptr> nodes = js_nodes->getChildren("js-named");
       for (unsigned int i = 0; i < nodes.size(); i++) {
         SGPropertyNode_ptr node = nodes[i];
+        SGPropertyNode *tgt = node->getNode("target-platform", false);
+        if (tgt != NULL) {
+           if ((strcmp(tgt->getStringValue(), TGT_PLATFORM) != NULL) &&
+               (strcmp(tgt->getStringValue(), "All") != NULL))
+              continue;		// Different target platform
+        }
         vector<SGPropertyNode_ptr> name_nodes = node->getChildren("name");
         for (unsigned int j = 0; j < name_nodes.size(); j++) {
             const char * js_name = name_nodes[j]->getStringValue();
diff --git a/src/Input/input.hxx b/src/Input/input.hxx
index 364b93872..e61d9c95d 100644
--- a/src/Input/input.hxx
+++ b/src/Input/input.hxx
@@ -29,6 +29,7 @@
 #endif
 
 #include <plib/js.h>
+#include <plib/ul.h>
 
 #include <simgear/compiler.h>
 
@@ -48,6 +49,13 @@ SG_USING_STD(map);
 SG_USING_STD(vector);
 
 
+
+
+#if defined( UL_WIN32 )
+#define TGT_PLATFORM	"Windows"
+#else
+#define TGT_PLATFORM	"UNIX"
+#endif