[Linuxwacom-devel] [PATCH 1/3] Don't emulate a mouse when multitouch is enabled.

2013-05-24 Thread Sjoerd Simons
Currently when enabling XI 1.2 multitouch events the Wacom driver does a
strange mix of emulating a mouse (when there is only touch) and
switches suddenly switches to be a touchscreen when 2 fingers are down.

Change this to only send touch events when using multitouch mode, such
that the touchscreen works the same as other touchscreens. This enables
applications to properly respond to one finger touches (e.g. panning
in GTK+).

The X server core will still send emulated input events to applications
not supporting multitouch, so there shouldn't be a regression for those
applications.

Signed-off-by: Sjoerd Simons 
---
 src/wcmCommon.c  |8 +++-
 src/wcmTouchFilter.c |   51 +-
 2 files changed, 20 insertions(+), 39 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 1ab2490..5a5921c 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -970,8 +970,14 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
if (pChannel->nSamples < common->wcmRawSample) ++pChannel->nSamples;
 
if ((ds.device_type == TOUCH_ID) && common->wcmTouch)
+   {
wcmGestureFilter(priv, ds.serial_num - 1);
-
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
+   /* When using XI 1.2 multitouch events don't do common 
dispatching */
+   if (!common->wcmGesture)
+ return;
+#endif
+   }
/* For touch, only first finger moves the cursor */
if ((common->wcmTouch && ds.device_type == TOUCH_ID && ds.serial_num == 
1) ||
(ds.device_type != TOUCH_ID))
diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 5e0d349..1720a76 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -37,7 +37,6 @@
 #define GESTURE_LAG_MODE  8
 #define GESTURE_PREDRAG_MODE 16
 #define GESTURE_DRAG_MODE32
-#define GESTURE_MULTITOUCH_MODE  64
 
 #define WCM_SCROLL_UP 5/* vertical up */
 #define WCM_SCROLL_DOWN   4/* vertical down */
