mirror of
https://github.com/X11Libre/xf86-video-nested.git
synced 2026-03-24 01:24:18 +00:00
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>
This commit is contained in:
50
src/input.c
50
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));
|
||||
InputOption* options = NULL;
|
||||
options = input_option_new(options, strdup("identifier"), strdup("nestedinput"));
|
||||
options = input_option_new(options, strdup("driver"), strdup("nestedinput"));
|
||||
|
||||
options->key = "driver";
|
||||
options->value = "nestedinput";
|
||||
|
||||
options->next = (InputOption*)malloc(sizeof(InputOption));
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user