struct input_event *e,
uint32_t time)
{
+ struct libinput *libinput = device->base.libinput;
int screen_width;
int screen_height;
- device->base.device_interface->get_current_screen_dimensions(
+ libinput->interface->get_current_screen_dimensions(
+ &device->base,
&screen_width,
&screen_height,
- device->base.device_interface_data);
+ libinput->user_data);
switch (e->code) {
case ABS_MT_SLOT:
evdev_process_absolute_motion(struct evdev_device *device,
struct input_event *e)
{
+ struct libinput *libinput = device->base.libinput;
int screen_width;
int screen_height;
- device->base.device_interface->get_current_screen_dimensions(
+ libinput->interface->get_current_screen_dimensions(
+ &device->base,
&screen_width,
&screen_height,
- device->base.device_interface_data);
+ libinput->user_data);
switch (e->code) {
case ABS_X:
struct libinput *libinput,
const char *devnode,
int fd,
- const struct libinput_device_interface *device_interface,
void *user_data)
{
struct evdev_device *device;
return NULL;
device->base.libinput = libinput;
- device->base.device_interface = device_interface;
- device->base.device_interface_data = user_data;
+ device->base.user_data = user_data;
device->seat_caps = 0;
device->is_mt = 0;
size_t events_len;
size_t events_in;
size_t events_out;
+
+ const struct libinput_interface *interface;
+ void *user_data;
};
struct libinput_device {
struct libinput *libinput;
- const struct libinput_device_interface *device_interface;
- void *device_interface_data;
+ void *user_data;
int terminated;
};
}
LIBINPUT_EXPORT struct libinput *
-libinput_create(void)
+libinput_create(const struct libinput_interface *interface, void *user_data)
{
struct libinput *libinput;
list_init(&libinput->source_destroy_list);
+ libinput->interface = interface;
+ libinput->user_data = user_data;
+
libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);;
if (libinput->epoll_fd < 0)
return NULL;
LIBINPUT_EXPORT void *
libinput_device_get_user_data(struct libinput_device *device)
{
- return device->device_interface_data;
+ return device->user_data;
}
LIBINPUT_EXPORT void
typedef void (*libinput_fd_callback)(int fd, void *data);
-struct libinput_device_interface {
- void (*get_current_screen_dimensions)(int *width,
+struct libinput_interface {
+ void (*get_current_screen_dimensions)(struct libinput_device *device,
+ int *width,
int *height,
- void *data);
+ void *user_data);
};
struct libinput;
struct libinput_device;
struct libinput *
-libinput_create(void);
+libinput_create(const struct libinput_interface *interface, void *user_data);
int
libinput_get_fd(struct libinput *libinput);
libinput_device_create_evdev(struct libinput *libinput,
const char *devnode,
int fd,
- const struct libinput_device_interface *interface,
void *user_data);
void