@@ -103,12 +102,9 @@ static void getStateHistory(WacomCommonPtr common, 
WacomDeviceState states[], in
  *
  * @param[in] priv
  * @param[in] channelChannel to send a touch event for
- * @param[in] no_update  If 'true', TouchUpdate events will not be created.
- * This should be used when entering multitouch mode to ensure TouchBegin
- * events are sent for already-in-prox contacts.
  */
 static void
-wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel, Bool no_update)
+wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr channel)
 {
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
ValuatorMask *mask = priv->common->touch_mask;
@@ -123,7 +119,7 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr 
channel, Bool no_update)
DBG(6, priv->common, "This is a touch end event\n");
type = XI_TouchEnd;
}
-   else if (!oldstate.proximity || no_update) {
+   else if (!oldstate.proximity) {
DBG(6, priv->common, "This is a touch begin event\n");
type = XI_TouchBegin;
}
@@ -147,35 +143,18 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr 
channel, Bool no_update)
  */
 static void
 wcmFingerMultitouch(WacomDevicePtr priv, int contact_id) {
-   Bool lag_mode = priv->common->wcmGestureMode == GESTURE_LAG_MODE;
-   Bool prox = FALSE;
int i;
 
-   if (lag_mode && TabletHasFeature(priv->common, WCM_LCD)) {
-   /* wcmSingleFingerPress triggers a button press as
-* soon as a single finger appears. ensure we release
-* that button before getting too far along
-*/
-   wcmSendButtonClick(priv, 1, 0);
-   }
-
for (i = 0; i < MAX_CHANNELS; i++) {
WacomChannelPtr channel = priv->common->wcmChannel+i;
WacomDeviceState state  = channel->valid.state;
if (state.device_type != TOUCH_ID)
continue;
 
-   if (lag_mode || state.serial_num == contact_id + 1) {
-   wcmSendTouchEvent(priv, channel, lag_mode);
+   if (state.serial_num == contact_id + 1) {
+   wcmSendTouchEvent(priv, channel);
}
-
-   prox |= state.proximity;
}
-
-   if (!prox)
-   priv->common->wcmGestureMode = GESTURE_NONE_MODE;
-   else if (lag_mode)
-   priv->common->wcmGestureMode = GESTURE_MULTITOUCH_MODE;
 }
 
 static double touchDistance(WacomDeviceState ds0, WacomDeviceState ds1)
@@ -373,6 +352,15 @@ void wcmGestureFilter(WacomDevicePtr priv, int touch_id)
WacomCommonPtr common = priv->common;
WacomDeviceState ds[2] = {{0}}, dsLast[2] = {{0}};
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
+   /* Send multitouch data to X if appropriate */
+   if (!common->wcmGesture)
+   {
+ 

[Linuxwacom-devel] [PATCH 2/3] Transform touch events just like all other events

2013-05-24 Thread Sjoerd Simons
Transform touch coordinates in the same way as other events coming from
the wacom driver otherwise setting for exmaple the Wacom Rotation
property has no effect

Signed-off-by: Sjoerd Simons 
---
 src/wcmTouchFilter.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c
index 1720a76..7850724 100644
--- a/src/wcmTouchFilter.c
+++ b/src/wcmTouchFilter.c
@@ -112,6 +112,8 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr 
channel)
WacomDeviceState oldstate = channel->valid.states[1];
int type = -1;
 
+   wcmRotateAndScaleCoordinates (priv->pInfo, &state.x, &state.y);
+
valuator_mask_set(mask, 0, state.x);
valuator_mask_set(mask, 1, state.y);
 
@@ -139,7 +141,7 @@ wcmSendTouchEvent(WacomDevicePtr priv, WacomChannelPtr 
channel)
  * generated.
  *
  * @param[in] priv
- * @param[in] contact_id  ID of the contact to send event for (at minimum)
+ * @param[in] contact_id  ID of the contact to send event for
  */
 static void
 wcmFingerMultitouch(WacomDevicePtr priv, int contact_id) {
-- 
1.7.10.4


--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 3/3] By default turn of gesture detection for touchscreens

2013-05-24 Thread Sjoerd Simons
From: Sjoerd Simons 

In case of a screen integrated tablet with touch support change the
defaults such that multitouch events are used instead of the driver
builtin gesture recognition. This, by default, makes the wacom
touchscreens behave the same as other touchscreens and allows for better
integration with applications.

For external tablets keep the default to recognizing gestures, no real
applications really support indirect touch events so better to keep it
in the driver (just like e.g. the synaptics driver does).

Signed-off-by: Sjoerd Simons 
---
 man/wacom.man   |7 ---
 src/wcmValidateDevice.c |8 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/man/wacom.man b/man/wacom.man
index 98dec37..9f74ba1 100644
--- a/man/wacom.man
+++ b/man/wacom.man
@@ -232,9 +232,10 @@ The threshold applies to the normalised pressure range of 
[0..2048].
 The default is 27.
 .TP 4
 .B Option \fI"Gesture"\fP \fI"bool"\fP
-Enable or disable multi-finger in-driver gesture support on the device. 
Default: off
-unless the tablet supports multi-touch. Note that disabling this option may 
allow
-the desktop environment to detect multi-finger gestures instead.
+Enable or disable multi-finger in-driver gesture support on the device.  
Default: off
+if the tablet is a touchscreen and supports multi-touch, on otherwise. Note 
that
+disabling this option allows the desktop environment to detect multi-finger
+gestures instead.
 .TP 4
 .B Option \fI"ZoomDistance"\fP \fI"number"\fP
 If
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 81e9a2a..6597158 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -909,9 +909,13 @@ Bool wcmPreInitParseOptions(InputInfoPtr pInfo, Bool 
is_primary,
{
int gesture_is_on;
 
-   /* GestureDefault was off for all devices
-* except when multi-touch is supported */
+   /* GestureDefault is off for all devices
+* except when multi-touch is supported for non-touchscreens */
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
+   common->wcmGestureDefault = !TabletHasFeature(common, WCM_LCD);
+#else
common->wcmGestureDefault = 1;
+#endif
 
gesture_is_on = xf86SetBoolOption(pInfo->options, "Gesture",
common->wcmGestureDefault);
-- 
1.7.10.4


--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] Improve touchscreen behaviour

2013-05-24 Thread Sjoerd Simons
The following patch series tries to improve the behaviour of builtin wacom
touch screens somewhat. Most importantly it ensures that when multi-touch
events are enabled (or rather gesture detections is disable) the driver only
sends touch events for touch instead of doing a somewhat odd mix between
emulating a mouse and being a real touchscreen.


--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] libwacom not recognizing touch(screen) devices

2013-05-24 Thread Sjoerd Simons
On Tue, 2013-04-16 at 10:35 +1000, Peter Hutterer wrote:
> On Mon, Mar 25, 2013 at 09:22:20AM +0100, Sjoerd Simons wrote:
> > Making libwacom recognize the touch
> > device as a wacom device solves this issue (As it makes gnome set the
> > wacom rotation for it)
> 
> sorry, too simple a fix and too many wide-reaching consequences. we'll need
> something a lot narrower than this.
> 
> http://sourceforge.net/mailarchive/forum.php?thread_name=CAGK%2BT_%3DiyfZKXCUJ4jFChy%2Bb0U3%3DGbfMMAJVY%2BQ2aVkiZnusMQ%40mail.gmail.com&forum_name=linuxwacom-devel

Looking as Bastiens example the problem is calling
libwacom_new_from_path with WFALLBACK_GENERIC, which always creates a
device if it doesn't know the model.. The same problem would occur with
tablets from a vendor that's not wacom. There just aren't that many of
those vs. non-wacom touchscreens :).

