tools: pass the userdata to the context

The event-gui needs this but it got dropped in
6ee8c585, causing a crash. Oops.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-12-23 11:13:33 +10:00
parent 6ee8c5854c
commit df47231719
4 changed files with 10 additions and 6 deletions

View file

@ -368,7 +368,7 @@ main(int argc, char **argv)
if (tools_parse_args(argc, argv, &options)) if (tools_parse_args(argc, argv, &options))
return 1; return 1;
li = tools_open_backend(&options, &interface); li = tools_open_backend(&options, NULL, &interface);
if (!li) if (!li)
return 1; return 1;

View file

@ -523,7 +523,7 @@ main(int argc, char *argv[])
if (!udev) if (!udev)
error("Failed to initialize udev\n"); error("Failed to initialize udev\n");
li = tools_open_backend(&options, &interface); li = tools_open_backend(&options, &w, &interface);
if (!li) if (!li)
return 1; return 1;

View file

@ -170,6 +170,7 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
static struct libinput * static struct libinput *
open_udev(const struct libinput_interface *interface, open_udev(const struct libinput_interface *interface,
void *userdata,
const char *seat, const char *seat,
int verbose) int verbose)
{ {
@ -181,7 +182,7 @@ open_udev(const struct libinput_interface *interface,
return NULL; return NULL;
} }
li = libinput_udev_create_context(interface, NULL, udev); li = libinput_udev_create_context(interface, userdata, udev);
if (!li) { if (!li) {
fprintf(stderr, "Failed to initialize context from udev\n"); fprintf(stderr, "Failed to initialize context from udev\n");
goto out; goto out;
@ -206,13 +207,14 @@ out:
static struct libinput * static struct libinput *
open_device(const struct libinput_interface *interface, open_device(const struct libinput_interface *interface,
void *userdata,
const char *path, const char *path,
int verbose) int verbose)
{ {
struct libinput_device *device; struct libinput_device *device;
struct libinput *li; struct libinput *li;
li = libinput_path_create_context(interface, NULL); li = libinput_path_create_context(interface, userdata);
if (!li) { if (!li) {
fprintf(stderr, "Failed to initialize context from %s\n", path); fprintf(stderr, "Failed to initialize context from %s\n", path);
return NULL; return NULL;
@ -235,14 +237,15 @@ open_device(const struct libinput_interface *interface,
struct libinput * struct libinput *
tools_open_backend(struct tools_options *options, tools_open_backend(struct tools_options *options,
void *userdata,
const struct libinput_interface *interface) const struct libinput_interface *interface)
{ {
struct libinput *li = NULL; struct libinput *li = NULL;
if (options->backend == BACKEND_UDEV) { if (options->backend == BACKEND_UDEV) {
li = open_udev(interface, options->seat, options->verbose); li = open_udev(interface, userdata, options->seat, options->verbose);
} else if (options->backend == BACKEND_DEVICE) { } else if (options->backend == BACKEND_DEVICE) {
li = open_device(interface, options->device, options->verbose); li = open_device(interface, userdata, options->device, options->verbose);
} else } else
abort(); abort();

View file

@ -44,6 +44,7 @@ struct tools_options {
void tools_init_options(struct tools_options *options); void tools_init_options(struct tools_options *options);
int tools_parse_args(int argc, char **argv, struct tools_options *options); int tools_parse_args(int argc, char **argv, struct tools_options *options);
struct libinput* tools_open_backend(struct tools_options *options, struct libinput* tools_open_backend(struct tools_options *options,
void *userdata,
const struct libinput_interface *interface); const struct libinput_interface *interface);
void tools_device_apply_config(struct libinput_device *device, void tools_device_apply_config(struct libinput_device *device,
struct tools_options *options); struct tools_options *options);