diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-03 10:45:28 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-03 11:46:30 +1000 |
commit | 2bd5ea80652358565346071bed829070ddf5de85 (patch) | |
tree | 87b9cd73d56f2d4712194507a44c559756309479 /dix/eventconvert.c | |
parent | fc8cfc3a055d8af4ac809799c71f3db0d5246433 (diff) |
dix: rework event conversion before delivery.
Let EventToXI, EventToCore and EventToXI2 return BadMatch if there's no
matching event for this protocol spec.
Adjust the delivery paths to cope with BadMatch errors (and clean them up on
the way).
As a side-effect, this fixes server crashes on proximity events for a
grabbed device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r-- | dix/eventconvert.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 507289179..e104ce9bd 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -93,6 +93,8 @@ EventToCore(InternalEvent *event, xEvent *core) core->u.keyButtonPointer.state = e->corestate; } break; + case ET_Raw: + return BadMatch; default: /* XXX: */ ErrorF("[dix] EventToCore: Not implemented yet \n"); @@ -107,12 +109,16 @@ EventToCore(InternalEvent *event, xEvent *core) * count returns the number of events in xi. If count is 1, and the type of * xi is GenericEvent, then xi may be larger than 32 bytes. * - * If the event cannot be converted into an XI event because of protocol - * restrictions, count is 0 and Success is returned. + * Return values: + * Success ... core contains the matching core event. + * BadValue .. One or more values in the internal event are invalid. + * BadMatch .. The event has no XI equivalent. * * @param[in] ev The event to convert into an XI 1 event. * @param[out] xi Future memory location for the XI event. * @param[out] count Number of elements in xi. + * + * @return Success or the error code. */ int EventToXI(InternalEvent *ev, xEvent **xi, int *count) @@ -131,7 +137,7 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count) case ET_Raw: *count = 0; *xi = NULL; - return Success; + return BadMatch; } ErrorF("[dix] EventToXI: Not implemented for %d \n", ev->any.type); @@ -142,8 +148,10 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count) * Convert the given event to the respective XI 2.x event and store it in xi. * xi is allocated on demand and must be freed by the caller. * - * If the event cannot be converted into an XI event because of protocol - * restrictions, xi is NULL and Success is returned. + * Return values: + * Success ... core contains the matching core event. + * BadValue .. One or more values in the internal event are invalid. + * BadMatch .. The event has no XI2 equivalent. * * @param[in] ev The event to convert into an XI2 event * @param[out] xi Future memory location for the XI2 event. @@ -170,7 +178,7 @@ EventToXI2(InternalEvent *ev, xEvent **xi) case ET_ProximityIn: case ET_ProximityOut: *xi = NULL; - return Success; + return BadMatch; case ET_DeviceChanged: return eventToClassesChanged((DeviceChangedEvent*)ev, xi); case ET_Raw: |