diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-12 10:17:07 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-04-18 13:04:19 +1000 |
commit | 419a27b5219a739f2fbd50cc96a1b54c469e4a88 (patch) | |
tree | 34eafb211d89f17862f3aacfb1f4daa7509efdec /Xi | |
parent | 7762de65e153790ee9f63903964d168a6680d815 (diff) |
Xi: fix valuator alignment in DeepCopyDeviceClasses (#36119)
commit 678f5396c91b3d0c7572ed579b0a4fb62b2b4655 only fixed the
initialization, not the copy. After a slave device change, the valuator
were out of alignment again.
X.Org Bug 36119 <http://bugs.freedesktop.org/show_bug.cgi?id=36119>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/exevents.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 18803c95e..76d5c3759 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -535,6 +535,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) if (from->valuator) { ValuatorClassPtr v; + if (!to->valuator) { classes = to->unused_classes; @@ -543,18 +544,14 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) classes->valuator = NULL; } - to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) + - from->valuator->numAxes * sizeof(AxisInfo) + - from->valuator->numAxes * sizeof(double)); - v = to->valuator; + v = AllocValuatorClass(to->valuator, from->valuator->numAxes); + if (!v) FatalError("[Xi] no memory for class shift.\n"); - v->numAxes = from->valuator->numAxes; - v->axes = (AxisInfoPtr)&v[1]; + to->valuator = v; memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo)); - v->axisVal = (double*)(v->axes + from->valuator->numAxes); v->sourceid = from->id; } else if (to->valuator && !from->valuator) { |