[PATCH synaptics 2/9] Remove typedefs from all enums

Peter Hutterer peter.hutterer at who-t.net
Wed May 30 22:20:00 PDT 2012


We currently mix non-typedef'd and typedef'd enums in the code. Stop this
mixing, remove typedefs to make the code more obvious.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c    |   22 +++++++++++-----------
 src/synapticsstr.h |    8 ++++----
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 3a88b54..1b65918 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -77,7 +77,7 @@
 #include "synapticsstr.h"
 #include "synaptics-properties.h"
 
-typedef enum {
+enum EdgeType {
     NO_EDGE = 0,
     BOTTOM_EDGE = 1,
     TOP_EDGE = 2,
@@ -87,7 +87,7 @@ typedef enum {
     RIGHT_BOTTOM_EDGE = BOTTOM_EDGE | RIGHT_EDGE,
     RIGHT_TOP_EDGE = TOP_EDGE | RIGHT_EDGE,
     LEFT_TOP_EDGE = TOP_EDGE | LEFT_EDGE
-} edge_type;
+};
 
 /*
  * We expect to be receiving a steady 80 packets/sec (which gives 40
@@ -1307,10 +1307,10 @@ diffa(double a1, double a2)
     return da;
 }
 
-static edge_type
+static enum EdgeType
 edge_detection(SynapticsPrivate * priv, int x, int y)
 {
-    edge_type edge = NO_EDGE;
+    enum EdgeType edge = NO_EDGE;
 
     if (x > priv->synpara.right_edge)
         edge |= RIGHT_EDGE;
@@ -1621,9 +1621,9 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw)
 }
 
 static void
-SelectTapButton(SynapticsPrivate * priv, edge_type edge)
+SelectTapButton(SynapticsPrivate * priv, enum EdgeType edge)
 {
-    TapEvent tap;
+    enum TapEvent tap;
 
     if (priv->synpara.touchpad_off == 2) {
         priv->tap_button = 0;
@@ -1746,7 +1746,7 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
     SynapticsParameters *para = &priv->synpara;
     Bool touch, release, is_timeout, move, press;
     int timeleft, timeout;
-    edge_type edge;
+    enum EdgeType edge;
     int delay = 1000000000;
 
     if (priv->finger_state == FS_BLOCKED)
@@ -1984,7 +1984,7 @@ hysteresis(int in, int center, int margin)
 
 static void
 get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
-          edge_type edge, double *dx, double *dy)
+          enum EdgeType edge, double *dx, double *dy)
 {
     double dtime = (hw->millis - HIST(0).millis) / 1000.0;
     double integral;
@@ -2018,7 +2018,7 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
  */
 static int
 ComputeDeltas(SynapticsPrivate * priv, const struct SynapticsHwState *hw,
-              edge_type edge, int *dxP, int *dyP, Bool inside_area)
+              enum EdgeType edge, int *dxP, int *dyP, Bool inside_area)
 {
     enum MovingState moving_state;
     double dx, dy;
@@ -2162,7 +2162,7 @@ stop_coasting(SynapticsPrivate * priv)
 
 static int
 HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
-                edge_type edge, Bool finger)
+                enum EdgeType edge, Bool finger)
 {
     SynapticsParameters *para = &priv->synpara;
     int delay = 1000000000;
@@ -2750,7 +2750,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     SynapticsParameters *para = &priv->synpara;
     enum FingerState finger = FS_UNTOUCHED;
     int dx = 0, dy = 0, buttons, id;
-    edge_type edge = NO_EDGE;
+    enum EdgeType edge = NO_EDGE;
     int change;
     int double_click = FALSE;
     int delay = 1000000000;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 384b7bb..659625e 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -48,7 +48,7 @@
 #define SYNAPTICS_MAX_TOUCHES	10
 #define SYN_MAX_BUTTONS 12      /* Max number of mouse buttons */
 
-typedef enum {
+enum TapEvent {
     RT_TAP = 0,                 /* Right top corner */
     RB_TAP,                     /* Right bottom corner */
     LT_TAP,                     /* Left top corner */
@@ -57,14 +57,14 @@ 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 _SynapticsMoveHist {
-- 
1.7.10.1



More information about the xorg-devel mailing list