Attached is an updated version of the patch which prevents
false-positives by checking whether a touchscreen device uses the wacom
kernel driver (by checking the ID_USB_DRIVER property from udev)

-- 
Sjoerd Simons 
From ea0c25e80b817ede87fa2ad38017d05d69ea7c7a Mon Sep 17 00:00:00 2001
From: Sjoerd Simons 
Date: Mon, 25 Mar 2013 09:08:53 +0100
Subject: [PATCH] Also recognize touchscreen wacom devices

On my X220t there are two wacom device exposed. One being the pen and
one being two finger touch. The touch device has ID_INPUT_TOUCHSCREEN
instead of _TABLET or _TOUCHPAD, so also recognize that.

To prevent false-negatives only recognize touchscreen that use the wacom
usb driver

Signed-off-by: Sjoerd Simons 
---
 libwacom/libwacom.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 1b9b398..b4afe56 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -56,6 +56,10 @@ libwacom_get_device(const WacomDeviceDatabase *db, const char *match)
 static gboolean
 is_tablet_or_touchpad (GUdevDevice *device)
 {
+	if (g_udev_device_get_property_as_boolean (device, "ID_INPUT_TOUCHSCREEN"))
+		return !g_strcmp0 ("wacom", g_udev_device_get_property (device,
+			"ID_USB_DRIVER"));
+
 	return g_udev_device_get_property_as_boolean (device, "ID_INPUT_TABLET") ||
 		g_udev_device_get_property_as_boolean (device, "ID_INPUT_TOUCHPAD");
 }
-- 
1.7.10.4

--
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 4/4] Add new stylus IDs for Cintiq and Intuos

2013-05-24 Thread Ping Cheng
Whole set of 4 has been pushed. Thank you for your support.

Ping

On Thu, May 23, 2013 at 3:17 PM, Ping Cheng  wrote:

