Commit 642569fc authored by Peter Hutterer's avatar Peter Hutterer
Browse files

Replace a few BUG_WARN with BUG_RETURN_VAL


Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: default avatarChase Douglas <chase.douglas@canonical.com>
parent 11ecfb88
......@@ -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;
......
......@@ -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) ||
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment