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 <[email protected]> --- src/synaptics.c | 6 +++--- src/synproto.c | 6 +++--- src/synproto.h | 3 +++ 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) */ -- 1.7.7.6 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
