diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-06-26 15:09:09 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-06-26 15:11:30 +1000 |
commit | 9e664af686ed780271ce26c02582fa1185d38ecd (patch) | |
tree | 8673b3c40db2f2de3bdae8e99ed3e561cf8f6653 /src | |
parent | c28d90ba698c3cf411b73a0a4f1314ccb7bb9b9f (diff) |
Use the new libinput_ref/unref instead of manual counting.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/libinput.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libinput.c b/src/libinput.c index f158cd6..94347b8 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -59,7 +59,6 @@ struct xf86libinput_driver { struct libinput *libinput; - int device_count; int device_enabled_count; }; @@ -560,8 +559,6 @@ static int xf86libinput_pre_init(InputDriverPtr drv, struct libinput_device *device; char *path; - driver_context.device_count++; - pInfo->fd = -1; pInfo->type_name = XI_TOUCHPAD; pInfo->device_control = xf86libinput_device_control; @@ -586,6 +583,9 @@ static int xf86libinput_pre_init(InputDriverPtr drv, if (!driver_context.libinput) driver_context.libinput = libinput_path_create_context(&interface, &driver_context); + else + libinput_ref(driver_context.libinput); + libinput = driver_context.libinput; if (libinput == NULL) { @@ -627,10 +627,7 @@ xf86libinput_uninit(InputDriverPtr drv, { struct xf86libinput *driver_data = pInfo->private; if (driver_data) { - if (--driver_context.device_count == 0) { - libinput_unref(driver_context.libinput); - driver_context.libinput = NULL; - } + driver_context.libinput = libinput_unref(driver_context.libinput); valuator_mask_free(&driver_data->valuators); free(driver_data->path); free(driver_data); |