[PATCH xf86-input-synaptics v2 08/13] Add touch slot state array to hw state

Chase Douglas chase.douglas at canonical.com
Thu Feb 9 18:24:52 PST 2012


Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/eventcomm.c |    8 +-------
 src/synaptics.c |    7 +++++++
 src/synproto.h  |    9 +++++++++
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 11fa3d4..62dc347 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -69,13 +69,7 @@ struct eventcomm_proto_data
     struct mtdev *mtdev;
     int axis_map[MT_ABS_SIZE];
     int cur_slot;
-    enum
-    {
-        SLOTSTATE_OPEN = 0,
-        SLOTSTATE_CLOSE,
-        SLOTSTATE_UPDATE,
-        SLOTSTATE_EMPTY,
-    } slot_state;
+    enum SynapticsSlotState slot_state;
     ValuatorMask *mt_mask;
     ValuatorMask **last_mt_vals;
     unsigned int num_touches;
diff --git a/src/synaptics.c b/src/synaptics.c
index 3931081..70819b9 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2856,6 +2856,10 @@ HwStateAllocTouch(struct SynapticsHwState *hw, SynapticsPrivate *priv)
             goto fail;
     }
 
+    hw->slot_state = calloc(hw->num_mt_mask, sizeof(enum SynapticsSlotState));
+    if (!hw->slot_state)
+        goto fail;
+
     return Success;
 
 fail:
@@ -2893,6 +2897,7 @@ SynapticsHwStateFree(struct SynapticsHwState **hw)
 #ifdef HAVE_MULTITOUCH
     int i;
 
+    free((*hw)->slot_state);
     for (i = 0; i < (*hw)->num_mt_mask; i++)
         valuator_mask_free(&(*hw)->mt_mask[i]);
     free((*hw)->mt_mask);
@@ -2925,5 +2930,7 @@ SynapticsCopyHwState(struct SynapticsHwState *dst,
 #ifdef HAVE_MULTITOUCH
     for (i = 0; i < dst->num_mt_mask && i < src->num_mt_mask; i++)
         valuator_mask_copy(dst->mt_mask[i], src->mt_mask[i]);
+    memcpy(dst->slot_state, src->slot_state,
+           dst->num_mt_mask * sizeof(enum SynapticsSlotState));
 #endif
 }
diff --git a/src/synproto.h b/src/synproto.h
index 158c90d..01dbe9a 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -35,6 +35,14 @@
 struct _SynapticsPrivateRec;
 typedef struct _SynapticsPrivateRec SynapticsPrivate;
 
+enum SynapticsSlotState
+{
+    SLOTSTATE_EMPTY = 0,
+    SLOTSTATE_OPEN,
+    SLOTSTATE_CLOSE,
+    SLOTSTATE_UPDATE,
+};
+
 /*
  * A structure to describe the state of the touchpad hardware (buttons and pad)
  */
@@ -57,6 +65,7 @@ struct SynapticsHwState {
 #ifdef HAVE_MULTITOUCH
     int num_mt_mask;
     ValuatorMask **mt_mask;
+    enum SynapticsSlotState *slot_state;
 #endif
 };
 
-- 
1.7.8.3



More information about the xorg-devel mailing list