> 5 new styli are added for Cintiq 21UX2, 22HD, 24HD and Intuos 4 and 5.
>
> Signed-off-by: Ping Cheng 
> ---
>  data/cintiq-21ux2.tablet  |  2 +-
>  data/cintiq-22hd.tablet   |  2 +-
>  data/cintiq-24hd-touch.tablet |  2 +-
>  data/cintiq-24hd.tablet   |  2 +-
>  data/intuos4-12x19.tablet |  2 +-
>  data/intuos4-4x6.tablet   |  2 +-
>  data/intuos4-6x9-wl.tablet|  2 +-
>  data/intuos4-6x9.tablet   |  2 +-
>  data/intuos4-8x13.tablet  |  2 +-
>  data/intuos5-m.tablet |  2 +-
>  data/intuos5-s.tablet |  2 +-
>  data/intuos5-touch-l.tablet   |  2 +-
>  data/intuos5-touch-m.tablet   |  2 +-
>  data/intuos5-touch-s.tablet   |  2 +-
>  data/libwacom.stylus  | 60
> ---
>  15 files changed, 70 insertions(+), 18 deletions(-)
>
> diff --git a/data/cintiq-21ux2.tablet b/data/cintiq-21ux2.tablet
> index df81807..dfebe35 100644
> --- a/data/cintiq-21ux2.tablet
> +++ b/data/cintiq-21ux2.tablet
> @@ -49,7 +49,7 @@ Class=Cintiq
>  Width=17
>  Height=13
>  Layout=cintiq-21ux2.svg
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;
>  IntegratedIn=Display
>
>  [Features]
> diff --git a/data/cintiq-22hd.tablet b/data/cintiq-22hd.tablet
> index 9faac95..6dc6729 100644
> --- a/data/cintiq-22hd.tablet
> +++ b/data/cintiq-22hd.tablet
> @@ -37,7 +37,7 @@ Class=Cintiq
>  Width=19
>  Height=11
>  Layout=cintiq-22hd.svg
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;
>  IntegratedIn=Display
>
>  [Features]
> diff --git a/data/cintiq-24hd-touch.tablet b/data/cintiq-24hd-touch.tablet
> index 41d05de..5b8cc7d 100644
> --- a/data/cintiq-24hd-touch.tablet
> +++ b/data/cintiq-24hd-touch.tablet
> @@ -46,7 +46,7 @@ Class=Cintiq
>  Width=21
>  Height=13
>  Layout=cintiq-24hd.svg
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;
>  IntegratedIn=Display
>
>  [Features]
> diff --git a/data/cintiq-24hd.tablet b/data/cintiq-24hd.tablet
> index 0a3f4ef..4f32d91 100644
> --- a/data/cintiq-24hd.tablet
> +++ b/data/cintiq-24hd.tablet
> @@ -45,7 +45,7 @@ Class=Cintiq
>  Width=21
>  Height=13
>  Layout=cintiq-24hd.svg
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;
>  IntegratedIn=Display
>
>  [Features]
> diff --git a/data/intuos4-12x19.tablet b/data/intuos4-12x19.tablet
> index 7b8f960..63a0dce 100644
> --- a/data/intuos4-12x19.tablet
> +++ b/data/intuos4-12x19.tablet
> @@ -40,7 +40,7 @@ Width=19
>  Height=12
>  Layout=intuos4-12x19.svg
>  IntegratedIn=
>
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;0x806;0x006;
>
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;0x806;0x006;
>
>  [Features]
>  Reversible=true
> diff --git a/data/intuos4-4x6.tablet b/data/intuos4-4x6.tablet
> index 09e2f84..2ca12b2 100644
> --- a/data/intuos4-4x6.tablet
> +++ b/data/intuos4-4x6.tablet
> @@ -41,7 +41,7 @@ Width=6
>  Height=4
>  Layout=intuos4-4x6.svg
>  IntegratedIn=
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;0x806;
>
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;0x806;
>
>  [Features]
>  Reversible=true
> diff --git a/data/intuos4-6x9-wl.tablet b/data/intuos4-6x9-wl.tablet
> index 2fb0478..bd8e9a3 100644
> --- a/data/intuos4-6x9-wl.tablet
> +++ b/data/intuos4-6x9-wl.tablet
> @@ -40,7 +40,7 @@ Width=8
>  Height=5
>  IntegratedIn=
>  Layout=intuos4-6x9-wl.svg
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;0x806;
>
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;0x806;
>
>  [Features]
>  Reversible=true
> diff --git a/data/intuos4-6x9.tablet b/data/intuos4-6x9.tablet
> index 945f453..1c98b6b 100644
> --- a/data/intuos4-6x9.tablet
> +++ b/data/intuos4-6x9.tablet
> @@ -40,7 +40,7 @@ Width=9
>  Height=6
>  Layout=intuos4-6x9.svg
>  IntegratedIn=
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;0x806;
>
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;0x806;
>
>  [Features]
>  Reversible=true
> diff --git a/data/intuos4-8x13.tablet b/data/intuos4-8x13.tablet
> index 18aedf5..6e9f204 100644
> --- a/data/intuos4-8x13.tablet
> +++ b/data/intuos4-8x13.tablet
> @@ -40,7 +40,7 @@ Width=13
>  Height=8
>  Layout=intuos4-8x13.svg
>  IntegratedIn=
>
> -Styli=0x802;0x80c;0x804;0x80a;0x40802;0x4080a;0x902;0x90a;0x20802;0x806;0x006;
>
> +Styli=0x802;0x80c;0x804;0x80a;0x140802;0x14080a;0x902;0x90a;0x120802;0x806;0x006;
>
>  [Features]
>  Reversible=true
> diff --git a/data/intuos5-m.tablet b/data/intuos5-m.tablet
> index f39