diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-11 16:27:40 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-08-17 13:25:35 +1000 |
commit | 2851f04cb2f6e5c30267f733d867c86d4e69a485 (patch) | |
tree | 561a48049c8767749c7f67133fee59d2501e0142 /dix | |
parent | c1d901d723c3bee523736eacc15b44a7dff484fe (diff) |
dix: rework DeviceChangedEvents a bit.
DCEs are now processed when sent throught the master device, not when sent
through the slave device. This includes a removal of some un-used (or partly
used) fields in the DCE itself to something more self-explanatory.
TODO: if a device has events queued and its attachment is changed, the DCE
is silently dropped now. Instead, it should be generated as soon as the
first event after the attachment is sent.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/eventconvert.c | 8 | ||||
-rw-r--r-- | dix/getevents.c | 12 |
2 files changed, 8 insertions, 12 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c index f0c98eadc..07a8e5fb9 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -350,7 +350,7 @@ appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo* info) info->type = XIKeyClass; info->num_keycodes = dce->keys.max_keycode - dce->keys.min_keycode + 1; info->length = sizeof(xXIKeyInfo)/4 + info->num_keycodes; - info->sourceid = dce->deviceid; + info->sourceid = dce->sourceid; kc = (uint32_t*)&info[1]; for (i = 0; i < info->num_keycodes; i++) @@ -371,7 +371,7 @@ appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info) info->num_buttons = dce->buttons.num_buttons; info->length = bytes_to_int32(sizeof(xXIButtonInfo)) + info->num_buttons + mask_len; - info->sourceid = dce->deviceid; + info->sourceid = dce->sourceid; bits = (unsigned char*)&info[1]; memset(bits, 0, mask_len * 4); @@ -399,7 +399,7 @@ appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumbe info->resolution = dce->valuators[axisnumber].resolution; info->number = axisnumber; info->mode = dce->valuators[axisnumber].mode; /* Server doesn't have per-axis mode yet */ - info->sourceid = dce->deviceid; + info->sourceid = dce->sourceid; return info->length * 4; } @@ -441,7 +441,7 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi) dcce->evtype = XI_DeviceChanged; dcce->time = dce->time; dcce->deviceid = dce->deviceid; - dcce->sourceid = dce->deviceid; + dcce->sourceid = dce->sourceid; dcce->reason = (dce->flags & DEVCHANGE_DEVICE_CHANGE) ? XIDeviceChange : XISlaveSwitch; dcce->num_classes = 0; dcce->length = bytes_to_int32(len - sizeof(xEvent)); diff --git a/dix/getevents.c b/dix/getevents.c index 5f0095430..2912c1e85 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -193,19 +193,15 @@ CreateClassesChangedEvent(EventList* event, dce = (DeviceChangedEvent*)event->event; memset(dce, 0, sizeof(DeviceChangedEvent)); - dce->deviceid = master->id; + dce->deviceid = slave->id; + dce->masterid = master->id; dce->header = ET_Internal; dce->length = sizeof(DeviceChangedEvent); dce->type = ET_DeviceChanged; dce->time = ms; dce->flags = type; - if (master->last.slave) - { - dce->flags |= DEVCHANGE_HAS_OLD_SLAVE; - dce->old_slaveid = master->last.slave->id; - } - dce->flags |= DEVCHANGE_HAS_NEW_SLAVE; - dce->new_slaveid = slave->id; + dce->flags |= DEVCHANGE_SLAVE_SWITCH; + dce->sourceid = slave->id; if (slave->button) { |