summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2014-01-25 11:53:53 +0100
committerJonas Ådahl <jadahl@gmail.com>2014-02-03 23:39:58 +0100
commit1f1304041ca5cd5c99cdfc463a6b7c5105a63bf1 (patch)
tree01788c5433759a5295e009c5828d3526dc49583b /tools
parentb5f06f83299c51b015e4f047a080198607539f68 (diff)
downloadlibinput-1f1304041ca5cd5c99cdfc463a6b7c5105a63bf1.tar.gz
Replace output screen size callback with transform helpers
Instead of automatically transforming absolute coordinates of touch and pointer events to screen coordinates, the user now uses the corresponding transform helper function. This means the coordinates returned by libinput_event_pointer_get_absolute_x(), libinput_event_pointer_get_absolute_y(), libinput_touch_get_x() and libinput_touch_get_y() has changed from being in output screen coordinate space to being in device specific coordinate space. For example, where one before would call libinput_event_touch_get_x(event), one now calls libinput_event_touch_get_x_transformed(event, output_width). Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/event-debug.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 10246678..bbb358bb 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -44,6 +44,8 @@ static const char *device;
static const char *seat = "seat0";
static struct udev *udev;
uint32_t start_time;
+static const uint32_t screen_width = 100;
+static const uint32_t screen_height = 100;
static void
usage(void)
@@ -123,20 +125,9 @@ close_restricted(int fd, void *user_data)
close(fd);
}
-static void get_current_screen_dimensions(struct libinput_device *device,
- int *width,
- int *height,
- void *user_data)
-{
- /* display absdata in % of the screen */
- *width = 100;
- *height = 100;
-}
-
const static struct libinput_interface interface = {
.open_restricted = open_restricted,
.close_restricted = close_restricted,
- .get_current_screen_dimensions = get_current_screen_dimensions,
};
static int
@@ -257,8 +248,10 @@ static void
print_absmotion_event(struct libinput_event *ev)
{
struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev);
- li_fixed_t x = libinput_event_pointer_get_absolute_x(p),
- y = libinput_event_pointer_get_absolute_y(p);
+ li_fixed_t x = libinput_event_pointer_get_absolute_x_transformed(
+ p, screen_width);
+ li_fixed_t y = libinput_event_pointer_get_absolute_y_transformed(
+ p, screen_height);
print_event_time(libinput_event_pointer_get_time(p));
printf("%6.2f/%6.2f\n",
@@ -318,8 +311,8 @@ static void
print_touch_event(struct libinput_event *ev)
{
struct libinput_event_touch *t = libinput_event_get_touch_event(ev);
- li_fixed_t x = libinput_event_touch_get_x(t),
- y = libinput_event_touch_get_y(t);
+ li_fixed_t x = libinput_event_touch_get_x_transformed(t, screen_width),
+ y = libinput_event_touch_get_y_transformed(t, screen_height);
const char *type;
switch (libinput_event_touch_get_touch_type(t)) {