From 1ef5c630eacaf137ab8cd050d817c35e0c6af798 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 18 Feb 2009 22:15:20 +0000 Subject: [PATCH] Transform touchscreen coordinates according to randr rotation. SVN-Revision: 14559 --- .../patches/015-add-randr-support.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Xorg/driver/xf86-input-tslib/patches/015-add-randr-support.patch diff --git a/Xorg/driver/xf86-input-tslib/patches/015-add-randr-support.patch b/Xorg/driver/xf86-input-tslib/patches/015-add-randr-support.patch new file mode 100644 index 0000000000..4ea7c7f2f1 --- /dev/null +++ b/Xorg/driver/xf86-input-tslib/patches/015-add-randr-support.patch @@ -0,0 +1,51 @@ +commit b80f653bf33ed0ec23223a9877068cba97850ed1 +Author: Lars-Peter Clausen +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 /* Needed for InitValuator/Proximity stuff */ + #include + #include ++#include + + #include + +@@ -128,6 +129,8 @@ static void ReadInput (LocalDevicePtr local) + struct ts_sample samp; + int ret; + int x,y; ++ ScrnInfoPtr pScrn = xf86Screens[priv->screen_num]; ++ Rotation rotation = RRGetRotation(pScrn->pScreen); + + 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; -- 2.30.2