diff options
author | Jason Gerecke <killertofu@gmail.com> | 2011-11-14 16:52:35 -0800 |
---|---|---|
committer | Jason Gerecke <killertofu@gmail.com> | 2011-11-15 11:21:46 -0800 |
commit | e4aa352f0ded30fcc3ec90a187957f6f8920fd8e (patch) | |
tree | 70207ba6477e7b3dc575b0bdf089eb024999f43a | |
parent | f7c0a64bf6550ac8ada19345bd03916bd4aa8890 (diff) |
Have usbInitToolType return the old tool type if available
If the tool was not specified within an event packet, the
usbInitToolType function would return TOUCH_ID. This caused
problems for combined pen+touch devices when the pen was in
range, since only the first packet (which explicitely specified
the STYLUS tool) would not be filtered as "single touch"
data.
This patch passes along the old tool type, so that if no
tool is found in the current packet, the old tool type may
be adopted.
Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
-rw-r--r-- | src/wcmUSB.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 4d05f67..755c410 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -1345,10 +1345,12 @@ static int usbParseBTNEvent(WacomCommonPtr common, * @param event_ptr A pointer to the USB data packet that contains the * events to be processed. * @param nevents Number of events in the packet. + * @param last_device_type The device type for the last event * - * @return The tool type. TOUCH_ID if no pen/touch/eraser event code in the event. + * @return The tool type. last_device_type if no pen/touch/eraser event code + * in the event, or TOUCH_ID if last_device_type is not a tool. */ -static int usbInitToolType(const struct input_event *event_ptr, int nevents) +static int usbInitToolType(const struct input_event *event_ptr, int nevents, int last_device_type) { int i, device_type = 0; struct input_event* event = (struct input_event *)event_ptr; @@ -1380,7 +1382,10 @@ static int usbInitToolType(const struct input_event *event_ptr, int nevents) if (!device_type) { - device_type = TOUCH_ID; + if (last_device_type) + device_type = last_device_type; + else + device_type = TOUCH_ID; } return device_type; @@ -1417,7 +1422,8 @@ static void usbDispatchEvents(InputInfoPtr pInfo) if (private->wcmUseMT) private->wcmDeviceType = usbInitToolType(private->wcmEvents, - private->wcmEventCnt); + private->wcmEventCnt, + dslast.device_type); if (private->wcmPenTouch) { |