tools: pass the userdata to the context
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 23 Dec 2014 01:13:33 +0000 (11:13 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 23 Dec 2014 01:14:39 +0000 (11:14 +1000)
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>
tools/event-debug.c
tools/event-gui.c
tools/shared.c
tools/shared.h

index ffc9a1322c39c2e3ab644a0f5fb4943d5d397552..da581c8249f43b6d84589acd48d32d7b402c7ab0 100644 (file)
@@ -368,7 +368,7 @@ main(int argc, char **argv)
        if (tools_parse_args(argc, argv, &options))
                return 1;
 
-       li = tools_open_backend(&options, &interface);
+       li = tools_open_backend(&options, NULL, &interface);
        if (!li)
                return 1;
 
index b950f92cc59f055f7e4a622e97ac608df53a3304..9a08d8ef111462d1e8f4ed0c911eef8e3a2932c3 100644 (file)
@@ -523,7 +523,7 @@ main(int argc, char *argv[])
        if (!udev)
                error("Failed to initialize udev\n");
 
-       li = tools_open_backend(&options, &interface);
+       li = tools_open_backend(&options, &w, &interface);
        if (!li)
                return 1;
 
index 8439cb27614f7384f758a6276c53d347b66d5bee..3e1368d1c3dd3595813691392df7069001de2a10 100644 (file)
@@ -170,6 +170,7 @@ tools_parse_args(int argc, char **argv, struct tools_options *options)
 
 static struct libinput *
 open_udev(const struct libinput_interface *interface,
+         void *userdata,
          const char *seat,
          int verbose)
 {
@@ -181,7 +182,7 @@ open_udev(const struct libinput_interface *interface,
                return NULL;
        }
 
-       li = libinput_udev_create_context(interface, NULL, udev);
+       li = libinput_udev_create_context(interface, userdata, udev);
        if (!li) {
                fprintf(stderr, "Failed to initialize context from udev\n");
                goto out;
@@ -206,13 +207,14 @@ out:
 
 static struct libinput *
 open_device(const struct libinput_interface *interface,
+           void *userdata,
            const char *path,
            int verbose)
 {
        struct libinput_device *device;
        struct libinput *li;
 
-       li = libinput_path_create_context(interface, NULL);
+       li = libinput_path_create_context(interface, userdata);
        if (!li) {
                fprintf(stderr, "Failed to initialize context from %s\n", path);
                return NULL;
@@ -235,14 +237,15 @@ open_device(const struct libinput_interface *interface,
 
 struct libinput *
 tools_open_backend(struct tools_options *options,
+                  void *userdata,
                   const struct libinput_interface *interface)
 {
        struct libinput *li = NULL;
 
        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) {
-               li = open_device(interface, options->device, options->verbose);
+               li = open_device(interface, userdata, options->device, options->verbose);
        } else
                abort();
 
index 9ecd3adbd1104e6f080b0be09b72b4d718008c21..4388cea6e11214c49e8377fe71bcad29df45e937 100644 (file)
@@ -44,6 +44,7 @@ struct tools_options {
 void tools_init_options(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,
+                                   void *userdata,
                                    const struct libinput_interface *interface);
 void tools_device_apply_config(struct libinput_device *device,
                               struct tools_options *options);