[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1286549880-32580-4-git-send-email-chase.douglas@canonical.com>
Date: Fri, 8 Oct 2010 10:58:00 -0400
From: Chase Douglas <chase.douglas@...onical.com>
To: linux-input@...r.kernel.org, xorg-devel@...ts.x.org
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Takashi Iwai <tiwai@...e.de>,
Chris Bagwell <chris@...bagwell.com>,
Andy Whitcroft <apw@...onical.com>,
Henrik Rydberg <rydberg@...omail.se>,
linux-kernel@...r.kernel.org,
Peter Hutterer <peter.hutterer@...-t.net>,
Duncan McGreggor <duncan.mcgreggor@...onical.com>
Subject: [PATCH 3/3] Input: synaptics - remove touches over button click area
Now that we have proper multitouch support, we can handle integrated
buttons better. If we know the top of the buttons on the touchpad, we
can ignore any touches that occur within the touchpad area while a
button is clicked. It may be possible to get the button area by querying
the device, but for now allow the user to manually set it.
A note on why this works: the Synaptics touchpads have pseudo touch
tracking. When two touches are on the touchpad, an MT touch packet with
just the X, Y, and pressure values is sent before a normal Synaptics
touch packet. When one touch is obviously in motion and the other is
stationary, the touchpad controller sends the touch in motion in the
normal packet and the stationary touch in the MT packet. Single touch
emulation is provided by the normal packet, so an action like clicking
a button and dragging with another finger still works as expected.
Tested on a Dell Mini 1012 with synaptics_multitouch=1 and
synaptics_button_thresh=4100.
Signed-off-by: Chase Douglas <chase.douglas@...onical.com>
---
drivers/input/mouse/synaptics.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 7289d88..e67778d 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -49,6 +49,12 @@ module_param(synaptics_multitouch, bool, 0644);
MODULE_PARM_DESC(synaptics_multitouch,
"Enable multitouch mode on Synaptics devices");
+static int synaptics_button_thresh = YMIN_NOMINAL + YMAX_NOMINAL;
+module_param(synaptics_button_thresh, int, 0644);
+MODULE_PARM_DESC(synaptics_button_thres,
+ "Y coordinate threshold of integrated buttons on Synaptics "
+ "devices");
+
/*****************************************************************************
* Stuff we need even when we do not want native Synaptics support
****************************************************************************/
@@ -463,6 +469,10 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
}
}
+#define TOUCH_OVER_BUTTON(hw) (((hw).left || (hw).middle || (hw).right) && \
+ (YMAX_NOMINAL + YMIN_NOMINAL - (hw).y > \
+ synaptics_button_thresh))
+
/*
* called for each full received packet from the touchpad
*/
@@ -477,7 +487,7 @@ static void synaptics_process_packet(struct psmouse *psmouse)
synaptics_parse_hw_state(psmouse->packet, priv, &hw);
if (SYN_MULTITOUCH(priv, &hw)) {
- if (hw.z > 0) {
+ if (hw.z > 0 && !TOUCH_OVER_BUTTON(hw)) {
input_report_abs(dev, ABS_MT_POSITION_X, hw.x);
input_report_abs(dev, ABS_MT_POSITION_Y,
YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
@@ -509,6 +519,10 @@ static void synaptics_process_packet(struct psmouse *psmouse)
return;
}
+ /* If touch occurs over depressed button, ignore it */
+ if (TOUCH_OVER_BUTTON(hw))
+ hw.z = 0;
+
if (hw.z > 0) {
priv->num_fingers++;
finger_width = 5;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists