summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-09 15:38:25 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-14 08:46:50 +1000
commita64e1632836067091be5ca45d0444c416bf48948 (patch)
treef2d9b8cf316c092279249621666633ab433eac5b
parent70b4e983c6626b9b20bdf59324f64b3fd99c5202 (diff)
Add a BTN_EMULATED_FLAG to mark emulated buttons on clickfingers
And when copying the hardware state, don't copy those buttons that were set through emulation. This is a temporary fix only, we should add new fields to the hw struct that represent the various features as they are enabled/disabled and then treat them accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r--src/synaptics.c6
-rw-r--r--src/synproto.c6
-rw-r--r--src/synproto.h3
3 files changed, 9 insertions, 6 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index e360238..6143005 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2399,15 +2399,15 @@ handle_clickfinger(SynapticsParameters *para, struct SynapticsHwState *hw)
}
switch(action){
case 1:
- hw->left = 1;
+ hw->left = 1 | BTN_EMULATED_FLAG;
break;
case 2:
hw->left = 0;
- hw->middle = 1;
+ hw->middle = 1 | BTN_EMULATED_FLAG;
break;
case 3:
hw->left = 0;
- hw->right = 1;
+ hw->right = 1 | BTN_EMULATED_FLAG;
break;
}
}
diff --git a/src/synproto.c b/src/synproto.c
index 0426e8f..21e88c4 100644
--- a/src/synproto.c
+++ b/src/synproto.c
@@ -122,12 +122,12 @@ SynapticsCopyHwState(struct SynapticsHwState *dst,
dst->z = src->z;
dst->numFingers = src->numFingers;
dst->fingerWidth = src->fingerWidth;
- dst->left = src->left;
- dst->right = src->right;
+ dst->left = src->left & BTN_EMULATED_FLAG ? 0 : src->left;
+ dst->right = src->right & BTN_EMULATED_FLAG ? 0 : src->right;
dst->up = src->up;
dst->down = src->down;
memcpy(dst->multi, src->multi, sizeof(dst->multi));
- dst->middle = src->middle;
+ dst->middle = src->middle & BTN_EMULATED_FLAG ? 0 : src->middle;
#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]);
diff --git a/src/synproto.h b/src/synproto.h
index 89392ac..5e8a804 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -45,6 +45,9 @@ enum SynapticsSlotState
SLOTSTATE_UPDATE,
};
+/* used to mark emulated hw button state */
+#define BTN_EMULATED_FLAG 0x80
+
/*
* A structure to describe the state of the touchpad hardware (buttons and pad)
*/