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

Chase Douglas chase.douglas at canonical.com
Wed Feb 8 18:35:17 PST 2012


Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/eventcomm.c |    8 +-------
 src/synaptics.c |   12 ++++++++++++
 src/synproto.h  |    9 +++++++++
 3 files changed, 22 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 b01be59..8df93fe 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2873,13 +2873,20 @@ fail:
     if (i < hw->num_mt_mask)
         goto fail;
 
+    hw->slot_state = calloc(hw->num_mt_mask, sizeof(enum SynapticsSlotState));
+    if (!hw->slot_state)
+        goto fail;
+
     return hw;
 
 fail:
     for (i--; i >= 0; i--)
         valuator_mask_free(&hw->mt_mask[i]);
     if (hw)
+    {
+        free(hw->slot_state);
         free(hw->mt_mask);
+    }
     free(hw);
 #endif
 
@@ -2894,6 +2901,9 @@ SynapticsHwStateFree(struct SynapticsHwState *hw)
 
     for (i = 0; i < hw->num_mt_mask; i++)
         valuator_mask_free(&hw->mt_mask[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);
 #endif
 
@@ -2923,5 +2933,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 02bc732..a3dfb8c 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