Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | diff --git a/src/multitouch.c b/src/multitouch.c |
| 2 | index c55d742..4a8192d 100644 |
| 3 | --- a/src/multitouch.c |
| 4 | +++ b/src/multitouch.c |
| 5 | @@ -114,7 +114,7 @@ static int init_properties(DeviceIntPtr dev) |
| 6 | return Success; |
| 7 | } |
| 8 | |
| 9 | -static int device_init(DeviceIntPtr dev, LocalDevicePtr local) |
| 10 | +static int device_init(DeviceIntPtr dev, InputInfoPtr local) |
| 11 | { |
| 12 | struct mtev_mtouch *mt = local->private; |
| 13 | Atom atom; |
| 14 | @@ -222,7 +222,7 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local) |
| 15 | xf86InitValuatorAxisStruct(dev, val, axes_labels[val], |
| 16 | min, |
| 17 | max, |
| 18 | - 1, 0, 1); |
| 19 | + 1, 0, 1,Absolute); |
| 20 | xf86InitValuatorDefaults(dev, val); |
| 21 | } |
| 22 | } |
| 23 | @@ -232,7 +232,7 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local) |
| 24 | return Success; |
| 25 | } |
| 26 | |
| 27 | -static int device_on(LocalDevicePtr local) |
| 28 | +static int device_on(InputInfoPtr local) |
| 29 | { |
| 30 | struct mtev_mtouch *mt = local->private; |
| 31 | local->fd = xf86OpenSerial(local->options); |
| 32 | @@ -248,7 +248,7 @@ static int device_on(LocalDevicePtr local) |
| 33 | return Success; |
| 34 | } |
| 35 | |
| 36 | -static int device_off(LocalDevicePtr local) |
| 37 | +static int device_off(InputInfoPtr local) |
| 38 | { |
| 39 | struct mtev_mtouch *mt = local->private; |
| 40 | xf86RemoveEnabledDevice(local); |
| 41 | @@ -259,12 +259,12 @@ static int device_off(LocalDevicePtr local) |
| 42 | return Success; |
| 43 | } |
| 44 | |
| 45 | -static int device_close(LocalDevicePtr local) |
| 46 | +static int device_close(InputInfoPtr local) |
| 47 | { |
| 48 | return Success; |
| 49 | } |
| 50 | |
| 51 | -static void process_state(LocalDevicePtr local, |
| 52 | +static void process_state(InputInfoPtr local, |
| 53 | const struct mtev_mtouch *mt) |
| 54 | { |
| 55 | |
| 56 | @@ -321,22 +321,22 @@ static void process_state(LocalDevicePtr local, |
| 57 | } |
| 58 | |
| 59 | /* Some x-clients assume they get motion events before button down */ |
| 60 | + xf86Msg(X_INFO,"down %d|pdown %d\n", down, pdown); |
| 61 | if (down) |
| 62 | xf86PostMotionEventP(local->dev, TRUE, |
| 63 | 0, down * MT_AXIS_PER_FINGER, valuators); |
| 64 | - |
| 65 | if(down && pdown == 0) |
| 66 | xf86PostButtonEventP(local->dev, TRUE, |
| 67 | 1, 1, |
| 68 | 0, down * MT_AXIS_PER_FINGER, valuators); |
| 69 | - else if (down == 0 && pdown) |
| 70 | - xf86PostButtonEvent(local->dev, TRUE, 1, 0, 0, 0); |
| 71 | - |
| 72 | + else if (down == 0 && pdown){ |
| 73 | + xf86PostButtonEvent(local->dev, TRUE, 1, 1, 0, 0); |
| 74 | + } |
| 75 | pdown = !!down; |
| 76 | } |
| 77 | |
| 78 | /* called for each full received packet from the touchpad */ |
| 79 | -static void read_input(LocalDevicePtr local) |
| 80 | +static void read_input(InputInfoPtr local) |
| 81 | { |
| 82 | struct mtev_mtouch *mt = local->private; |
| 83 | while (mtouch_read_synchronized_event(mt, local->fd)) { |
| 84 | @@ -346,7 +346,7 @@ static void read_input(LocalDevicePtr local) |
| 85 | |
| 86 | static Bool device_control(DeviceIntPtr dev, int mode) |
| 87 | { |
| 88 | - LocalDevicePtr local = dev->public.devicePrivate; |
| 89 | + InputInfoPtr local = dev->public.devicePrivate; |
| 90 | switch (mode) { |
| 91 | case DEVICE_INIT: |
| 92 | xf86Msg(X_INFO, "device control: init\n"); |
| 93 | @@ -366,39 +366,29 @@ static Bool device_control(DeviceIntPtr dev, int mode) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | -static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags) |
| 98 | +static InputInfoPtr preinit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) |
| 99 | { |
| 100 | struct mtev_mtouch *mt; |
| 101 | - InputInfoPtr local = xf86AllocateInput(drv, 0); |
| 102 | - if (!local) |
| 103 | - goto error; |
| 104 | + int rc; |
| 105 | + |
| 106 | mt = calloc(1, sizeof(struct mtev_mtouch)); |
| 107 | + |
| 108 | if (!mt) |
| 109 | goto error; |
| 110 | |
| 111 | - local->name = dev->identifier; |
| 112 | - local->type_name = XI_TOUCHSCREEN; |
| 113 | - local->device_control = device_control; |
| 114 | - local->read_input = read_input; |
| 115 | - local->private = mt; |
| 116 | - local->flags = XI86_POINTER_CAPABLE | |
| 117 | - XI86_SEND_DRAG_EVENTS; |
| 118 | - |
| 119 | - local->conf_idev = dev; |
| 120 | - |
| 121 | - xf86CollectInputOptions(local, NULL, NULL); |
| 122 | - //xf86OptionListReport(local->options); |
| 123 | - xf86ProcessCommonOptions(local, local->options); |
| 124 | + pInfo->private = mt; |
| 125 | + pInfo->type_name = "UNKNOWN"; |
| 126 | + pInfo->device_control = device_control; |
| 127 | + pInfo->read_input = read_input; |
| 128 | |
| 129 | + mt->swap_xy = xf86SetBoolOption(pInfo->options, "SwapAxes", FALSE); |
| 130 | + mt->invert_x = xf86SetBoolOption(pInfo->options, "InvertX", FALSE); |
| 131 | + mt->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE); |
| 132 | |
| 133 | - mt->swap_xy = xf86SetBoolOption(local->options, "SwapAxes", FALSE); |
| 134 | - mt->invert_x = xf86SetBoolOption(local->options, "InvertX", FALSE); |
| 135 | - mt->invert_y = xf86SetBoolOption(local->options, "InvertY", FALSE); |
| 136 | - |
| 137 | - local->flags |= XI86_CONFIGURED; |
| 138 | + return Success; |
| 139 | |
| 140 | error: |
| 141 | - return local; |
| 142 | + return !Success; |
| 143 | } |
| 144 | |
| 145 | static void uninit(InputDriverPtr drv, InputInfoPtr local, int flags) |
| 146 | @@ -415,7 +405,6 @@ static InputDriverRec MTEV = { |
| 147 | .PreInit = preinit, |
| 148 | .UnInit = uninit, |
| 149 | .module = NULL, |
| 150 | - .refCount = 0 |
| 151 | }; |
| 152 | |
| 153 | static XF86ModuleVersionInfo VERSION = { |