summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-05-09 14:30:50 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-05-10 11:05:00 +1000
commit2f1aedcaed8fd99b823d451bf1fb02330c078f67 (patch)
tree37790a2d1d286791bbdc11f0e99fbf3305870531 /Xi
parent8a88b0ab52ba375ae84463a90503db88af10e368 (diff)
input: print warnings if drivers don't initialize properly
If drivers supply incorrect values don't just quietly return False, spew to the log so we can detect what's going on. All these cases are driver bugs and should be fixed immediately. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 7eb71ee83..30882570d 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -2023,6 +2023,9 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
{
ProximityClassPtr proxc;
+ BUG_RETURN_VAL(dev == NULL, FALSE);
+ BUG_RETURN_VAL(dev->proximity != NULL, FALSE);
+
proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
if (!proxc)
return FALSE;
@@ -2048,10 +2051,10 @@ InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
{
AxisInfoPtr ax;
- if (!dev || !dev->valuator || (minval > maxval && mode == Absolute))
- return FALSE;
- if (axnum >= dev->valuator->numAxes)
- return FALSE;
+ BUG_RETURN_VAL(dev == NULL, FALSE);
+ BUG_RETURN_VAL(dev->valuator == NULL, FALSE);
+ BUG_RETURN_VAL(axnum >= dev->valuator->numAxes, FALSE);
+ BUG_RETURN_VAL(minval > maxval && mode == Absolute, FALSE);
ax = dev->valuator->axes + axnum;
@@ -2081,8 +2084,9 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type,
InternalEvent dce;
DeviceIntPtr master;
- if (!dev || !dev->valuator || axnum >= dev->valuator->numAxes)
- return FALSE;
+ BUG_RETURN_VAL(dev == NULL, FALSE);
+ BUG_RETURN_VAL(dev->valuator == NULL, FALSE);
+ BUG_RETURN_VAL(axnum >= dev->valuator->numAxes, FALSE);
switch (type) {
case SCROLL_TYPE_VERTICAL: