On Mon, Mar 21, 2011 at 02:10:42PM -0700, Ping Cheng wrote:
> Tools that are in absolute mode emit left click when the tool touches
> the surface. However, tools in relative mode need to locate the object
> on the surface before it selects (left click on) the object. That is,
> a second event (tap/leave/touch) is needed to trigger a left click for
> relative mode tools.
>
> Tools on touchscreen is in absolute mode. So, send left click
> down/up when the first finger touches/leaves the tablet.
>
> Signed-off-by: Ping Cheng <[email protected]>
> Reviewed-by: Peter Hutterer <[email protected]>
> ---
> src/wcmUSB.c | 22 ++++++++++++++--------
> 1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index 82a0195..4dec1a3 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -975,6 +975,12 @@ static int usbParseAbsEvent(WacomCommonPtr common,
> return change;
> }
>
> +#define MOD_BUTTONS(bit, value) do { \
> + int shift = 1 << (bit); \
> + ds->buttons = (value ? \
added extra () around value to avoid surprises but merged otherwise, thanks
Cheers,
Peter
> + (ds->buttons | (shift)) : (ds->buttons & ~(shift))); \
> + } while (0)
> +
> static int usbParseAbsMTEvent(WacomCommonPtr common, struct input_event
> *event)
> {
> int change = 1;
> @@ -996,6 +1002,13 @@ static int usbParseAbsMTEvent(WacomCommonPtr common,
> struct input_event *event)
> ds->device_id = TOUCH_DEVICE_ID;
> ds->serial_num = private->wcmMTChannel+1;
> ds->sample = (int)GetTimeInMillis();
> +
> + /* Send left click down/up for touchscreen
> + * when the first finger touches/leaves the tablet.
> + */
> + if (TabletHasFeature(common, WCM_LCD) &&
> + !private->wcmMTChannel)
> + MOD_BUTTONS(0, event->value != -1);
> break;
>
> case ABS_MT_POSITION_X:
> @@ -1035,17 +1048,10 @@ static struct
> { PAD_ID, BTN_0 }
> };
>
> -#define MOD_BUTTONS(bit, value) do { \
> - shift = 1<<bit; \
> - ds->buttons = (((value) != 0) ? \
> - (ds->buttons | (shift)) : (ds->buttons & ~(shift))); \
> - } while (0)
> -
> static int usbParseKeyEvent(WacomCommonPtr common,
> struct input_event *event, WacomDeviceState *ds,
> WacomDeviceState *dslast)
> {
> - int shift;
> int change = 1;
>
> /* BTN_TOOL_* are sent to indicate when a specific tool is going
> @@ -1202,7 +1208,7 @@ static int usbParseKeyEvent(WacomCommonPtr common,
> static int usbParseBTNEvent(WacomCommonPtr common,
> struct input_event *event, WacomDeviceState *ds)
> {
> - int shift, nkeys;
> + int nkeys;
> int change = 1;
>
> switch (event->code)
> --
> 1.7.4
>
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Linuxwacom-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel