dix: Add device info to DeviceChangedEvent, and fill in CCCE.

We need to fill the info here, as the device may change until we get a chance
to process it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-02-24 15:27:07 +10:00
parent b2ba77bac4
commit 0befeb36c1
2 changed files with 45 additions and 6 deletions

View File

@ -158,6 +158,7 @@ CreateClassesChangedEvent(EventList* event,
DeviceIntPtr master,
DeviceIntPtr slave)
{
int i;
DeviceChangedEvent *dce;
CARD32 ms = GetTimeInMillis();
@ -175,11 +176,30 @@ CreateClassesChangedEvent(EventList* event,
dce->flags |= HAS_NEW_SLAVE;
dce->new_slaveid = slave->id;
/* FIXME: fill in new information about the device. We need to do this
* here to avoid race conditions if the device changes while the event
* slumbers in the EQ.
*/
if (slave->button)
{
dce->buttons.num_buttons = slave->button->numButtons;
for (i = 0; i < dce->buttons.num_buttons; i++)
dce->buttons.names[i] = 0; /* FIXME */
}
if (slave->valuator)
{
dce->num_valuators = slave->valuator->numAxes;
for (i = 0; i < dce->num_valuators; i++)
{
dce->valuators[i].min = slave->valuator->axes[i].min_value;
dce->valuators[i].max = slave->valuator->axes[i].max_value;
dce->valuators[i].resolution = slave->valuator->axes[i].resolution;
/* This should, eventually, be a per-axis mode */
dce->valuators[i].mode = slave->valuator->mode;
dce->valuators[i].name = 0; /* FIXME: */
}
}
if (slave->key)
{
dce->keys.min_keycode = slave->key->xkbInfo->desc->min_key_code;
dce->keys.max_keycode = slave->key->xkbInfo->desc->max_key_code;
}
}
/**

View File

@ -128,7 +128,26 @@ typedef struct
/** If flags & HAS_OLD_SLAVE is set, old_slaveid specifies device now
* attached to this device. */
int new_slaveid;
/* FIXME: add the new capabilities here */
struct {
int num_buttons; /**< Number of buttons */
Atom names[MAX_BUTTONS];/**< Button names */
} buttons;
int num_valuators; /**< Number of axes */
struct {
uint32_t min; /**< Minimum value */
uint32_t max; /**< Maximum value */
/* FIXME: frac parts of min/max */
uint32_t resolution; /**< Resolution counts/m */
uint8_t mode; /**< Relative or Absolute */
Atom name; /**< Axis name */
} valuators[MAX_VALUATORS];
struct {
int min_keycode;
int max_keycode;
} keys;
} DeviceChangedEvent;
#if XFreeXDGA