summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2011-11-20 03:49:13 -0800
committerJamey Sharp <jamey@minilop.net>2011-11-20 03:49:13 -0800
commit7b93f056dc720908cd941d0bdaed1f5616164a2b (patch)
tree2a539db2eb75b0b026da742644afd7bea51a0504 /src
parenteed1f2a15b5e6d03c002c56d0d2e90b5acf54d83 (diff)
Update for input API change: InputOption is an opaque type now.
I copied the backwards-compatibility functions from xf86-input-joystick. Signed-off-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'src')
-rw-r--r--src/input.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/src/input.c b/src/input.c
index 66c05f5..5c44c7f 100644
--- a/src/input.c
+++ b/src/input.c
@@ -302,6 +302,39 @@ NestedInputReadInput(InputInfoPtr pInfo) {
TimerSet(NULL, 0, 1, nested_input_ready, pNestedInput->clientData);
}
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 14
+static InputOption*
+input_option_new(InputOption* list, char *key, char *value)
+{
+ InputOption *tmp;
+
+ tmp = calloc(1, sizeof(*tmp));
+ tmp->key = key;
+ tmp->value = value;
+ tmp->next = list;
+
+ return tmp;
+}
+
+static void
+input_option_free_list(InputOption **list)
+{
+ InputOption *iopts = *list;
+
+ while(iopts)
+ {
+ InputOption *tmp = iopts->next;
+ free(iopts->key);
+ free(iopts->value);
+ free(iopts);
+ iopts = tmp;
+ }
+
+ *list = NULL;
+}
+#endif
+
+
void
NestedInputLoadDriver(NestedClientPrivatePtr clientData) {
DeviceIntPtr dev;
@@ -309,21 +342,16 @@ NestedInputLoadDriver(NestedClientPrivatePtr clientData) {
NestedInputDevicePtr pNestedInput;
// Create input options for our invocation to NewInputDeviceRequest.
- InputOption* options = (InputOption*)malloc(sizeof(InputOption));
-
- options->key = "driver";
- options->value = "nestedinput";
-
- options->next = (InputOption*)malloc(sizeof(InputOption));
+ InputOption* options = NULL;
+ options = input_option_new(options, strdup("identifier"), strdup("nestedinput"));
+ options = input_option_new(options, strdup("driver"), strdup("nestedinput"));
- options->next->key = "identifier";
- options->next->value = "nestedinput";
- options->next->next = NULL;
-
// Invoke NewInputDeviceRequest to call the PreInit function of
// the driver.
int ret = NewInputDeviceRequest(options, NULL, &dev);
-
+
+ input_option_free_list(&options);
+
if (ret != Success) {
FatalError("Failed to load input driver.\n");
}