diff options
author | Jakob Kaivo <jakob@kaivo.net> | 2016-10-01 15:50:07 -0400 |
---|---|---|
committer | Jakob Kaivo <jakob@kaivo.net> | 2016-10-01 15:50:07 -0400 |
commit | e0cdfff70e8ec31e400d7742ad90acd4648b5588 (patch) | |
tree | 3bac12109af6d9b9d9dc5835c46ed96016a51011 /autorotate.c | |
parent | 9b8e9fab044c99eb3e93c52d0d0f64b1f0d85be0 (diff) |
hacky system() based touch screen rotation
Diffstat (limited to 'autorotate.c')
-rw-r--r-- | autorotate.c | 20 |
1 files changed, 20 insertions, 0 deletions
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; |