Skip to content

Commit

Permalink
libinput: Drop output size callback; use transform helper instead
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
  • Loading branch information
jadahl committed Jan 30, 2014
1 parent 1227454 commit 9230416
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
32 changes: 26 additions & 6 deletions src/evdev.c
Expand Up @@ -87,9 +87,22 @@ handle_pointer_motion_absolute(
{
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
uint32_t time = libinput_event_pointer_get_time(pointer_event);
wl_fixed_t x = libinput_event_pointer_get_absolute_x(pointer_event);
wl_fixed_t y = libinput_event_pointer_get_absolute_y(pointer_event);
struct weston_output *output = device->output;
uint32_t time;
wl_fixed_t x, y;
uint32_t width, height;

if (!output)
return;

time = libinput_event_pointer_get_time(pointer_event);
width = device->output->current_mode->width;
height = device->output->current_mode->height;

x = libinput_event_pointer_get_absolute_x_transformed(pointer_event,
width);
y = libinput_event_pointer_get_absolute_y_transformed(pointer_event,
height);

weston_output_transform_coordinate(device->output, x, y, &x, &y);
notify_motion_absolute(device->seat, time, x, y);
Expand Down Expand Up @@ -128,11 +141,18 @@ handle_touch_touch(struct libinput_device *libinput_device,
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
struct weston_seat *master = device->seat;
wl_fixed_t x = libinput_event_touch_get_x(touch_event);
wl_fixed_t y = libinput_event_touch_get_y(touch_event);
uint32_t slot = libinput_event_touch_get_slot(touch_event);
wl_fixed_t x;
wl_fixed_t y;
uint32_t width, height;
uint32_t slot;
uint32_t seat_slot;

width = device->output->current_mode->width;
height = device->output->current_mode->height;
x = libinput_event_touch_get_x_transformed(touch_event, width);
y = libinput_event_touch_get_y_transformed(touch_event, height);
slot = libinput_event_touch_get_slot(touch_event);

switch (libinput_event_touch_get_touch_type(touch_event)) {
case LIBINPUT_TOUCH_TYPE_DOWN:
seat_slot = ffs(~master->slot_map) - 1;
Expand Down
15 changes: 0 additions & 15 deletions src/udev-seat.c
Expand Up @@ -170,19 +170,6 @@ libinput_source_dispatch(int fd, uint32_t mask, void *data)
return udev_input_dispatch(input) != 0;
}

static void
get_current_screen_dimensions(struct libinput_device *libinput_device,
int *width,
int *height,
void *user_data)
{
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);

*width = device->output->current_mode->width;
*height = device->output->current_mode->height;
}

static int
open_restricted(const char *path, int flags, void *user_data)
{
Expand All @@ -204,8 +191,6 @@ close_restricted(int fd, void *user_data)
const struct libinput_interface libinput_interface = {
open_restricted,
close_restricted,

get_current_screen_dimensions,
};

int
Expand Down

0 comments on commit 9230416

Please sign in to comment.