diff options
-rw-r--r-- | Xi/exevents.c | 25 | ||||
-rw-r--r-- | dix/getevents.c | 5 | ||||
-rw-r--r-- | dix/touch.c | 17 |
3 files changed, 17 insertions, 30 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 4aad52734..e99bf6c20 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -926,10 +926,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event) else if (event->type == ET_ProximityOut) device->proximity->in_proximity = FALSE; else if (event->type == ET_TouchBegin) { - BUG_WARN(!b || !v); - BUG_WARN(!t); + BUG_RETURN_VAL(!b || !v, DONT_PROCESS); + BUG_RETURN_VAL(!t, DONT_PROCESS); - if (!b || !t || !b->map[key]) + if (!b->map[key]) return DONT_PROCESS; if (!(event->flags & TOUCH_POINTER_EMULATED) || @@ -941,10 +941,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event) UpdateDeviceMotionMask(device, t->state, DeviceButtonMotionMask); } else if (event->type == ET_TouchEnd) { - BUG_WARN(!b || !v); - BUG_WARN(!t); + BUG_RETURN_VAL(!b || !v, DONT_PROCESS); + BUG_RETURN_VAL(!t, DONT_PROCESS); - if (!b || !t || t->buttonsDown <= 0 || !b->map[key]) + if (t->buttonsDown <= 0 || !b->map[key]) return DONT_PROCESS; if (!(event->flags & TOUCH_POINTER_EMULATED)) @@ -1356,9 +1356,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, wOtherInputMasks(*win)->inputClients, next) if (xi2mask_isset(iclients->xi2mask, dev, evtype)) break; - BUG_WARN(!iclients); - if (!iclients) - return FALSE; + + BUG_RETURN_VAL(!iclients, FALSE); *mask = iclients->xi2mask; *client = rClient(iclients); @@ -1371,9 +1370,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, wOtherInputMasks(*win)->inputClients, next) if (iclients->mask[dev->id] & xi_filter) break; - BUG_WARN(!iclients); - if (!iclients) - return FALSE; + BUG_RETURN_VAL(!iclients, FALSE); *client = rClient(iclients); } @@ -1414,9 +1411,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, return Success; nevents = TouchConvertToPointerEvent(ev, &motion, &button); - BUG_WARN(nevents == 0); - if (nevents == 0) - return BadValue; + BUG_RETURN_VAL(nevents == 0, BadValue); if (nevents > 1) ptrev = &button; diff --git a/dix/getevents.c b/dix/getevents.c index 4fbaa6c94..baa26c4b8 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1821,10 +1821,7 @@ GetTouchEvents(InternalEvent *events, DeviceIntPtr dev, uint32_t ddx_touchid, if (flags & TOUCH_CLIENT_ID) { /* A DIX-submitted TouchEnd */ touchpoint.dix_ti = TouchFindByClientID(dev, ddx_touchid); - BUG_WARN(!touchpoint.dix_ti); - - if (!touchpoint.dix_ti) - return 0; + BUG_RETURN_VAL(!touchpoint.dix_ti, 0); if (!mask_in || !valuator_mask_isset(mask_in, 0) || diff --git a/dix/touch.c b/dix/touch.c index 401cb981a..082e8f603 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -598,8 +598,8 @@ TouchConvertToPointerEvent(const InternalEvent *event, int ptrtype; int nevents = 0; - BUG_WARN(!event); - BUG_WARN(!motion_event); + BUG_RETURN_VAL(!event, 0); + BUG_RETURN_VAL(!motion_event, 0); switch (event->any.type) { case ET_TouchUpdate: @@ -627,7 +627,7 @@ TouchConvertToPointerEvent(const InternalEvent *event, motion_event->device_event.flags = XIPointerEmulated; if (nevents > 1) { - BUG_WARN(!button_event); + BUG_RETURN_VAL(!button_event, 0); *button_event = *event; button_event->any.type = ptrtype; button_event->device_event.flags = XIPointerEmulated; @@ -966,10 +966,8 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener, int nev; int i; - BUG_WARN(listener < 0); - BUG_WARN(listener >= ti->num_listeners); - if (listener < 0 || listener >= ti->num_listeners) - return BadMatch; + BUG_RETURN_VAL(listener < 0, BadMatch); + BUG_RETURN_VAL(listener >= ti->num_listeners, BadMatch); if (listener > 0) { if (mode == XIRejectTouch) @@ -981,10 +979,7 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener, } events = InitEventList(GetMaximumEventsNum()); - if (!events) { - BUG_WARN_MSG(TRUE, "Failed to allocate touch ownership events\n"); - return BadAlloc; - } + BUG_RETURN_VAL_MSG(!events, BadAlloc, "Failed to allocate touch ownership events\n"); nev = GetTouchOwnershipEvents(events, dev, ti, mode, ti->listeners[0].listener, 0); |