Using the "maptooutput next" command fails on 64-bit systems,
with results ranging from always mapping the pointer to the
first head to displaying errors about the transformation matrix
being non-rectangular.

This is a result of the 'get_mapped_area' function expecting
32-bit properties returned by the server to take up only 4
bytes of memory. This is the case on 32-bit systems, but not
on 64-bit ones. This was partially addressed in bc5fd9e, but
not here.

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 tools/xsetwacom.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index f15b088..b9e8c0f 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -2194,9 +2194,10 @@ static Bool get_mapped_area(Display *dpy, XDevice *dev, 
int *width, int *height,
 {
        Atom matrix_prop = XInternAtom(dpy, "Coordinate Transformation Matrix", 
True);
        Atom type;
-       int format;
+       int format, i;
        unsigned long nitems, bytes_after;
-       float *data;
+       unsigned long *data;
+       float matrix[9];
        Bool matrix_is_valid = True;
 
        int display_width = DisplayWidth(dpy, DefaultScreen(dpy));
@@ -2221,17 +2222,22 @@ static Bool get_mapped_area(Display *dpy, XDevice *dev, 
int *width, int *height,
                return False;
        }
 
+       /* XI1 stores 32 bit properties (including float) as long,
+        * regardless of architecture */
+       for (i = 0; i < ARRAY_SIZE(matrix); i++)
+               matrix[i] = *(float*)(&data[i]);
+
        TRACE("Current transformation matrix:\n");
-       TRACE(" [ %f %f %f ]\n", data[0], data[1], data[2]);
-       TRACE(" [ %f %f %f ]\n", data[3], data[4], data[5]);
-       TRACE(" [ %f %f %f ]\n", data[6], data[7], data[8]);
-
-       *width  = rint(display_width  * data[0]);
-       *x_org  = rint(display_width  * data[2]);
-       *height = rint(display_height * data[4]);
-       *y_org  = rint(display_height * data[5]);
-       if ((data[1] != 0 || data[3] != 0 || data[6] != 0 || data[7] != 0) ||
-           (data[8] != 1)) {
+       TRACE(" [ %f %f %f ]\n", matrix[0], matrix[1], matrix[2]);
+       TRACE(" [ %f %f %f ]\n", matrix[3], matrix[4], matrix[5]);
+       TRACE(" [ %f %f %f ]\n", matrix[6], matrix[7], matrix[8]);
+
+       *width  = rint(display_width  * matrix[0]);
+       *x_org  = rint(display_width  * matrix[2]);
+       *height = rint(display_height * matrix[4]);
+       *y_org  = rint(display_height * matrix[5]);
+       if ((matrix[1] != 0 || matrix[3] != 0 || matrix[6] != 0 || matrix[7] != 
0) ||
+           (matrix[8] != 1)) {
                fprintf(stderr, "Non-rectangular transformation matrix 
detected.\n");
                matrix_is_valid = False;
        }
-- 
2.3.5


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to