Module Name:    xsrc
Committed By:   bouyer
Date:           Sun Jan 12 13:37:07 UTC 2014

Modified Files:
        xsrc/external/mit/xf86-input-elographics/dist/src [netbsd-6]: xf86Elo.c

Log Message:
Pull up following revision(s) (requested by mbalmer in ticket #1012):
        external/mit/xf86-input-elographics/dist/src/xf86Elo.c: revision 1.5
Add support for inverted axis, from upstream repository.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 \
    xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c
diff -u xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.2 xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.2.2.1
--- xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c:1.2	Sat Jul 23 21:56:54 2011
+++ xsrc/external/mit/xf86-input-elographics/dist/src/xf86Elo.c	Sun Jan 12 13:37:07 2014
@@ -360,6 +360,22 @@ xf86EloReadInput(InputInfoPtr	pInfo)
           cur_y = WORD_ASSEMBLY(priv->packet_buf[5], priv->packet_buf[6]);
           state = priv->packet_buf[2] & 0x07;
 
+          DBG(5, ErrorF("ELO got: x(%d), y(%d), %s\n",
+                      cur_x, cur_y,
+                      (state == ELO_PRESS) ? "Press" :
+			((state == ELO_RELEASE) ? "Release" : "Stream")));
+
+          if (priv->min_y > priv->max_y) {
+            /* inverted y axis */
+            cur_y = priv->max_y - cur_y + priv->min_y;
+          }
+
+          if (priv->min_x > priv->max_x) {
+            /* inverted x axis */
+            cur_x = priv->max_x - cur_x + priv->min_x;
+          }
+
+
           /*
            * Send events.
            *
@@ -676,6 +692,7 @@ xf86EloControl(DeviceIntPtr	dev,
   unsigned char		reply[ELO_PACKET_SIZE];
   Atom btn_label;
   Atom axis_labels[2] = { 0, 0 };
+  int x0, x1, y0, y1;
 
   switch(mode) {
 
@@ -719,10 +736,20 @@ xf86EloControl(DeviceIntPtr	dev,
 	return !Success;
       }
       else {
+
+	/* Correct the coordinates for possibly inverted axis.
+	   Leave priv->variables untouched so we can check for
+	   inversion on incoming events.
+	 */
+	y0 = min(priv->min_y, priv->max_y);
+	y1 = max(priv->min_y, priv->max_y);
+	x0 = min(priv->min_x, priv->max_x);
+	x1 = max(priv->min_x, priv->max_x);
+
 	/* I will map coordinates myself */
 	InitValuatorAxisStruct(dev, 0,
 			       axis_labels[0],
-			       -1, -1,
+			       x0, x1,
 			       9500,
 			       0     /* min_res */,
 			       9500  /* max_res */
@@ -732,7 +759,7 @@ xf86EloControl(DeviceIntPtr	dev,
 			       );
 	InitValuatorAxisStruct(dev, 1,
 			       axis_labels[1],
-			       -1, -1,
+			       y0, y1,
 			       10500,
 			       0     /* min_res */,
 			       10500 /* max_res */
@@ -854,6 +881,11 @@ xf86EloControl(DeviceIntPtr	dev,
     DBG(2, ErrorF("Done\n"));
     return Success;
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) * 100 + GET_ABI_MINOR(ABI_XINPUT_VERSION) >= 1901
+  case DEVICE_ABORT:
+    return Success;
+#endif
+
   default:
       ErrorF("unsupported mode=%d\n", mode);
       return !Success;

Reply via email to