summaryrefslogtreecommitdiff
path: root/driver/xf86-input-ws/src/ws.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-12-10 22:32:03 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-12-10 22:32:03 +0000
commit64c662255856aa17131b9636da872a43cbfa3f19 (patch)
tree732d609c9a5d144078d8f901df5ceb6366e1de89 /driver/xf86-input-ws/src/ws.c
parentf472b6c78f3f4830282f0a50d2f26af97702718e (diff)
Fix SwapXY and rotation support.
More work to do wrt properties and calibration.
Diffstat (limited to 'driver/xf86-input-ws/src/ws.c')
-rw-r--r--driver/xf86-input-ws/src/ws.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/driver/xf86-input-ws/src/ws.c b/driver/xf86-input-ws/src/ws.c
index f9231ac96..ef005c2d4 100644
--- a/driver/xf86-input-ws/src/ws.c
+++ b/driver/xf86-input-ws/src/ws.c
@@ -13,7 +13,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $OpenBSD: ws.c,v 1.27 2009/12/06 10:32:31 matthieu Exp $ */
+/* $OpenBSD: ws.c,v 1.28 2009/12/10 22:32:02 matthieu Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -418,6 +418,15 @@ wsDeviceInit(DeviceIntPtr pWS)
ymax = -1;
}
+ if (priv->swap_axes) {
+ int tmp;
+ tmp = xmin;
+ xmin = ymin;
+ ymin = tmp;
+ tmp = xmax;
+ xmax = ymax;
+ ymax = tmp;
+ }
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
if ((priv->type == WSMOUSE_TYPE_TPANEL)) {
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
@@ -455,6 +464,7 @@ wsDeviceInit(DeviceIntPtr pWS)
#endif
ymin, ymax, 1, 0, 1);
xf86InitValuatorDefaults(pWS, 1);
+
xf86MotionHistoryAllocate(pInfo);
AssignTypeAndName(pWS, pInfo->atom, pInfo->name);
pWS->public.on = FALSE;
@@ -594,11 +604,11 @@ wsReadInput(InputInfoPtr pInfo)
break;
case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
DBG(4, ErrorF("Absolute X %d\n", event->value));
- if (event->value != 4095) {
- ax = event->value;
- if (priv->inv_x)
- ax = priv->max_x - ax + priv->min_x;
- }
+ if (event->value == 4095)
+ break;
+ ax = event->value;
+ if (priv->inv_x)
+ ax = priv->max_x - ax + priv->min_x;
break;
case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
DBG(4, ErrorF("Absolute Y %d\n", event->value));
@@ -678,6 +688,13 @@ wsReadInput(InputInfoPtr pInfo)
buttons &= ~zbutton;
wsSendButtons(pInfo, buttons);
}
+ if (priv->swap_axes) {
+ int tmp;
+
+ tmp = ax;
+ ax = ay;
+ ay = tmp;
+ }
if (ax) {
/* absolute position event */
DBG(3, ErrorF("postMotionEvent X %d\n", ax));
@@ -842,10 +859,17 @@ wsSetProperty(DeviceIntPtr device, Atom atom, XIPropertyValuePtr val,
need_update++;
}
/* Update axes descriptors */
- ax->min_value = priv->min_x;
- ax->max_value = priv->max_x;
- ay->min_value = priv->min_y;
- ay->max_value = priv->max_y;
+ if (!priv->swap_axes) {
+ ax->min_value = priv->min_x;
+ ax->max_value = priv->max_x;
+ ay->min_value = priv->min_y;
+ ay->max_value = priv->max_y;
+ } else {
+ ax->min_value = priv->min_y;
+ ax->max_value = priv->max_y;
+ ay->min_value = priv->min_x;
+ ay->max_value = priv->max_x;
+ }
}
} else if (atom == prop_swap) {
if (val->format != 8 || val->type != XA_INTEGER ||