mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-21 20:26:45 +00:00
Xi: fix valuator alignment in DeepCopyDeviceClasses (#36119)
commit 678f5396c9 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>
This commit is contained in:
parent
7762de65e1
commit
419a27b521
5 changed files with 70 additions and 19 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue