diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-23 14:06:17 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-31 14:56:49 +1000 |
commit | 6a3f12b1b68e7f5838efd3cc7b488adaa5d465bf (patch) | |
tree | 25be9f36cce502b15c3f1086557b0bcdab7bc357 | |
parent | 7fcf290c71952f2b9b495e2430fac64fcfe81ae0 (diff) |
Un-typedef SynapticsPrivate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/alpscomm.c | 10 | ||||
-rw-r--r-- | src/eventcomm.c | 30 | ||||
-rw-r--r-- | src/eventcomm.h | 2 | ||||
-rw-r--r-- | src/properties.c | 6 | ||||
-rw-r--r-- | src/ps2comm.c | 20 | ||||
-rw-r--r-- | src/ps2comm.h | 8 | ||||
-rw-r--r-- | src/psmcomm.c | 6 | ||||
-rw-r--r-- | src/synaptics-dummy.c | 14 | ||||
-rw-r--r-- | src/synaptics-x11.c | 52 | ||||
-rw-r--r-- | src/synaptics.c | 116 | ||||
-rw-r--r-- | src/synaptics.h | 48 | ||||
-rw-r--r-- | src/synapticsstr.h | 2 | ||||
-rw-r--r-- | src/synproto.c | 4 | ||||
-rw-r--r-- | src/synproto.h | 17 | ||||
-rw-r--r-- | test/eventcomm-test.c | 12 |
15 files changed, 173 insertions, 174 deletions
diff --git a/src/alpscomm.c b/src/alpscomm.c index 033329b..62a3b09 100644 --- a/src/alpscomm.c +++ b/src/alpscomm.c @@ -88,7 +88,7 @@ ALPS_initialize(int fd) } static Bool -ALPSQueryHardware(SynapticsPrivate *priv, int fd) +ALPSQueryHardware(struct SynapticsPrivate *priv, int fd) { ALPS_initialize(fd); return TRUE; @@ -104,7 +104,7 @@ ALPS_packet_ok(struct PS2CommData *comm) } static Bool -ALPS_get_packet(SynapticsPrivate *priv) +ALPS_get_packet(struct SynapticsPrivate *priv) { struct PS2CommData *ps2_comm_data = priv->proto_data; int c; @@ -210,7 +210,7 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw) } static Bool -ALPSReadHwState(SynapticsPrivate *priv, int fd, +ALPSReadHwState(struct SynapticsPrivate *priv, int fd, struct CommData *comm, struct SynapticsHwState *hwRet) { struct SynapticsHwState *hw = comm->hwState; @@ -227,13 +227,13 @@ ALPSReadHwState(SynapticsPrivate *priv, int fd, } Bool -ALPSDeviceOnHook(SynapticsPrivate *priv, struct SynapticsParameters *para, int fd) +ALPSDeviceOnHook(struct SynapticsPrivate *priv, struct SynapticsParameters *para, int fd) { return PS2ProtoDataInit(priv, fd) && ALPSQueryHardware(priv, fd); } Bool -ALPSDeviceOffHook(SynapticsPrivate *priv, int fd) +ALPSDeviceOffHook(struct SynapticsPrivate *priv, int fd) { PS2ProtoDataCleanup(priv, fd); return TRUE; diff --git a/src/eventcomm.c b/src/eventcomm.c index 0221738..c4fbc94 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -96,7 +96,7 @@ EventProtoDataAlloc(void) } static int -last_mt_vals_slot(const SynapticsPrivate * priv) +last_mt_vals_slot(const struct SynapticsPrivate * priv) { struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; @@ -106,7 +106,7 @@ last_mt_vals_slot(const SynapticsPrivate * priv) } static void -UninitializeTouch(SynapticsPrivate * priv, int fd) +UninitializeTouch(struct SynapticsPrivate * priv, int fd) { struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; @@ -129,7 +129,7 @@ UninitializeTouch(SynapticsPrivate * priv, int fd) } static void -InitializeTouch(SynapticsPrivate * priv, int fd) +InitializeTouch(struct SynapticsPrivate * priv, int fd) { struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; @@ -177,7 +177,7 @@ InitializeTouch(SynapticsPrivate * priv, int fd) } static int -EventDeviceOnHook(SynapticsPrivate * priv, struct SynapticsParameters * para, int fd) +EventDeviceOnHook(struct SynapticsPrivate * priv, struct SynapticsParameters * para, int fd) { struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; @@ -203,7 +203,7 @@ EventDeviceOnHook(SynapticsPrivate * priv, struct SynapticsParameters * para, in } static int -EventDeviceOffHook(SynapticsPrivate *priv, int fd) +EventDeviceOffHook(struct SynapticsPrivate *priv, int fd) { UninitializeTouch(priv, fd); @@ -342,7 +342,7 @@ event_query_model(int fd, enum TouchpadModel *model_out, * @return Zero on success, or errno otherwise. */ static int -event_get_abs(SynapticsPrivate *priv, int fd, int code, +event_get_abs(struct SynapticsPrivate *priv, int fd, int code, int *min, int *max, int *fuzz, int *res) { int rc; @@ -370,7 +370,7 @@ event_get_abs(SynapticsPrivate *priv, int fd, int code, /* Query device for axis ranges */ static void -event_query_axis_ranges(SynapticsPrivate * priv, int fd) +event_query_axis_ranges(struct SynapticsPrivate * priv, int fd) { struct eventcomm_proto_data *proto_data = priv->proto_data; unsigned long absbits[NBITS(ABS_MAX)] = { 0 }; @@ -472,7 +472,7 @@ event_query_axis_ranges(SynapticsPrivate * priv, int fd) } static Bool -SynapticsReadEvent(SynapticsPrivate *priv, int fd, struct input_event *ev) +SynapticsReadEvent(struct SynapticsPrivate *priv, int fd, struct input_event *ev) { struct eventcomm_proto_data *proto_data = priv->proto_data; int rc = TRUE; @@ -497,7 +497,7 @@ SynapticsReadEvent(SynapticsPrivate *priv, int fd, struct input_event *ev) } static Bool -EventTouchSlotPreviouslyOpen(SynapticsPrivate * priv, int slot) +EventTouchSlotPreviouslyOpen(struct SynapticsPrivate * priv, int slot) { int i; @@ -509,7 +509,7 @@ EventTouchSlotPreviouslyOpen(SynapticsPrivate * priv, int slot) } static void -EventProcessTouchEvent(SynapticsPrivate *priv, struct SynapticsHwState *hw, +EventProcessTouchEvent(struct SynapticsPrivate *priv, struct SynapticsHwState *hw, struct input_event *ev) { struct eventcomm_proto_data *proto_data = priv->proto_data; @@ -576,7 +576,7 @@ EventProcessTouchEvent(SynapticsPrivate *priv, struct SynapticsHwState *hw, * @return The number of fingers currently set. */ static int -count_fingers(SynapticsPrivate *priv, const struct CommData *comm) +count_fingers(struct SynapticsPrivate *priv, const struct CommData *comm) { struct eventcomm_proto_data *proto_data = priv->proto_data; int fingers = 0; @@ -602,7 +602,7 @@ apply_st_scaling(struct eventcomm_proto_data *proto_data, int value, int axis) } Bool -EventReadHwState(SynapticsPrivate * priv, int fd, +EventReadHwState(struct SynapticsPrivate * priv, int fd, struct CommData *comm, struct SynapticsHwState *hwRet) { struct input_event ev; @@ -720,7 +720,7 @@ EventDevOnly(const struct dirent *dir) } static void -event_query_touch(SynapticsPrivate *priv, int fd) +event_query_touch(struct SynapticsPrivate *priv, int fd) { struct SynapticsParameters *para = &priv->synpara; struct eventcomm_proto_data *proto_data = priv->proto_data; @@ -840,7 +840,7 @@ event_query_touch(SynapticsPrivate *priv, int fd) * Probe the open device for dimensions. */ static int -EventQueryHardware(SynapticsPrivate *priv, int fd) +EventQueryHardware(struct SynapticsPrivate *priv, int fd) { struct eventcomm_proto_data *proto_data = priv->proto_data; int i; @@ -869,7 +869,7 @@ EventQueryHardware(SynapticsPrivate *priv, int fd) } static int -EventAutoDevProbe(SynapticsPrivate *priv, const char *device, char **device_out) +EventAutoDevProbe(struct SynapticsPrivate *priv, const char *device, char **device_out) { /* We are trying to find the right eventX device or fall back to the psaux protocol and the given device from XF86Config */ diff --git a/src/eventcomm.h b/src/eventcomm.h index ef234fe..778efad 100644 --- a/src/eventcomm.h +++ b/src/eventcomm.h @@ -40,7 +40,7 @@ struct eventcomm_proto_data; extern struct eventcomm_proto_data *EventProtoDataAlloc(void); extern Bool -EventReadHwState(SynapticsPrivate *priv, int fd, +EventReadHwState(struct SynapticsPrivate *priv, int fd, struct CommData *comm, struct SynapticsHwState *hwRet); #endif /* _EVENTCOMM_H_ */ diff --git a/src/properties.c b/src/properties.c index 53d91a7..e9a56fc 100644 --- a/src/properties.c +++ b/src/properties.c @@ -158,7 +158,7 @@ InitFloatAtom(DeviceIntPtr dev, char *name, int nvalues, float *values) static void InitSoftButtonProperty(InputInfoPtr pInfo) { - SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) pInfo->private; struct SynapticsParameters *para = &priv->synpara; int values[8]; @@ -177,7 +177,7 @@ InitSoftButtonProperty(InputInfoPtr pInfo) void InitDeviceProperties(InputInfoPtr pInfo) { - SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) pInfo->private; struct SynapticsParameters *para = &priv->synpara; int values[9]; /* we never have more than 9 values in an atom */ float fvalues[4]; /* never have more than 4 float values */ @@ -366,7 +366,7 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, BOOL checkonly) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) pInfo->private; struct SynapticsParameters *para = &priv->synpara; struct SynapticsParameters tmp; diff --git a/src/ps2comm.c b/src/ps2comm.c index 163188d..a42aa96 100644 --- a/src/ps2comm.c +++ b/src/ps2comm.c @@ -311,7 +311,7 @@ ps2_synaptics_disable_device(int fd) } static Bool -ps2_query_is_synaptics(SynapticsPrivate *priv, int fd, +ps2_query_is_synaptics(struct SynapticsPrivate *priv, int fd, struct PS2SynapticsHwInfo *synhw) { int i; @@ -334,7 +334,7 @@ ps2_query_is_synaptics(SynapticsPrivate *priv, int fd, } void -ps2_print_ident(SynapticsPrivate *priv, const struct PS2SynapticsHwInfo *synhw) +ps2_print_ident(struct SynapticsPrivate *priv, const struct PS2SynapticsHwInfo *synhw) { SynapticsMsg(priv, MSG_INFO, " Synaptics Touchpad, model: %d\n", SYN_ID_MODEL(synhw)); @@ -372,7 +372,7 @@ ps2_print_ident(SynapticsPrivate *priv, const struct PS2SynapticsHwInfo *synhw) } static Bool -PS2DeviceOffHook(SynapticsPrivate *priv, int fd) +PS2DeviceOffHook(struct SynapticsPrivate *priv, int fd) { ps2_synaptics_reset(fd); ps2_synaptics_enable_device(fd); @@ -383,7 +383,7 @@ PS2DeviceOffHook(SynapticsPrivate *priv, int fd) } static Bool -PS2QueryHardware(SynapticsPrivate *priv, int fd) +PS2QueryHardware(struct SynapticsPrivate *priv, int fd) { int mode; struct PS2SynapticsHwInfo *synhw; @@ -458,7 +458,7 @@ ps2_packet_ok(struct PS2SynapticsHwInfo *synhw, struct PS2CommData *comm) } static Bool -ps2_synaptics_get_packet(SynapticsPrivate *priv, int fd, +ps2_synaptics_get_packet(struct SynapticsPrivate *priv, int fd, struct PS2SynapticsHwInfo *synhw, struct SynapticsProtocolOperations *proto_ops, struct CommData *comm) @@ -524,7 +524,7 @@ ps2_synaptics_get_packet(SynapticsPrivate *priv, int fd, } Bool -PS2ReadHwStateProto(SynapticsPrivate *priv, int fd, +PS2ReadHwStateProto(struct SynapticsPrivate *priv, int fd, struct SynapticsProtocolOperations *proto_ops, struct CommData *comm, struct SynapticsHwState *hwRet) { @@ -657,14 +657,14 @@ PS2ReadHwStateProto(SynapticsPrivate *priv, int fd, } static Bool -PS2ReadHwState(SynapticsPrivate *priv, int fd, +PS2ReadHwState(struct SynapticsPrivate *priv, int fd, struct CommData *comm, struct SynapticsHwState *hwRet) { return PS2ReadHwStateProto(priv, fd, &psaux_proto_operations, comm, hwRet); } Bool -PS2ProtoDataInit(SynapticsPrivate *priv, int fd) +PS2ProtoDataInit(struct SynapticsPrivate *priv, int fd) { struct PS2CommData *data; @@ -682,7 +682,7 @@ PS2ProtoDataInit(SynapticsPrivate *priv, int fd) } void -PS2ProtoDataCleanup(SynapticsPrivate *priv, int fd) +PS2ProtoDataCleanup(struct SynapticsPrivate *priv, int fd) { struct PS2CommData *data = priv->proto_data; @@ -694,7 +694,7 @@ PS2ProtoDataCleanup(SynapticsPrivate *priv, int fd) Bool -PS2DeviceOnHook(SynapticsPrivate *priv, struct SynapticsParameters *para, int fd) +PS2DeviceOnHook(struct SynapticsPrivate *priv, struct SynapticsParameters *para, int fd) { return PS2ProtoDataInit(priv, fd) && PS2QueryHardware(priv, fd); diff --git a/src/ps2comm.h b/src/ps2comm.h index 77dc9b9..cdaac48 100644 --- a/src/ps2comm.h +++ b/src/ps2comm.h @@ -112,12 +112,12 @@ struct PS2CommData { }; int ps2_putbyte(int fd, byte b); -void ps2_print_ident(SynapticsPrivate *priv, +void ps2_print_ident(struct SynapticsPrivate *priv, const struct PS2SynapticsHwInfo *synhw); -Bool PS2ReadHwStateProto(SynapticsPrivate *priv, int fd, +Bool PS2ReadHwStateProto(struct SynapticsPrivate *priv, int fd, struct SynapticsProtocolOperations *proto_ops, struct CommData *comm, struct SynapticsHwState *hwRet); -Bool PS2ProtoDataInit(SynapticsPrivate *priv, int fd); -void PS2ProtoDataCleanup(SynapticsPrivate *priv, int fd); +Bool PS2ProtoDataInit(struct SynapticsPrivate *priv, int fd); +void PS2ProtoDataCleanup(struct SynapticsPrivate *priv, int fd); #endif /* _PS2COMM_H_ */ diff --git a/src/psmcomm.c b/src/psmcomm.c index f041711..089eb75 100644 --- a/src/psmcomm.c +++ b/src/psmcomm.c @@ -71,7 +71,7 @@ psm_synaptics_identify(int fd, synapticshw_t * ident) #define PSM_LEVEL_NATIVE 2 static Bool -PSMQueryIsSynaptics(SynapticsPrivate *priv, int fd) +PSMQueryIsSynaptics(struct SynapticsPrivate *priv, int fd) { int ret; int level = PSM_LEVEL_NATIVE; @@ -128,7 +128,7 @@ convert_hw_info(const synapticshw_t * psm_ident, } static Bool -PSMQueryHardware(SynapticsPrivate *priv, int fd) +PSMQueryHardware(struct SynapticsPrivate *priv, int fd) { synapticshw_t psm_ident; struct PS2SynapticsHwInfo *synhw; @@ -161,7 +161,7 @@ PSMReadHwState(InputInfoPtr pInfo, } static Bool -PSMDeviceOnHook(SynapticsPrivate *priv, struct SynapticsParameters *para, int fd) +PSMDeviceOnHook(struct SynapticsPrivate *priv, struct SynapticsParameters *para, int fd) { return PSMQueryHardware(priv, fd); } diff --git a/src/synaptics-dummy.c b/src/synaptics-dummy.c index 4aa0339..5773734 100644 --- a/src/synaptics-dummy.c +++ b/src/synaptics-dummy.c @@ -39,32 +39,32 @@ #include "synaptics.h" void -DummySynapticsMsg(SynapticsPrivate *priv, enum MessageType type, const char *format, va_list args) +DummySynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, const char *format, va_list args) { printf("dummydrv: "); vprintf(format, args); } void -DummySynapticsButtonEvent(SynapticsPrivate *priv, int button, enum ButtonEventType press) +DummySynapticsButtonEvent(struct SynapticsPrivate *priv, int button, enum ButtonEventType press) { SynapticsMsg(priv, MSG_INFO, "Button %d %s\n", button, press == BTN_PRESS ? "press" : "release"); } void -DummySynapticsMotionEvent(SynapticsPrivate *priv, int x, int y) +DummySynapticsMotionEvent(struct SynapticsPrivate *priv, int x, int y) { SynapticsMsg(priv, MSG_INFO, "Motion %d/%d\n", x, y); } void -DummySynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, double horiz) +DummySynapticsScrollEvent(struct SynapticsPrivate *priv, unsigned int which, double vert, double horiz) { SynapticsMsg(priv, MSG_INFO, "Scroll vert %.f horiz %.f\n", vert, horiz); } void -DummySynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, +DummySynapticsTouchEvent(struct SynapticsPrivate *priv, unsigned int touchid, enum TouchEventType type, struct VMask *mask) { SynapticsMsg(priv, MSG_INFO,"Touch <%u> %s\n", touchid, @@ -72,7 +72,7 @@ DummySynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, } void -DummySynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int delay) +DummySynapticsSetTimer(struct SynapticsPrivate *priv, unsigned int now, unsigned int delay) { /* FIXME: should probably do something here */ } @@ -105,7 +105,7 @@ struct SynapticsFrontend dummy_frontend = { int main(int argc, char **argv) { - SynapticsPrivate *priv; + struct SynapticsPrivate *priv; char *device; int fd; int rc; diff --git a/src/synaptics-x11.c b/src/synaptics-x11.c index 7da4419..0e3ebcd 100644 --- a/src/synaptics-x11.c +++ b/src/synaptics-x11.c @@ -62,21 +62,21 @@ struct SynapticsX11 { static void DeviceInitTouchAxes(DeviceIntPtr dev, Atom *axes_labels); /* frontend hooks */ static unsigned int X11SynapticsGetCurrentMillis(void); -static void X11SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, +static void X11SynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, const char *format, va_list args); -static void X11SynapticsButtonEvent(SynapticsPrivate *priv, int button, +static void X11SynapticsButtonEvent(struct SynapticsPrivate *priv, int button, enum ButtonEventType press); -static void X11SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y); +static void X11SynapticsMotionEvent(struct SynapticsPrivate *priv, int x, int y); static void -X11SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, +X11SynapticsScrollEvent(struct SynapticsPrivate *priv, unsigned int which, double vert, double horiz); -static void X11SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, +static void X11SynapticsTouchEvent(struct SynapticsPrivate *priv, unsigned int touchid, enum TouchEventType type, struct VMask *mask); -static void X11SynapticsSetTimer(SynapticsPrivate *priv, +static void X11SynapticsSetTimer(struct SynapticsPrivate *priv, unsigned int now, unsigned int delay); static void -X11SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, +X11SynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, const char *format, va_list args) { struct SynapticsX11 *x11 = priv->frontend_data; @@ -105,7 +105,7 @@ static CARD32 X11TimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) { InputInfoPtr pInfo = arg; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); struct SynapticsX11 *x11 = priv->frontend_data; int sigstate; int delay; @@ -123,7 +123,7 @@ X11TimerFunc(OsTimerPtr timer, CARD32 now, pointer arg) } static void -X11SynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int delay) +X11SynapticsSetTimer(struct SynapticsPrivate *priv, unsigned int now, unsigned int delay) { struct SynapticsX11 *x11 = priv->frontend_data; x11->timer = TimerSet(x11->timer, 0, delay, X11TimerFunc, x11->pInfo); @@ -139,7 +139,7 @@ SynapticsCtrl(DeviceIntPtr device, PtrCtrl * ctrl) } static void -InitAxesLabels(Atom *labels, int nlabels, const SynapticsPrivate * priv) +InitAxesLabels(Atom *labels, int nlabels, const struct SynapticsPrivate * priv) { int i; @@ -195,7 +195,7 @@ SynapticsAccelerationProfile(DeviceIntPtr dev, double velocity, double thr, double acc) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); struct SynapticsParameters *para = &priv->synpara; double accelfct; @@ -243,7 +243,7 @@ static void DeviceInitAcceleration(DeviceIntPtr dev) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); Atom float_type, prop; DeviceVelocityPtr pVel; float tmpf; @@ -298,7 +298,7 @@ static int DeviceInit(DeviceIntPtr dev) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); struct SynapticsX11 *x11 = priv->frontend_data; unsigned char map[SYN_MAX_BUTTONS + 1]; int i; @@ -390,7 +390,7 @@ static int DeviceOn(DeviceIntPtr dev) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); pInfo->fd = xf86OpenSerial(pInfo->options); if (pInfo->fd == -1) { @@ -413,7 +413,7 @@ static int DeviceOff(DeviceIntPtr dev) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); struct SynapticsX11 *x11 = priv->frontend_data; Bool rc = Success; @@ -435,7 +435,7 @@ DeviceClose(DeviceIntPtr dev) { Bool RetValue; InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) pInfo->private; struct SynapticsX11 *x11 = priv->frontend_data; RetValue = DeviceOff(dev); @@ -504,7 +504,7 @@ static int set_percent_option(pointer options, const char* optname, static void set_softbutton_areas_option(InputInfoPtr pInfo) { - SynapticsPrivate *priv = pInfo->private; + struct SynapticsPrivate *priv = pInfo->private; struct SynapticsParameters *pars = &priv->synpara; int values[8]; int in_percent = 0; /* bitmask for which ones are in % */ @@ -574,7 +574,7 @@ fail: option_string); } -void SynapticsOverrideDefaults(InputInfoPtr pInfo, SynapticsPrivate *priv) +void SynapticsOverrideDefaults(InputInfoPtr pInfo, struct SynapticsPrivate *priv) { struct SynapticsParameters *pars = &priv->synpara; pointer opts = pInfo->options; /* read-only */ @@ -706,7 +706,7 @@ struct SynapticsFrontend x11_frontend = { static int SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) { - SynapticsPrivate *priv; + struct SynapticsPrivate *priv; struct SynapticsX11 *x11; char *proto; char *device, *actual_device; @@ -715,7 +715,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) if (!x11) return BadAlloc; - /* allocate memory for SynapticsPrivateRec */ + /* allocate memory for struct SynapticsPrivateRec */ priv = SynapticsInitPrivate(&x11_frontend); if (!priv) { FreeX11Private(&x11); @@ -788,7 +788,7 @@ static void DeviceInitTouchAxes(DeviceIntPtr dev, Atom *axes_labels) { InputInfoPtr pInfo = dev->public.devicePrivate; - SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); + struct SynapticsPrivate *priv = (struct SynapticsPrivate *) (pInfo->private); int i; if (!priv->has_touch) @@ -825,7 +825,7 @@ DeviceInitTouchAxes(DeviceIntPtr dev, Atom *axes_labels) } static void -X11SynapticsButtonEvent(SynapticsPrivate *priv, int button, enum ButtonEventType press) +X11SynapticsButtonEvent(struct SynapticsPrivate *priv, int button, enum ButtonEventType press) { struct SynapticsX11 *x11 = priv->frontend_data; InputInfoPtr pInfo = x11->pInfo; @@ -834,7 +834,7 @@ X11SynapticsButtonEvent(SynapticsPrivate *priv, int button, enum ButtonEventType } static void -X11SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y) +X11SynapticsMotionEvent(struct SynapticsPrivate *priv, int x, int y) { struct SynapticsX11 *x11 = priv->frontend_data; InputInfoPtr pInfo = x11->pInfo; @@ -843,7 +843,7 @@ X11SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y) } static void -X11SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, double horiz) +X11SynapticsScrollEvent(struct SynapticsPrivate *priv, unsigned int which, double vert, double horiz) { struct SynapticsX11 *x11 = priv->frontend_data; InputInfoPtr pInfo = x11->pInfo; @@ -862,7 +862,7 @@ X11SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, } static void -X11SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, +X11SynapticsTouchEvent(struct SynapticsPrivate *priv, unsigned int touchid, enum TouchEventType type, struct VMask *mask) { struct SynapticsX11 *x11 = priv->frontend_data; @@ -892,7 +892,7 @@ X11SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, static void SynapticsUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) { - SynapticsPrivate *priv = pInfo->private; + struct SynapticsPrivate *priv = pInfo->private; if (priv) { struct SynapticsX11 *x11 = priv->frontend_data; if (x11) diff --git a/src/synaptics.c b/src/synaptics.c index 86c50b2..3ff6c64 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -109,9 +109,9 @@ enum EdgeType { /***************************************************************************** * Forward declaration ****************************************************************************/ -static int HandleState(SynapticsPrivate *priv, struct SynapticsHwState *, unsigned int now, +static int HandleState(struct SynapticsPrivate *priv, struct SynapticsHwState *, unsigned int now, Bool from_timer); -static void ScaleCoordinates(SynapticsPrivate * priv, +static void ScaleCoordinates(struct SynapticsPrivate * priv, struct SynapticsHwState *hw); /** @@ -154,7 +154,7 @@ const static struct { * men, or possibly apes. */ static void -SanitizeDimensions(SynapticsPrivate *priv) +SanitizeDimensions(struct SynapticsPrivate *priv) { if (priv->minx >= priv->maxx) { priv->minx = 1615; @@ -196,7 +196,7 @@ SanitizeDimensions(SynapticsPrivate *priv) } struct SynapticsProtocolOperations* -SynapticsGetDeviceProtocolOps(SynapticsPrivate *priv, +SynapticsGetDeviceProtocolOps(struct SynapticsPrivate *priv, const char *proto, const char *device, char **used_device) @@ -221,7 +221,7 @@ SynapticsGetDeviceProtocolOps(SynapticsPrivate *priv, } static void -calculate_edge_widths(SynapticsPrivate * priv, int *l, int *r, int *t, int *b) +calculate_edge_widths(struct SynapticsPrivate * priv, int *l, int *r, int *t, int *b) { int width, height; int ewidth, eheight; /* edge width/height */ @@ -253,7 +253,7 @@ calculate_edge_widths(SynapticsPrivate * priv, int *l, int *r, int *t, int *b) } static void -calculate_tap_hysteresis(SynapticsPrivate * priv, int range, +calculate_tap_hysteresis(struct SynapticsPrivate * priv, int range, int *fingerLow, int *fingerHigh) { if (priv->model == MODEL_ELANTECH) { @@ -346,7 +346,7 @@ SynapticsIsSoftButtonAreasValid(int *values) } static void -SetDefaultParameters(SynapticsPrivate *priv) +SetDefaultParameters(struct SynapticsPrivate *priv) { struct SynapticsParameters *pars = &priv->synpara; /* modified */ @@ -507,11 +507,11 @@ SetDefaultParameters(SynapticsPrivate *priv) memset(pars->softbutton_areas, 0, sizeof(pars->softbutton_areas)); } -SynapticsPrivate * +struct SynapticsPrivate * SynapticsInitPrivate(struct SynapticsFrontend *frontend) { - SynapticsPrivate *priv; - priv = calloc(1, sizeof(SynapticsPrivate)); + struct SynapticsPrivate *priv; + priv = calloc(1, sizeof(struct SynapticsPrivate)); if (!priv) goto error; @@ -535,9 +535,9 @@ error: } void -SynapticsFreePrivate(SynapticsPrivate **private) +SynapticsFreePrivate(struct SynapticsPrivate **private) { - SynapticsPrivate *priv = *private; + struct SynapticsPrivate *priv = *private; if (priv && priv->proto_data) free(priv->proto_data); @@ -552,7 +552,7 @@ SynapticsFreePrivate(SynapticsPrivate **private) static void -SynapticsReset(SynapticsPrivate * priv) +SynapticsReset(struct SynapticsPrivate * priv) { SynapticsResetHwState(priv->hwState); SynapticsResetHwState(priv->local_hw_state); @@ -583,7 +583,7 @@ SynapticsReset(SynapticsPrivate * priv) } void -SynapticsCloseDevice(SynapticsPrivate *priv) +SynapticsCloseDevice(struct SynapticsPrivate *priv) { SynapticsHwStateFree(&priv->hwState); SynapticsHwStateFree(&priv->old_hw_state); @@ -592,7 +592,7 @@ SynapticsCloseDevice(SynapticsPrivate *priv) } static Bool -SynapticsInitTouch(SynapticsPrivate *priv) +SynapticsInitTouch(struct SynapticsPrivate *priv) { if (priv->has_touch) { priv->num_slots = @@ -612,7 +612,7 @@ SynapticsInitTouch(SynapticsPrivate *priv) } int -SynapticsInitDevice(SynapticsPrivate *priv) +SynapticsInitDevice(struct SynapticsPrivate *priv) { priv->scroll_axis_horiz = 2; priv->scroll_axis_vert = 3; @@ -646,7 +646,7 @@ SynapticsInitDevice(SynapticsPrivate *priv) } int -SynapticsEnableDevice(SynapticsPrivate *priv, int fd) +SynapticsEnableDevice(struct SynapticsPrivate *priv, int fd) { if (priv->proto_ops->DeviceOnHook && !priv->proto_ops->DeviceOnHook(priv, &priv->synpara, fd)) @@ -655,7 +655,7 @@ SynapticsEnableDevice(SynapticsPrivate *priv, int fd) } int -SynapticsDisableDevice(SynapticsPrivate *priv, int fd) +SynapticsDisableDevice(struct SynapticsPrivate *priv, int fd) { SynapticsReset(priv); if (priv->proto_ops->DeviceOffHook && @@ -666,7 +666,7 @@ SynapticsDisableDevice(SynapticsPrivate *priv, int fd) /* return angle of point relative to center */ static double -angle(SynapticsPrivate * priv, int x, int y) +angle(struct SynapticsPrivate * priv, int x, int y) { double xCenter = (priv->synpara.left_edge + priv->synpara.right_edge) / 2.0; double yCenter = (priv->synpara.top_edge + priv->synpara.bottom_edge) / 2.0; @@ -688,7 +688,7 @@ diffa(double a1, double a2) } static enum EdgeType -edge_detection(SynapticsPrivate * priv, int x, int y) +edge_detection(struct SynapticsPrivate * priv, int x, int y) { enum EdgeType edge = NO_EDGE; @@ -711,7 +711,7 @@ edge_detection(SynapticsPrivate * priv, int x, int y) * all set to zero), the function returns TRUE. */ static Bool -is_inside_active_area(SynapticsPrivate * priv, int x, int y) +is_inside_active_area(struct SynapticsPrivate * priv, int x, int y) { Bool inside_area = TRUE; @@ -771,7 +771,7 @@ is_inside_middlebutton_area(struct SynapticsParameters * para, int x, int y) } unsigned int -SynapticsTimerFunc(SynapticsPrivate *priv, unsigned int now) +SynapticsTimerFunc(struct SynapticsPrivate *priv, unsigned int now) { struct SynapticsHwState *hw = priv->local_hw_state; int delay; @@ -796,7 +796,7 @@ clamp(int val, int min, int max) } static Bool -SynapticsGetHwState(SynapticsPrivate * priv, int fd, struct SynapticsHwState *hw) +SynapticsGetHwState(struct SynapticsPrivate * priv, int fd, struct SynapticsHwState *hw) { return priv->proto_ops->ReadHwState(priv, fd, &priv->comm, hw); } @@ -805,7 +805,7 @@ SynapticsGetHwState(SynapticsPrivate * priv, int fd, struct SynapticsHwState *hw * called for each full received packet from the touchpad */ void -SynapticsReadInput(SynapticsPrivate *priv, int fd) +SynapticsReadInput(struct SynapticsPrivate *priv, int fd) { struct SynapticsHwState *hw = priv->local_hw_state; int delay = 0; @@ -839,7 +839,7 @@ SynapticsReadInput(SynapticsPrivate *priv, int fd) } static int -HandleMidButtonEmulation(SynapticsPrivate * priv, struct SynapticsHwState *hw, +HandleMidButtonEmulation(struct SynapticsPrivate * priv, struct SynapticsHwState *hw, unsigned int now, int *delay) { struct SynapticsParameters *para = &priv->synpara; @@ -939,7 +939,7 @@ HandleMidButtonEmulation(SynapticsPrivate * priv, struct SynapticsHwState *hw, } static enum FingerState -SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) +SynapticsDetectFinger(struct SynapticsPrivate * priv, struct SynapticsHwState *hw) { struct SynapticsParameters *para = &priv->synpara; enum FingerState finger; @@ -990,7 +990,7 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) } static void -SelectTapButton(SynapticsPrivate * priv, enum EdgeType edge) +SelectTapButton(struct SynapticsPrivate * priv, enum EdgeType edge) { enum TapEvent tap; @@ -1035,7 +1035,7 @@ SelectTapButton(SynapticsPrivate * priv, enum EdgeType edge) } static void -SetTapState(SynapticsPrivate * priv, enum TapState tap_state, unsigned int millis) +SetTapState(struct SynapticsPrivate * priv, enum TapState tap_state, unsigned int millis) { switch (tap_state) { case TS_START: @@ -1065,14 +1065,14 @@ SetTapState(SynapticsPrivate * priv, enum TapState tap_state, unsigned int milli } static void -SetMovingState(SynapticsPrivate * priv, enum MovingState moving_state, +SetMovingState(struct SynapticsPrivate * priv, enum MovingState moving_state, unsigned int millis) { priv->moving_state = moving_state; } static int -GetTimeOut(SynapticsPrivate * priv) +GetTimeOut(struct SynapticsPrivate * priv) { struct SynapticsParameters *para = &priv->synpara; @@ -1095,7 +1095,7 @@ GetTimeOut(SynapticsPrivate * priv) } static int -HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw, +HandleTapProcessing(struct SynapticsPrivate * priv, struct SynapticsHwState *hw, unsigned int now, enum FingerState finger, Bool inside_active_area) { @@ -1290,7 +1290,7 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw, #define HIST_DELTA(a, b, e) ((HIST((a)).e) - (HIST((b)).e)) static void -store_history(SynapticsPrivate * priv, int x, int y, unsigned int millis) +store_history(struct SynapticsPrivate * priv, int x, int y, unsigned int millis) { int idx = (priv->hist_index + 1) % SYNAPTICS_MOVE_HISTORY; @@ -1339,7 +1339,7 @@ hysteresis(int in, int center, int margin) } static void -get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw, +get_delta(struct SynapticsPrivate *priv, const struct SynapticsHwState *hw, enum EdgeType edge, double *dx, double *dy) { double dtime = (hw->millis - HIST(0).millis) / 1000.0; @@ -1373,7 +1373,7 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw, * Compute relative motion ('deltas') including edge motion. */ static int -ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw, +ComputeDeltas(struct SynapticsPrivate * priv, const struct SynapticsHwState *hw, enum EdgeType edge, int *dxP, int *dyP, Bool inside_area) { enum MovingState moving_state; @@ -1430,7 +1430,7 @@ ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw, } static double -estimate_delta_circ(SynapticsPrivate * priv) +estimate_delta_circ(struct SynapticsPrivate * priv) { double a1 = angle(priv, HIST(3).x, HIST(3).y); double a2 = angle(priv, HIST(2).x, HIST(2).y); @@ -1447,7 +1447,7 @@ estimate_delta_circ(SynapticsPrivate * priv) * circ is true if the user had been circular scrolling. */ static void -start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw, +start_coasting(struct SynapticsPrivate * priv, struct SynapticsHwState *hw, Bool vert, Bool horiz, Bool circ) { struct SynapticsParameters *para = &priv->synpara; @@ -1509,7 +1509,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw, } static void -stop_coasting(SynapticsPrivate * priv) +stop_coasting(struct SynapticsPrivate * priv) { priv->scroll.coast_speed_x = 0; priv->scroll.coast_speed_y = 0; @@ -1517,7 +1517,7 @@ stop_coasting(SynapticsPrivate * priv) } static int -HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw, +HandleScrolling(struct SynapticsPrivate * priv, struct SynapticsHwState *hw, enum EdgeType edge, Bool finger) { struct SynapticsParameters *para = &priv->synpara; @@ -1766,7 +1766,7 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw, * ClickFinger action. */ static int -clickpad_guess_clickfingers(SynapticsPrivate * priv, +clickpad_guess_clickfingers(struct SynapticsPrivate * priv, struct SynapticsHwState *hw) { int nfingers = 0; @@ -1818,7 +1818,7 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv, } static void -handle_clickfinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) +handle_clickfinger(struct SynapticsPrivate * priv, struct SynapticsHwState *hw) { struct SynapticsParameters *para = &priv->synpara; int action = 0; @@ -1860,7 +1860,7 @@ handle_clickfinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) } static void -update_hw_button_state(SynapticsPrivate *priv, struct SynapticsHwState *hw, +update_hw_button_state(struct SynapticsPrivate *priv, struct SynapticsHwState *hw, struct SynapticsHwState *old, unsigned int now, int *delay) { struct SynapticsParameters *para = &priv->synpara; @@ -1910,14 +1910,14 @@ update_hw_button_state(SynapticsPrivate *priv, struct SynapticsHwState *hw, } static void -post_button_click(SynapticsPrivate *priv, const int button) +post_button_click(struct SynapticsPrivate *priv, const int button) { SynapticsButtonEvent(priv, button, BTN_PRESS); SynapticsButtonEvent(priv, button, BTN_RELEASE); } static void -post_scroll_events(SynapticsPrivate *priv) +post_scroll_events(struct SynapticsPrivate *priv) { unsigned int which = 0; vmask_zero(priv->scroll_events_mask); @@ -1939,7 +1939,7 @@ post_scroll_events(SynapticsPrivate *priv) /* Update the open slots and number of active touches */ static void -UpdateTouchState(SynapticsPrivate *priv, struct SynapticsHwState *hw) +UpdateTouchState(struct SynapticsPrivate *priv, struct SynapticsHwState *hw) { int i; @@ -1971,7 +1971,7 @@ UpdateTouchState(SynapticsPrivate *priv, struct SynapticsHwState *hw) } static void -HandleTouches(SynapticsPrivate *priv, struct SynapticsHwState *hw) +HandleTouches(struct SynapticsPrivate *priv, struct SynapticsHwState *hw) { struct SynapticsParameters *para = &priv->synpara; int new_active_touches = priv->num_active_touches; @@ -2047,7 +2047,7 @@ HandleTouches(SynapticsPrivate *priv, struct SynapticsHwState *hw) } static void -filter_jitter(SynapticsPrivate * priv, int *x, int *y) +filter_jitter(struct SynapticsPrivate * priv, int *x, int *y) { struct SynapticsParameters *para = &priv->synpara; @@ -2078,7 +2078,7 @@ reset_hw_state(struct SynapticsHwState *hw) * than from having received a motion event. */ static int -HandleState(SynapticsPrivate *priv, struct SynapticsHwState *hw, unsigned int now, +HandleState(struct SynapticsPrivate *priv, struct SynapticsHwState *hw, unsigned int now, Bool from_timer) { struct SynapticsParameters *para = &priv->synpara; @@ -2233,7 +2233,7 @@ HandleState(SynapticsPrivate *priv, struct SynapticsHwState *hw, unsigned int no } Bool -SynapticsQueryHardware(SynapticsPrivate *priv, int fd) +SynapticsQueryHardware(struct SynapticsPrivate *priv, int fd) { if (!priv->proto_ops->QueryHardware(priv, fd)) { SynapticsMsg(priv, MSG_INFO, "no supported touchpad found\n"); @@ -2249,7 +2249,7 @@ SynapticsQueryHardware(SynapticsPrivate *priv, int fd) } static void -ScaleCoordinates(SynapticsPrivate * priv, struct SynapticsHwState *hw) +ScaleCoordinates(struct SynapticsPrivate * priv, struct SynapticsHwState *hw) { int xCenter = (priv->synpara.left_edge + priv->synpara.right_edge) / 2; int yCenter = (priv->synpara.top_edge + priv->synpara.bottom_edge) / 2; @@ -2259,7 +2259,7 @@ ScaleCoordinates(SynapticsPrivate * priv, struct SynapticsHwState *hw) } static void -CalculateScalingCoeffs(SynapticsPrivate * priv) +CalculateScalingCoeffs(struct SynapticsPrivate * priv) { int vertRes = priv->synpara.resolution_vert; int horizRes = priv->synpara.resolution_horiz; @@ -2279,14 +2279,14 @@ CalculateScalingCoeffs(SynapticsPrivate * priv) } void -SynapticsFinishPreInit(SynapticsPrivate *priv) +SynapticsFinishPreInit(struct SynapticsPrivate *priv) { CalculateScalingCoeffs(priv); } /* Wrappers around the frontend hooks */ void -SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, const char *format, ...) +SynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, const char *format, ...) { struct SynapticsFrontend *frontend = priv->frontend; va_list args; @@ -2297,34 +2297,34 @@ SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, const char *format, } unsigned int -SynapticsGetCurrentMillis(SynapticsPrivate *priv) +SynapticsGetCurrentMillis(struct SynapticsPrivate *priv) { struct SynapticsFrontend *frontend = priv->frontend; return frontend->GetCurrentMillis(); } void -SynapticsButtonEvent(SynapticsPrivate *priv, int button, enum ButtonEventType press) +SynapticsButtonEvent(struct SynapticsPrivate *priv, int button, enum ButtonEventType press) { struct SynapticsFrontend *frontend = priv->frontend; return frontend->ButtonEvent(priv, button, press); } void -SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y) +SynapticsMotionEvent(struct SynapticsPrivate *priv, int x, int y) { struct SynapticsFrontend *frontend = priv->frontend; return frontend->MotionEvent(priv, x, y); } -void SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, +void SynapticsScrollEvent(struct SynapticsPrivate *priv, unsigned int which, double vert, double horiz) { struct SynapticsFrontend *frontend = priv->frontend; return frontend->ScrollEvent(priv, which, vert, horiz); } -void SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, +void SynapticsTouchEvent(struct SynapticsPrivate *priv, unsigned int touchid, enum TouchEventType type, struct VMask *mask) { struct SynapticsFrontend *frontend = priv->frontend; @@ -2332,7 +2332,7 @@ void SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, } void -SynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int delay) +SynapticsSetTimer(struct SynapticsPrivate *priv, unsigned int now, unsigned int delay) { struct SynapticsFrontend *frontend = priv->frontend; return frontend->SetTimer(priv, now, delay); diff --git a/src/synaptics.h b/src/synaptics.h index 9bf2193..88c4a58 100644 --- a/src/synaptics.h +++ b/src/synaptics.h @@ -32,7 +32,7 @@ struct SynapticsFrontend { * Generic messaging call. Called by the core driver to output driver log * messages. */ - void (*Msg)(SynapticsPrivate *priv, enum MessageType type, + void (*Msg)(struct SynapticsPrivate *priv, enum MessageType type, const char *format, va_list args); /** * Return the current time in milliseconds. @@ -41,38 +41,38 @@ struct SynapticsFrontend { /** * Post a button event of the given type. */ - void (*ButtonEvent)(SynapticsPrivate *priv, int button, enum ButtonEventType press); + void (*ButtonEvent)(struct SynapticsPrivate *priv, int button, enum ButtonEventType press); /** * Post a motion event. */ - void (*MotionEvent)(SynapticsPrivate *priv, int x, int y); + void (*MotionEvent)(struct SynapticsPrivate *priv, int x, int y); /** * Post a scroll event. */ - void (*ScrollEvent)(SynapticsPrivate *priv, unsigned int which, + void (*ScrollEvent)(struct SynapticsPrivate *priv, unsigned int which, double vert, double horiz); /** * Post a touch event for the given touchid of the given type. */ - void (*TouchEvent)(SynapticsPrivate *priv, unsigned int touchid, + void (*TouchEvent)(struct SynapticsPrivate *priv, unsigned int touchid, enum TouchEventType type, struct VMask *mask); /** * Set a timer to be called delay milliseconds after now. That timer should * call the SynapticsTimerFunc when it fires. */ - void (*SetTimer)(SynapticsPrivate *priv, unsigned int now, unsigned int delay); + void (*SetTimer)(struct SynapticsPrivate *priv, unsigned int now, unsigned int delay); }; /* Wrappers the drivers uses to call the matching frontend calls */ -void SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, const char *format, ...); -unsigned int SynapticsGetCurrentMillis(SynapticsPrivate *priv); -void SynapticsButtonEvent(SynapticsPrivate *priv, int button, enum ButtonEventType press); -void SynapticsMotionEvent(SynapticsPrivate *priv, int x, int y); -void SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, double horiz); -void SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, +void SynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, const char *format, ...); +unsigned int SynapticsGetCurrentMillis(struct SynapticsPrivate *priv); +void SynapticsButtonEvent(struct SynapticsPrivate *priv, int button, enum ButtonEventType press); +void SynapticsMotionEvent(struct SynapticsPrivate *priv, int x, int y); +void SynapticsScrollEvent(struct SynapticsPrivate *priv, unsigned int which, double vert, double horiz); +void SynapticsTouchEvent(struct SynapticsPrivate *priv, unsigned int touchid, enum TouchEventType type, struct VMask *mask); -void SynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int delay); +void SynapticsSetTimer(struct SynapticsPrivate *priv, unsigned int now, unsigned int delay); /** * Initialises the driver-internal structs. Must be the first call to the @@ -80,57 +80,57 @@ void SynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int de * Implemented by: core * @see SynapticsFreePrivate */ -SynapticsPrivate * SynapticsInitPrivate(struct SynapticsFrontend *frontend); +struct SynapticsPrivate * SynapticsInitPrivate(struct SynapticsFrontend *frontend); /** * Deletes driver-associated memory regions. * Implemented by: core * @see SynapticsInitPrivate */ -void SynapticsFreePrivate(SynapticsPrivate **private); +void SynapticsFreePrivate(struct SynapticsPrivate **private); /** * Callback for data available on device file descriptor. Reads data and * posts events to the frontend. * Implemented by: core */ -void SynapticsReadInput(SynapticsPrivate *priv, int fd); +void SynapticsReadInput(struct SynapticsPrivate *priv, int fd); /** * Initialise device-internal structs and get the device ready for sending * events. Returns 1 on success or 0 on error. * Call this before enabling the file descriptor. * Implemented-by: core */ -int SynapticsInitDevice(SynapticsPrivate *priv); +int SynapticsInitDevice(struct SynapticsPrivate *priv); /** * Enable the backend to start sending events. Returns 1 on success or 0 on * error. * Implemented-by: core */ -int SynapticsEnableDevice(SynapticsPrivate *priv, int fd); +int SynapticsEnableDevice(struct SynapticsPrivate *priv, int fd); /** * Disable the backend to stop sending events. Returns 1 on success or 0 on * error. * Implemented-by: core */ -int SynapticsDisableDevice(SynapticsPrivate *priv, int fd); +int SynapticsDisableDevice(struct SynapticsPrivate *priv, int fd); /** * Shut down the device. Call this after disabling the file descriptor. * Implemented-by: core */ -void SynapticsCloseDevice(SynapticsPrivate *priv); +void SynapticsCloseDevice(struct SynapticsPrivate *priv); /** * Finish any device-specifi initialization, once the hardware has been * queried and all non-default parameters have been set. * Implemented-by: core */ -void SynapticsFinishPreInit(SynapticsPrivate * priv); +void SynapticsFinishPreInit(struct SynapticsPrivate * priv); /** * Query the hardware for properties, dimensions, etc. Returns 1 on success * or 0 on failure. * Implemented-by: core */ -Bool SynapticsQueryHardware(SynapticsPrivate *priv, int fd); +Bool SynapticsQueryHardware(struct SynapticsPrivate *priv, int fd); /** * Given a protocol string and/or device file, return the backend protocol @@ -138,7 +138,7 @@ Bool SynapticsQueryHardware(SynapticsPrivate *priv, int fd); * Implemented-by: core */ struct SynapticsProtocolOperations* -SynapticsGetDeviceProtocolOps(SynapticsPrivate *priv, +SynapticsGetDeviceProtocolOps(struct SynapticsPrivate *priv, const char *proto, const char *device, char **used_device); @@ -147,7 +147,7 @@ SynapticsGetDeviceProtocolOps(SynapticsPrivate *priv, * specific timer handler. * Implemented-by: core */ -unsigned int SynapticsTimerFunc(SynapticsPrivate *priv, unsigned int now); +unsigned int SynapticsTimerFunc(struct SynapticsPrivate *priv, unsigned int now); extern struct VMask *vmask_new(int num_valuators); extern void vmask_free(struct VMask **mask); diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 27c7fae..7fe0ab5 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -203,7 +203,7 @@ struct SynapticsParameters { int hyst_x, hyst_y; /* x and y width of hysteresis box */ }; -struct _SynapticsPrivateRec { +struct SynapticsPrivate { struct SynapticsParameters synpara; /* Default parameter settings, read from the X config file */ struct SynapticsProtocolOperations *proto_ops; diff --git a/src/synproto.c b/src/synproto.c index 52325f9..1be77a0 100644 --- a/src/synproto.c +++ b/src/synproto.c @@ -28,7 +28,7 @@ #include <string.h> static int -HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate * priv) +HwStateAllocTouch(struct SynapticsHwState *hw, struct SynapticsPrivate * priv) { int num_vals; int i = 0; @@ -63,7 +63,7 @@ HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate * priv) } struct SynapticsHwState * -SynapticsHwStateAlloc(SynapticsPrivate * priv) +SynapticsHwStateAlloc(struct SynapticsPrivate * priv) { struct SynapticsHwState *hw; diff --git a/src/synproto.h b/src/synproto.h index a7a1785..72b567e 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -42,9 +42,8 @@ #define FALSE 0 #endif -struct _SynapticsPrivateRec; struct VMask; -typedef struct _SynapticsPrivateRec SynapticsPrivate; +struct SynapticsPrivate; typedef int Bool; enum SynapticsSlotState { @@ -96,17 +95,17 @@ struct SynapticsParameters; /* All return 1 on success or 0 otherwise */ struct SynapticsProtocolOperations { - int (*DeviceOnHook) (SynapticsPrivate *priv, + int (*DeviceOnHook) (struct SynapticsPrivate *priv, struct SynapticsParameters * para, int fd); - int (*DeviceOffHook) (SynapticsPrivate *priv, int fd); - int (*QueryHardware) (SynapticsPrivate * priv, int fd); - int (*ReadHwState) (SynapticsPrivate * priv, + int (*DeviceOffHook) (struct SynapticsPrivate *priv, int fd); + int (*QueryHardware) (struct SynapticsPrivate * priv, int fd); + int (*ReadHwState) (struct SynapticsPrivate * priv, int fd, struct CommData * comm, struct SynapticsHwState * hwRet); - int (*AutoDevProbe) (SynapticsPrivate * priv, const char *device, char **device_out); - void (*ReadDevDimensions) (SynapticsPrivate *priv); + int (*AutoDevProbe) (struct SynapticsPrivate * priv, const char *device, char **device_out); + void (*ReadDevDimensions) (struct SynapticsPrivate *priv); }; #ifdef BUILD_PS2COMM @@ -120,7 +119,7 @@ extern struct SynapticsProtocolOperations event_proto_operations; extern struct SynapticsProtocolOperations psm_proto_operations; #endif /* BUILD_PSMCOMM */ -extern struct SynapticsHwState *SynapticsHwStateAlloc(SynapticsPrivate * priv); +extern struct SynapticsHwState *SynapticsHwStateAlloc(struct SynapticsPrivate * priv); extern void SynapticsHwStateFree(struct SynapticsHwState **hw); extern void SynapticsCopyHwState(struct SynapticsHwState *dst, const struct SynapticsHwState *src); diff --git a/test/eventcomm-test.c b/test/eventcomm-test.c index ae434a5..400a5b8 100644 --- a/test/eventcomm-test.c +++ b/test/eventcomm-test.c @@ -38,8 +38,8 @@ #define ArrayLength(a) (sizeof(a) / (sizeof((a)[0]))) -void SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, ...); -void SynapticsMsg(SynapticsPrivate *priv, enum MessageType type, ...) +void SynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, ...); +void SynapticsMsg(struct SynapticsPrivate *priv, enum MessageType type, ...) { } @@ -61,7 +61,7 @@ create_pipe_fd(void) static void reset_data(struct SynapticsHwState **hw, struct CommData *comm, - SynapticsPrivate * priv) + struct SynapticsPrivate * priv) { SynapticsHwStateFree(&comm->hwState); memset(comm, 0, sizeof(struct CommData)); @@ -81,7 +81,7 @@ write_event(int fd, struct input_event *ev, int n) } static void -test_buttons(int write_fd, int read_fd, SynapticsPrivate *priv, struct CommData *comm) +test_buttons(int write_fd, int read_fd, struct SynapticsPrivate *priv, struct CommData *comm) { struct SynapticsHwState *hw = NULL; struct input_event ev = { {0, 0}, EV_KEY, 0, 0 }; @@ -124,7 +124,7 @@ test_buttons(int write_fd, int read_fd, SynapticsPrivate *priv, struct CommData static void test_read_hw_state(void) { - SynapticsPrivate private; + struct SynapticsPrivate private; struct SynapticsHwState *hw = NULL; struct CommData comm = { 0 }; @@ -227,7 +227,7 @@ static void test_ignore_hw_state(void) { int i; - SynapticsPrivate private; + struct SynapticsPrivate private; struct SynapticsHwState *hw = NULL; struct SynapticsHwState *hw_zero = NULL; struct CommData comm = { 0 }; |