xephyr: fix keymap, pointer; dix: fix multiple axes
Initialise our axes properly in the DIX, and make sure we don't unnecessarily clip maxval when it's not set. Fix keymap copying in Xephyr (to some degree: it's still broken), and set nAxes and nButtons properly.
This commit is contained in:
parent
f18c3122a5
commit
7711c56d2e
|
@ -815,6 +815,9 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
||||||
int i;
|
int i;
|
||||||
register ValuatorClassPtr valc;
|
register ValuatorClassPtr valc;
|
||||||
|
|
||||||
|
if (!dev)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
valc = (ValuatorClassPtr)xalloc(sizeof(ValuatorClassRec) +
|
valc = (ValuatorClassPtr)xalloc(sizeof(ValuatorClassRec) +
|
||||||
numAxes * sizeof(AxisInfo) +
|
numAxes * sizeof(AxisInfo) +
|
||||||
numAxes * sizeof(unsigned int));
|
numAxes * sizeof(unsigned int));
|
||||||
|
@ -827,13 +830,15 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
||||||
valc->mode = mode;
|
valc->mode = mode;
|
||||||
valc->axes = (AxisInfoPtr)(valc + 1);
|
valc->axes = (AxisInfoPtr)(valc + 1);
|
||||||
valc->axisVal = (int *)(valc->axes + numAxes);
|
valc->axisVal = (int *)(valc->axes + numAxes);
|
||||||
for (i=0; i<numAxes; i++)
|
|
||||||
valc->axisVal[i]=0;
|
|
||||||
valc->lastx = 0;
|
valc->lastx = 0;
|
||||||
valc->lasty = 0;
|
valc->lasty = 0;
|
||||||
valc->dxremaind = 0;
|
valc->dxremaind = 0;
|
||||||
valc->dyremaind = 0;
|
valc->dyremaind = 0;
|
||||||
dev->valuator = valc;
|
dev->valuator = valc;
|
||||||
|
for (i=0; i<numAxes; i++) {
|
||||||
|
InitValuatorAxisStruct(dev, i, 0, -1, 0, 0, 0);
|
||||||
|
valc->axisVal[i]=0;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4953,12 +4953,12 @@ GetPointerEvents(xEvent **xE, DeviceIntPtr pDev, int type, int buttons,
|
||||||
axes = pDev->valuator->axes;
|
axes = pDev->valuator->axes;
|
||||||
if (kbp->root_x < axes->min_value)
|
if (kbp->root_x < axes->min_value)
|
||||||
kbp->root_x = axes->min_value;
|
kbp->root_x = axes->min_value;
|
||||||
if (kbp->root_x > axes->max_value)
|
if (axes->max_value > 0 && kbp->root_x > axes->max_value)
|
||||||
kbp->root_x = axes->max_value;
|
kbp->root_x = axes->max_value;
|
||||||
axes++;
|
axes++;
|
||||||
if (kbp->root_y < axes->min_value)
|
if (kbp->root_y < axes->min_value)
|
||||||
kbp->root_y = axes->min_value;
|
kbp->root_y = axes->min_value;
|
||||||
if (kbp->root_y > axes->max_value)
|
if (axes->max_value > 0 && kbp->root_y > axes->max_value)
|
||||||
kbp->root_y = axes->max_value;
|
kbp->root_y = axes->max_value;
|
||||||
|
|
||||||
if (pDev->coreEvents) {
|
if (pDev->coreEvents) {
|
||||||
|
|
|
@ -863,10 +863,10 @@ MouseInit (KdPointerInfo *pi)
|
||||||
pi->driverPrivate = (EphyrPointerPrivate *)
|
pi->driverPrivate = (EphyrPointerPrivate *)
|
||||||
xcalloc(sizeof(EphyrPointerPrivate), 1);
|
xcalloc(sizeof(EphyrPointerPrivate), 1);
|
||||||
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
|
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
|
||||||
|
pi->nAxes = 3;
|
||||||
|
pi->nButtons = 32;
|
||||||
ephyrMouse = pi;
|
ephyrMouse = pi;
|
||||||
/* FIXME DO NOT COMMIT */
|
|
||||||
KdAddPointerDriver(&EphyrMouseDriver);
|
KdAddPointerDriver(&EphyrMouseDriver);
|
||||||
ErrorF("SUCCESS!\n");
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,7 +874,6 @@ static Status
|
||||||
MouseEnable (KdPointerInfo *pi)
|
MouseEnable (KdPointerInfo *pi)
|
||||||
{
|
{
|
||||||
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
|
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
|
||||||
ErrorF("SUCCESS ENABLE!\n");
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -675,13 +675,6 @@ hostx_load_keymap(void)
|
||||||
max_keycode - min_keycode + 1,
|
max_keycode - min_keycode + 1,
|
||||||
&host_width);
|
&host_width);
|
||||||
|
|
||||||
|
|
||||||
ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
|
|
||||||
(max_keycode - min_keycode + 1) *
|
|
||||||
width);
|
|
||||||
if (!ephyrKeySyms.map)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Try and copy the hosts keymap into our keymap to avoid loads
|
/* Try and copy the hosts keymap into our keymap to avoid loads
|
||||||
* of messing around.
|
* of messing around.
|
||||||
*
|
*
|
||||||
|
@ -690,15 +683,21 @@ hostx_load_keymap(void)
|
||||||
*/
|
*/
|
||||||
width = (host_width > 4) ? 4 : host_width;
|
width = (host_width > 4) ? 4 : host_width;
|
||||||
|
|
||||||
|
ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
|
||||||
|
(max_keycode - min_keycode + 1) *
|
||||||
|
width);
|
||||||
|
if (!ephyrKeySyms.map)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i=0; i<(max_keycode - min_keycode+1); i++)
|
for (i=0; i<(max_keycode - min_keycode+1); i++)
|
||||||
for (j=0; j<width; j++)
|
for (j=0; j<width; j++)
|
||||||
kdKeymap[ (i*width)+j ] = keymap[ (i*host_width) + j ];
|
ephyrKeySyms.map[(i*width)+j] = keymap[(i*host_width) + j];
|
||||||
|
|
||||||
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
|
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
|
||||||
|
|
||||||
ephyrKeySyms.minKeyCode = min_keycode;
|
ephyrKeySyms.minKeyCode = min_keycode;
|
||||||
ephyrKeySyms.maxKeyCode = max_keycode;
|
ephyrKeySyms.maxKeyCode = max_keycode;
|
||||||
ephyrKeySyms.mapWidth = (width > 4) ? 4 : width;
|
ephyrKeySyms.mapWidth = width;
|
||||||
|
|
||||||
XFree(keymap);
|
XFree(keymap);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue