diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-23 13:58:21 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-31 14:56:49 +1000 |
commit | e8181fa403172e15f2ccaa8b307d1e6f3b36179d (patch) | |
tree | 2f8625b642cba6e1942cd95c393ff6dec83c572c | |
parent | d266408ed17b81edcf23625258f8859d6cbd43c0 (diff) |
Un-typedef struct VMask
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/eventcomm.c | 6 | ||||
-rw-r--r-- | src/synaptics-dummy.c | 2 | ||||
-rw-r--r-- | src/synaptics-vmask.c | 32 | ||||
-rw-r--r-- | src/synaptics-x11.c | 4 | ||||
-rw-r--r-- | src/synaptics.c | 8 | ||||
-rw-r--r-- | src/synaptics.h | 34 | ||||
-rw-r--r-- | src/synapticsstr.h | 14 | ||||
-rw-r--r-- | src/synproto.c | 2 | ||||
-rw-r--r-- | src/synproto.h | 4 |
9 files changed, 53 insertions, 53 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index 1274cae..87c77b5 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -76,7 +76,7 @@ struct eventcomm_proto_data { struct mtdev *mtdev; int axis_map[MT_ABS_SIZE]; int cur_slot; - VMask **last_mt_vals; + struct VMask **last_mt_vals; int num_touches; }; @@ -148,7 +148,7 @@ InitializeTouch(SynapticsPrivate * priv, int fd) proto_data->cur_slot = proto_data->mtdev->caps.slot.value; proto_data->num_touches = 0; - proto_data->last_mt_vals = calloc(priv->num_slots, sizeof(VMask *)); + proto_data->last_mt_vals = calloc(priv->num_slots, sizeof(struct VMask *)); if (!proto_data->last_mt_vals) { SynapticsMsg(priv, MSG_WARN, "failed to allocate MT last values mask array\n"); @@ -551,7 +551,7 @@ EventProcessTouchEvent(SynapticsPrivate *priv, struct SynapticsHwState *hw, vmask_set(hw->mt_mask[slot_index], map, ev->value); if (slot_index >= 0) { - VMask *mask = proto_data->last_mt_vals[slot_index]; + struct VMask *mask = proto_data->last_mt_vals[slot_index]; int last_val = vmask_get(mask, map); if (EventTouchSlotPreviouslyOpen(priv, slot_index)) { diff --git a/src/synaptics-dummy.c b/src/synaptics-dummy.c index 33257c4..4aa0339 100644 --- a/src/synaptics-dummy.c +++ b/src/synaptics-dummy.c @@ -65,7 +65,7 @@ DummySynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double ver void DummySynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, - enum TouchEventType type, VMask *mask) + enum TouchEventType type, struct VMask *mask) { SynapticsMsg(priv, MSG_INFO,"Touch <%u> %s\n", touchid, (type == T_BEGIN) ? "begin" : ((type == T_END) ? "end" : "update")); diff --git a/src/synaptics-vmask.c b/src/synaptics-vmask.c index e768f30..284a597 100644 --- a/src/synaptics-vmask.c +++ b/src/synaptics-vmask.c @@ -57,13 +57,13 @@ count_bits(const uint8_t * mask, int len) /** * Alloc a valuator mask large enough for num_valuators. */ -VMask* +struct VMask* vmask_new(int num_valuators) { /* alloc a fixed size mask for now and ignore num_valuators. in the * flying-car future, when we can dynamically alloc the masks and are * not constrained by signals, we can start using num_valuators */ - VMask *mask = calloc(1, sizeof(VMask)); + struct VMask *mask = calloc(1, sizeof(struct VMask)); if (mask == NULL) return NULL; @@ -73,7 +73,7 @@ vmask_new(int num_valuators) } void -vmask_free(VMask **mask) +vmask_free(struct VMask **mask) { free(*mask); *mask = NULL; @@ -84,7 +84,7 @@ vmask_free(VMask **mask) * the data in the valuators array. All other values are set to 0. */ void -vmask_set_range(VMask *mask, int first_valuator, +vmask_set_range(struct VMask *mask, int first_valuator, int num_valuators, const int *valuators) { int i; @@ -100,7 +100,7 @@ vmask_set_range(VMask *mask, int first_valuator, * Reset mask to zero. */ void -vmask_zero(VMask *mask) +vmask_zero(struct VMask *mask) { memset(mask, 0, sizeof(*mask)); mask->last_bit = -1; @@ -111,7 +111,7 @@ vmask_zero(VMask *mask) * valuators currently set + 1). */ int -vmask_size(const VMask *mask) +vmask_size(const struct VMask *mask) { return mask->last_bit + 1; } @@ -120,7 +120,7 @@ vmask_size(const VMask *mask) * Returns the number of valuators set in the given mask. */ int -vmask_num_valuators(const VMask *mask) +vmask_num_valuators(const struct VMask *mask) { return count_bits(mask->mask, min(mask->last_bit + 1, MAX_NUM_VALUATORS)); } @@ -129,7 +129,7 @@ vmask_num_valuators(const VMask *mask) * Return true if the valuator is set in the mask, or false otherwise. */ int -vmask_isset(const VMask *mask, int valuator) +vmask_isset(const struct VMask *mask, int valuator) { return mask->last_bit >= valuator && BitIsOn(mask->mask, valuator); } @@ -138,7 +138,7 @@ vmask_isset(const VMask *mask, int valuator) * Set the valuator to the given floating-point data. */ void -vmask_set_double(VMask *mask, int valuator, double data) +vmask_set_double(struct VMask *mask, int valuator, double data) { mask->last_bit = max(valuator, mask->last_bit); SetBit(mask->mask, valuator); @@ -149,7 +149,7 @@ vmask_set_double(VMask *mask, int valuator, double data) * Set the valuator to the given integer data. */ void -vmask_set(VMask *mask, int valuator, int data) +vmask_set(struct VMask *mask, int valuator, int data) { vmask_set_double(mask, valuator, data); } @@ -159,7 +159,7 @@ vmask_set(VMask *mask, int valuator, int data) * set for the given valuator, the returned value is undefined. */ double -vmask_get_double(const VMask *mask, int valuator) +vmask_get_double(const struct VMask *mask, int valuator) { return mask->valuators[valuator]; } @@ -170,7 +170,7 @@ vmask_get_double(const VMask *mask, int valuator) * undefined. */ int -vmask_get(const VMask *mask, int valuator) +vmask_get(const struct VMask *mask, int valuator) { return trunc(vmask_get_double(mask, valuator)); } @@ -183,7 +183,7 @@ vmask_get(const VMask *mask, int valuator) * FALSE is returned. */ Bool -vmask_fetch_double(const VMask *mask, int valuator, +vmask_fetch_double(const struct VMask *mask, int valuator, double *value) { if (vmask_isset(mask, valuator)) { @@ -202,7 +202,7 @@ vmask_fetch_double(const VMask *mask, int valuator, * FALSE is returned. */ Bool -vmask_fetch(const VMask *mask, int valuator, int *value) +vmask_fetch(const struct VMask *mask, int valuator, int *value) { if (vmask_isset(mask, valuator)) { *value = vmask_get(mask, valuator); @@ -216,7 +216,7 @@ vmask_fetch(const VMask *mask, int valuator, int *value) * Remove the valuator from the mask. */ void -vmask_unset(VMask *mask, int valuator) +vmask_unset(struct VMask *mask, int valuator) { if (mask->last_bit >= valuator) { int i, lastbit = -1; @@ -232,7 +232,7 @@ vmask_unset(VMask *mask, int valuator) } void -vmask_copy(VMask *dest, const VMask *src) +vmask_copy(struct VMask *dest, const struct VMask *src) { if (src) memcpy(dest, src, sizeof(*dest)); diff --git a/src/synaptics-x11.c b/src/synaptics-x11.c index ab00307..71b0f7a 100644 --- a/src/synaptics-x11.c +++ b/src/synaptics-x11.c @@ -71,7 +71,7 @@ static void X11SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, double horiz); static void X11SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, - enum TouchEventType type, VMask *mask); + enum TouchEventType type, struct VMask *mask); static void X11SynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int delay); @@ -863,7 +863,7 @@ X11SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, double vert, static void X11SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, - enum TouchEventType type, VMask *mask) + enum TouchEventType type, struct VMask *mask) { struct SynapticsX11 *x11 = priv->frontend_data; InputInfoPtr pInfo = x11->pInfo; diff --git a/src/synaptics.c b/src/synaptics.c index b370950..2049b16 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -992,7 +992,7 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw) static void SelectTapButton(SynapticsPrivate * priv, enum EdgeType edge) { - TapEvent tap; + enum TapEvent tap; if (priv->synpara.touchpad_off == 2) { priv->tap_button = 0; @@ -1775,7 +1775,7 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv, int i, j; for (i = 0; i < hw->num_mt_mask - 1; i++) { - VMask *f1; + struct VMask *f1; if (hw->slot_state[i] == SLOTSTATE_EMPTY || hw->slot_state[i] == SLOTSTATE_CLOSE) @@ -1784,7 +1784,7 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv, f1 = hw->mt_mask[i]; for (j = i + 1; j < hw->num_mt_mask; j++) { - VMask *f2; + struct VMask *f2; double x1, x2, y1, y2; if (hw->slot_state[j] == SLOTSTATE_EMPTY || @@ -2325,7 +2325,7 @@ void SynapticsScrollEvent(SynapticsPrivate *priv, unsigned int which, } void SynapticsTouchEvent(SynapticsPrivate *priv, unsigned int touchid, - enum TouchEventType type, VMask *mask) + enum TouchEventType type, struct VMask *mask) { struct SynapticsFrontend *frontend = priv->frontend; return frontend->TouchEvent(priv, touchid, type, mask); diff --git a/src/synaptics.h b/src/synaptics.h index 47971d9..9bf2193 100644 --- a/src/synaptics.h +++ b/src/synaptics.h @@ -55,7 +55,7 @@ struct SynapticsFrontend { * Post a touch event for the given touchid of the given type. */ void (*TouchEvent)(SynapticsPrivate *priv, unsigned int touchid, - enum TouchEventType type, VMask *mask); + 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. @@ -71,7 +71,7 @@ void SynapticsButtonEvent(SynapticsPrivate *priv, int button, enum ButtonEventTy 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, - enum TouchEventType type, VMask *mask); + enum TouchEventType type, struct VMask *mask); void SynapticsSetTimer(SynapticsPrivate *priv, unsigned int now, unsigned int delay); /** @@ -149,23 +149,23 @@ SynapticsGetDeviceProtocolOps(SynapticsPrivate *priv, */ unsigned int SynapticsTimerFunc(SynapticsPrivate *priv, unsigned int now); -extern VMask *vmask_new(int num_valuators); -extern void vmask_free(VMask **mask); -extern void vmask_set_range(VMask *mask, +extern struct VMask *vmask_new(int num_valuators); +extern void vmask_free(struct VMask **mask); +extern void vmask_set_range(struct VMask *mask, int first_valuator, int num_valuators, const int *valuators); -extern void vmask_set(VMask *mask, int valuator, int data); -extern void vmask_set_double(VMask *mask, int valuator, double data); -extern void vmask_zero(VMask *mask); -extern int vmask_size(const VMask *mask); -extern int vmask_isset(const VMask *mask, int bit); -extern void vmask_unset(VMask *mask, int bit); -extern int vmask_num_valuators(const VMask *mask); -extern void vmask_copy(VMask *dest, const VMask *src); -extern int vmask_get(const VMask *mask, int valnum); -extern double vmask_get_double(const VMask *mask, int valnum); -extern Bool vmask_fetch(const VMask *mask, int valnum, int *val); -extern Bool vmask_fetch_double(const VMask *mask, int valnum, double *val); +extern void vmask_set(struct VMask *mask, int valuator, int data); +extern void vmask_set_double(struct VMask *mask, int valuator, double data); +extern void vmask_zero(struct VMask *mask); +extern int vmask_size(const struct VMask *mask); +extern int vmask_isset(const struct VMask *mask, int bit); +extern void vmask_unset(struct VMask *mask, int bit); +extern int vmask_num_valuators(const struct VMask *mask); +extern void vmask_copy(struct VMask *dest, const struct VMask *src); +extern int vmask_get(const struct VMask *mask, int valnum); +extern double vmask_get_double(const struct VMask *mask, int valnum); +extern Bool vmask_fetch(const struct VMask *mask, int valnum, int *val); +extern Bool vmask_fetch_double(const struct VMask *mask, int valnum, double *val); #endif /* _SYNAPTICS_H_ */ diff --git a/src/synapticsstr.h b/src/synapticsstr.h index e0b9664..9023374 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -62,7 +62,7 @@ enum ScrollEventType { SCROLL_HORIZ = 2, }; -typedef enum { +enum TapEvent { RT_TAP = 0, /* Right top corner */ RB_TAP, /* Right bottom corner */ LT_TAP, /* Left top corner */ @@ -71,20 +71,20 @@ typedef enum { F2_TAP, /* Non-corner tap, two fingers */ F3_TAP, /* Non-corner tap, three fingers */ MAX_TAP -} TapEvent; +}; -typedef enum { +enum ClickFingerEvent { F1_CLICK1 = 0, /* Click left, one finger */ F2_CLICK1, /* Click left, two fingers */ F3_CLICK1, /* Click left, three fingers */ MAX_CLICK -} ClickFingerEvent; +}; -typedef struct _VMask { +struct VMask { int8_t last_bit; /* highest bit set in mask */ uint8_t mask[(MAX_NUM_VALUATORS + 7) / 8]; double valuators[MAX_NUM_VALUATORS]; /* valuator data */ -} VMask; +}; typedef struct _SynapticsMoveHist { int x, y; @@ -286,7 +286,7 @@ struct _SynapticsPrivateRec { int scroll_axis_horiz; /* Horizontal smooth-scrolling axis */ int scroll_axis_vert; /* Vertical smooth-scrolling axis */ - VMask *scroll_events_mask; /* ValuatorMask for smooth-scrolling */ + struct VMask *scroll_events_mask; /* ValuatorMask for smooth-scrolling */ Bool has_touch; /* Device has multitouch capabilities */ int max_touches; /* Number of touches supported */ diff --git a/src/synproto.c b/src/synproto.c index 10b1c72..52325f9 100644 --- a/src/synproto.c +++ b/src/synproto.c @@ -34,7 +34,7 @@ HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate * priv) int i = 0; hw->num_mt_mask = priv->num_slots; - hw->mt_mask = malloc(hw->num_mt_mask * sizeof(VMask *)); + hw->mt_mask = malloc(hw->num_mt_mask * sizeof(struct VMask *)); if (!hw->mt_mask) goto fail; diff --git a/src/synproto.h b/src/synproto.h index be7cf15..8a4e5a2 100644 --- a/src/synproto.h +++ b/src/synproto.h @@ -43,7 +43,7 @@ #endif struct _SynapticsPrivateRec; -struct _VMask; +struct VMask; typedef struct _SynapticsPrivateRec SynapticsPrivate; typedef int Bool; @@ -80,7 +80,7 @@ struct SynapticsHwState { Bool middle; /* Some ALPS touchpads have a middle button */ int num_mt_mask; - struct _VMask **mt_mask; + struct VMask **mt_mask; enum SynapticsSlotState *slot_state; }; |