diff options
Diffstat (limited to 'xorg-server/dix/devices.c')
-rw-r--r-- | xorg-server/dix/devices.c | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 0df1d3834..c5c8daafe 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -116,8 +116,8 @@ DeviceSetTransform(DeviceIntPtr dev, float *transform_data) * Transform is the user supplied (affine) transform * InvScale scales coordinates back up into their native range */ - sx = dev->valuator->axes[0].max_value - dev->valuator->axes[0].min_value; - sy = dev->valuator->axes[1].max_value - dev->valuator->axes[1].min_value; + sx = dev->valuator->axes[0].max_value - dev->valuator->axes[0].min_value + 1; + sy = dev->valuator->axes[1].max_value - dev->valuator->axes[1].min_value + 1; /* invscale */ pixman_f_transform_init_scale(&scale, sx, sy); @@ -285,7 +285,6 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) dev->deviceGrab.grabTime = currentTime; dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab; dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab; - dev->deviceGrab.activeGrab = AllocGrab(); dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent)); XkbSetExtension(dev, ProcessKeyboardEvent); @@ -800,6 +799,7 @@ FreeDeviceClass(int type, pointer *class) free((*t)->touches[i].valuators); } + free((*t)->touches); free((*t)); break; } @@ -981,7 +981,8 @@ CloseDevice(DeviceIntPtr dev) } } - FreeGrab(dev->deviceGrab.activeGrab); + if (dev->deviceGrab.grab) + FreeGrab(dev->deviceGrab.grab); free(dev->deviceGrab.sync.event); free(dev->config_info); /* Allocated in xf86ActivateDevice. */ free(dev->last.scroll); @@ -1060,6 +1061,7 @@ CloseDownDevices(void) inputInfo.pointer = NULL; XkbDeleteRulesDflts(); + XkbDeleteRulesUsed(); OsReleaseSignals(); } @@ -1284,6 +1286,9 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom *labels, ButtonClassPtr butc; int i; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->button != NULL, FALSE); + butc = calloc(1, sizeof(ButtonClassRec)); if (!butc) return FALSE; @@ -1344,8 +1349,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels, int i; ValuatorClassPtr valc; - if (!dev) - return FALSE; + BUG_RETURN_VAL(dev == NULL, FALSE); if (numAxes > MAX_VALUATORS) { LogMessage(X_WARNING, @@ -1374,7 +1378,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels, valc->numMotionEvents = numMotionEvents; valc->motionHintWindow = NullWindow; - if (mode & OutOfProximity) + if ((mode & OutOfProximity) && !dev->proximity) InitProximityClassDeviceStruct(dev); dev->valuator = valc; @@ -1454,6 +1458,9 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev) { FocusClassPtr focc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->focus != NULL, FALSE); + focc = malloc(sizeof(FocusClassRec)); if (!focc) return FALSE; @@ -1473,6 +1480,9 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) { PtrFeedbackPtr feedc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->ptrfeed != NULL, FALSE); + feedc = malloc(sizeof(PtrFeedbackClassRec)); if (!feedc) return FALSE; @@ -1514,6 +1524,9 @@ InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev, int i; StringFeedbackPtr feedc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->stringfeed != NULL, FALSE); + feedc = malloc(sizeof(StringFeedbackClassRec)); if (!feedc) return FALSE; @@ -1548,6 +1561,9 @@ InitBellFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc, { BellFeedbackPtr feedc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->bell != NULL, FALSE); + feedc = malloc(sizeof(BellFeedbackClassRec)); if (!feedc) return FALSE; @@ -1567,6 +1583,9 @@ InitLedFeedbackClassDeviceStruct(DeviceIntPtr dev, LedCtrlProcPtr controlProc) { LedFeedbackPtr feedc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->leds != NULL, FALSE); + feedc = malloc(sizeof(LedFeedbackClassRec)); if (!feedc) return FALSE; @@ -1587,6 +1606,9 @@ InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev, { IntegerFeedbackPtr feedc; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->intfeed != NULL, FALSE); + feedc = malloc(sizeof(IntegerFeedbackClassRec)); if (!feedc) return FALSE; @@ -1607,6 +1629,11 @@ InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, { DeviceIntPtr dev = (DeviceIntPtr) device; + BUG_RETURN_VAL(dev == NULL, FALSE); + BUG_RETURN_VAL(dev->button != NULL, FALSE); + BUG_RETURN_VAL(dev->valuator != NULL, FALSE); + BUG_RETURN_VAL(dev->ptrfeed != NULL, FALSE); + return (InitButtonClassDeviceStruct(dev, numButtons, btn_labels, map) && InitValuatorClassDeviceStruct(dev, numAxes, axes_labels, numMotionEvents, Relative) && @@ -1627,14 +1654,13 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches, TouchClassPtr touch; int i; - if (device->touch || !device->valuator) - return FALSE; + BUG_RETURN_VAL(device == NULL, FALSE); + BUG_RETURN_VAL(device->touch != NULL, FALSE); + BUG_RETURN_VAL(device->valuator == NULL, FALSE); /* Check the mode is valid, and at least X and Y axes. */ - if (mode != XIDirectTouch && mode != XIDependentTouch) - return FALSE; - if (num_axes < 2) - return FALSE; + BUG_RETURN_VAL(mode != XIDirectTouch && mode != XIDependentTouch, FALSE); + BUG_RETURN_VAL(num_axes < 2, FALSE); if (num_axes > MAX_VALUATORS) { LogMessage(X_WARNING, @@ -2771,9 +2797,10 @@ AllocDevicePair(ClientPtr client, const char *name, keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE; /* The ClassesRec stores the device classes currently not used. */ - pointer->unused_classes = calloc(1, sizeof(ClassesRec)); - - keyboard->unused_classes = calloc(1, sizeof(ClassesRec)); + if (IsMaster(pointer)) { + pointer->unused_classes = calloc(1, sizeof(ClassesRec)); + keyboard->unused_classes = calloc(1, sizeof(ClassesRec)); + } *ptr = pointer; |