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]> --- v2 changes: Updated macro MOD_BUTTONS and commit comments. Added Reviewed-by. src/wcmUSB.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 79d9ae7..cfcb6b2 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -979,6 +979,12 @@ static int usbParseAbsEvent(WacomCommonPtr common, return change; } +#define MOD_BUTTONS(bit, value) do { \ + int shift = 1 << (bit); \ + ds->buttons = (value ? \ + (ds->buttons | (shift)) : (ds->buttons & ~(shift))); \ + } while (0) + static int usbParseAbsMTEvent(WacomCommonPtr common, struct input_event *event) { int change = 1; @@ -1000,6 +1006,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: @@ -1039,17 +1052,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 @@ -1206,7 +1212,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 ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
