From e0cdfff70e8ec31e400d7742ad90acd4648b5588 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 1 Oct 2016 15:50:07 -0400 Subject: hacky system() based touch screen rotation --- autorotate.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'autorotate.c') diff --git a/autorotate.c b/autorotate.c index 4a80ce8..0a7b403 100644 --- a/autorotate.c +++ b/autorotate.c @@ -17,6 +17,7 @@ #define ACPI_ROTATELOCK "ibm/hotkey LEN0068:00 00000080 00006020\n" #define FIXME_HARDCODED_DEV_NUMBER 4 +#define TOUCH_DEVICE "SYNAPTICS Synaptics Touch Digitizer V04" #define GRAVITY_CUTOFF (7.0) #define DEV_PATH "/sys/bus/iio/devices/iio:device%d" @@ -43,6 +44,19 @@ void rotatescreen(enum rotation r) XRRSetScreenConfig(dpy, xsc, root, 0, xr[r], CurrentTime); } +void rotatetouch(enum rotation r) +{ + char *matrix[] = { + "1 0 0 0 1 0 0 0 1", + "-1 0 1 0 -1 1 0 0 1", + "0 -1 1 1 0 0 0 0 1", + "0 1 0 -1 0 1 0 0 1", + }; + char cmd[256]; + sprintf(cmd, "xinput set-float-prop '%s' 'Coordinate Transformation Matrix' %s", TOUCH_DEVICE, matrix[r]); + system(cmd); +} + enum rotation setrotation(enum rotation r) { static enum rotation prev = NORMAL; @@ -51,6 +65,8 @@ enum rotation setrotation(enum rotation r) } rotatescreen(r); + sleep(1); + rotatetouch(r); prev = r; return r; @@ -89,7 +105,11 @@ void checkacpi(int acpi) nrotate++; if (nrotate == 1) { tabletmode = 1; + /* disable touchpad */ + /* disable trackpoint */ } else if (nrotate == 3) { + /* enable touchpad */ + /* enable trackpoint */ setrotation(NORMAL); tabletmode = 0; nrotate = 0; -- cgit v1.2.1