Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
#include "input/cursor.h"
#include "input/tablet.h"
+static void
+adjust_for_rotation(enum rotation rotation, double *x, double *y)
+{
+ double tmp;
+ switch (rotation) {
+ case LAB_ROTATE_NONE:
+ break;
+ case LAB_ROTATE_90:
+ tmp = *x;
+ *x = 1.0 - *y;
+ *y = tmp;
+ break;
+ case LAB_ROTATE_180:
+ *x = 1.0 - *x;
+ *y = 1.0 - *y;
+ break;
+ case LAB_ROTATE_270:
+ tmp = *x;
+ *x = *y;
+ *y = 1.0 - tmp;
+ break;
+ }
+}
+
static void
handle_axis(struct wl_listener *listener, void *data)
{
double x = tablet->x;
double y = tablet->y;
+ adjust_for_rotation(rc.tablet.rotation, &x, &y);
cursor_emulate_move_absolute(tablet->seat, &ev->tablet->base, x, y, ev->time_msec);
}
// Ignore other events