summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2008-11-08 14:46:26 +0100
committerHenrik Rydberg <rydberg@euromail.se>2008-11-08 14:46:26 +0100
commit92b22ac5f7b960815fd01db09406017ddccd7bd7 (patch)
tree9f04f10359f515a20908da96abb5a65f5eea1a9e /src
parentf86df7302a5e701108c27bfb4707565fdfdd2b0e (diff)
did not work, confused with missing library function.
Now it *does* work - go back and reduce to fit. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src')
-rw-r--r--src/multitouch.c70
1 files changed, 62 insertions, 8 deletions
diff --git a/src/multitouch.c b/src/multitouch.c
index d44e038..6271ce9 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -22,11 +22,13 @@
22 **************************************************************************/ 22 **************************************************************************/
23 23
24#include "mtouch.h" 24#include "mtouch.h"
25#include "mipointer.h"
25 26
26//////////////////////////////////////////////////////////////////////////// 27////////////////////////////////////////////////////////////////////////////
27 28
28static void pointer_control(DeviceIntPtr dev, PtrCtrl *ctrl) 29static void pointer_control(DeviceIntPtr dev, PtrCtrl *ctrl)
29{ 30{
31 xf86Msg(X_INFO, "pointer_control\n");
30} 32}
31 33
32static int pointer_property(DeviceIntPtr dev, 34static int pointer_property(DeviceIntPtr dev,
@@ -34,6 +36,7 @@ static int pointer_property(DeviceIntPtr dev,
34 XIPropertyValuePtr prop, 36 XIPropertyValuePtr prop,
35 BOOL checkonly) 37 BOOL checkonly)
36{ 38{
39 xf86Msg(X_INFO, "pointer_property\n");
37 return Success; 40 return Success;
38} 41}
39 42
@@ -42,7 +45,7 @@ static int pointer_property(DeviceIntPtr dev,
42static int device_init(DeviceIntPtr dev, LocalDevicePtr local) 45static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
43{ 46{
44 struct MTouch *mt = local->private; 47 struct MTouch *mt = local->private;
45 unsigned char btmap[DIM_BUTTON]; 48 unsigned char btmap[DIM_BUTTON + 1];
46 int i; 49 int i;
47 50
48 local->fd = xf86OpenSerial(local->options); 51 local->fd = xf86OpenSerial(local->options);
@@ -54,9 +57,11 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
54 return -1; 57 return -1;
55 xf86CloseSerial(local->fd); 58 xf86CloseSerial(local->fd);
56 59
57 for (i = 0; i < DIM_BUTTON; i++) 60 for (i = 0; i < DIM_BUTTON + 1; i++)
58 btmap[i] = i; 61 btmap[i] = i;
59 62
63 dev->public.on = FALSE;
64
60 InitPointerDeviceStruct((DevicePtr)dev, 65 InitPointerDeviceStruct((DevicePtr)dev,
61 btmap, 66 btmap,
62 DIM_BUTTON, 67 DIM_BUTTON,
@@ -69,15 +74,15 @@ static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
69 mt->caps.abs_position_x.minimum, 74 mt->caps.abs_position_x.minimum,
70 mt->caps.abs_position_x.maximum, 75 mt->caps.abs_position_x.maximum,
71 1, 0, 1); 76 1, 0, 1);
77 xf86InitValuatorDefaults(dev, 0);
72 xf86InitValuatorAxisStruct(dev, 1, 78 xf86InitValuatorAxisStruct(dev, 1,
73 mt->caps.abs_position_y.minimum, 79 mt->caps.abs_position_y.minimum,
74 mt->caps.abs_position_y.maximum, 80 mt->caps.abs_position_y.maximum,
75 1, 0, 1); 81 1, 0, 1);
76 xf86InitValuatorDefaults(dev, 0);
77 xf86InitValuatorDefaults(dev, 1); 82 xf86InitValuatorDefaults(dev, 1);
78 83
79 InitDeviceProperties(local); 84 //InitDeviceProperties(local);
80 XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL); 85 //XIRegisterPropertyHandler(dev, pointer_property, NULL, NULL);
81 86
82 return 0; 87 return 0;
83} 88}
@@ -131,6 +136,7 @@ static void handle_state(LocalDevicePtr local,
131 } 136 }
132 } 137 }
133 if (dx || dy) { 138 if (dx || dy) {
139 output_state(ns);
134 xf86Msg(X_INFO, "motion: %d %d\n", dx, dy); 140 xf86Msg(X_INFO, "motion: %d %d\n", dx, dy);
135 xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy); 141 xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy);
136 } 142 }
@@ -150,7 +156,6 @@ static void read_input(LocalDevicePtr local)
150 if (local->fd >= 0) { 156 if (local->fd >= 0) {
151 while (read_synchronized_event(mt, local->fd)) { 157 while (read_synchronized_event(mt, local->fd)) {
152 modify_state(&mt->ns, &mt->hw, &mt->caps); 158 modify_state(&mt->ns, &mt->hw, &mt->caps);
153 //output_state(&mt->ns);
154 handle_state(local, &mt->os, &mt->ns); 159 handle_state(local, &mt->os, &mt->ns);
155 mt->os = mt->ns; 160 mt->os = mt->ns;
156 } 161 }
@@ -159,6 +164,44 @@ static void read_input(LocalDevicePtr local)
159 164
160//////////////////////////////////////////////////////////////////////////// 165////////////////////////////////////////////////////////////////////////////
161 166
167static int control_proc(LocalDevicePtr local, xDeviceCtl *control)
168{
169 xf86Msg(X_INFO, "control_proc\n");
170 return Success;
171}
172
173////////////////////////////////////////////////////////////////////////////
174
175static void close_proc(LocalDevicePtr local)
176{
177 xf86Msg(X_INFO, "close_proc\n");
178}
179
180////////////////////////////////////////////////////////////////////////////
181
182static int switch_mode(ClientPtr client, DeviceIntPtr dev, int mode)
183{
184 xf86Msg(X_INFO, "switch mode\n");
185 return Success;
186}
187
188////////////////////////////////////////////////////////////////////////////
189
190static Bool conversion_proc(LocalDevicePtr local, int first, int num,
191 int v0, int v1, int v2, int v3, int v4, int v5,
192 int *x, int *y)
193{
194 if (first != 0 || num != 2)
195 return FALSE;
196
197 *x = v0;
198 *y = v1;
199
200 return TRUE;
201}
202
203////////////////////////////////////////////////////////////////////////////
204
162static Bool device_control(DeviceIntPtr dev, int mode) 205static Bool device_control(DeviceIntPtr dev, int mode)
163{ 206{
164 LocalDevicePtr local = dev->public.devicePrivate; 207 LocalDevicePtr local = dev->public.devicePrivate;
@@ -186,7 +229,7 @@ static Bool device_control(DeviceIntPtr dev, int mode)
186 default: 229 default:
187 xf86Msg(X_INFO, "device control: default\n"); 230 xf86Msg(X_INFO, "device control: default\n");
188 return BadValue; 231 return BadValue;
189 } 232 }
190} 233}
191 234
192 235
@@ -206,15 +249,26 @@ static InputInfoPtr preinit(InputDriverPtr drv, IDevPtr dev, int flags)
206 local->type_name = XI_TOUCHPAD; 249 local->type_name = XI_TOUCHPAD;
207 local->device_control = device_control; 250 local->device_control = device_control;
208 local->read_input = read_input; 251 local->read_input = read_input;
252 local->control_proc = control_proc;
253 local->close_proc = close_proc;
254 local->switch_mode = switch_mode;
255 local->conversion_proc = conversion_proc;
256 local->reverse_conversion_proc = NULL;
257 local->dev = NULL;
209 local->private = mt; 258 local->private = mt;
210 local->private_flags = 0; 259 local->private_flags = 0;
211 local->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS; 260 local->flags = XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS;
212 local->conf_idev = dev; 261 local->conf_idev = dev;
213 local->always_core_feedback = 0; 262 local->always_core_feedback = 0;
214 263
215 xf86CollectInputOptions(local, NULL, NULL); 264 xf86CollectInputOptions(local, NULL, NULL);
216 xf86OptionListReport(local->options); 265 xf86OptionListReport(local->options);
217 266
267 local->history_size = xf86SetIntOption(local->options,
268 "HistorySize", 0);
269
270 xf86ProcessCommonOptions(local, local->options);
271
218 local->flags |= XI86_CONFIGURED; 272 local->flags |= XI86_CONFIGURED;
219 error: 273 error:
220 return local; 274 return local;