2009-02-18 22:15:20 +00:00
|
|
|
commit b80f653bf33ed0ec23223a9877068cba97850ed1
|
|
|
|
Author: Lars-Peter Clausen <lars@metafoo.de>
|
|
|
|
Date: Wed Feb 18 23:08:14 2009 +0100
|
|
|
|
|
|
|
|
Transform touchscreen coordinates according to randr rotation.
|
|
|
|
|
|
|
|
diff --git a/src/tslib.c b/src/tslib.c
|
|
|
|
index 3eba078..6091006 100644
|
|
|
|
--- a/src/tslib.c
|
|
|
|
+++ b/src/tslib.c
|
|
|
|
@@ -48,6 +48,7 @@
|
|
|
|
#include <exevents.h> /* Needed for InitValuator/Proximity stuff */
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
#include <mipointer.h>
|
|
|
|
+#include <randrstr.h>
|
|
|
|
|
|
|
|
#include <tslib.h>
|
|
|
|
|
|
|
|
@@ -128,6 +129,8 @@ static void ReadInput (LocalDevicePtr local)
|
|
|
|
struct ts_sample samp;
|
|
|
|
int ret;
|
|
|
|
int x,y;
|
|
|
|
+ ScrnInfoPtr pScrn = xf86Screens[priv->screen_num];
|
2009-04-12 23:58:03 +00:00
|
|
|
+ Rotation rotation = rrGetScrPriv (pScrn->pScreen) ? RRGetRotation(pScrn->pScreen) : RR_Rotate_0;
|
2009-02-18 22:15:20 +00:00
|
|
|
|
|
|
|
ret = ts_read(priv->ts, &samp, 1);
|
|
|
|
|
|
|
|
@@ -154,6 +157,23 @@ static void ReadInput (LocalDevicePtr local)
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ tmp_x = samp.x;
|
|
|
|
+
|
|
|
|
+ switch(rotation) {
|
|
|
|
+ case RR_Rotate_90:
|
|
|
|
+ samp.x = (priv->height - samp.y - 1) * priv->width / priv->height;
|
|
|
|
+ samp.y = tmp_x * priv->height / priv->width;
|
|
|
|
+ break;
|
|
|
|
+ case RR_Rotate_180:
|
|
|
|
+ samp.x = priv->width - samp.x - 1;
|
|
|
|
+ samp.y = priv->height - samp.y - 1;
|
|
|
|
+ break;
|
|
|
|
+ case RR_Rotate_270:
|
|
|
|
+ samp.x = samp.y * priv->width / priv->height;
|
|
|
|
+ samp.y = (priv->width - tmp_x - 1) * priv->height / priv->width;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
priv->lastx = samp.x;
|
|
|
|
priv->lasty = samp.y;
|
|
|
|
x = samp.x;
|