[PATCH v2 xserver 4/9] xwayland: Handle wp_tablet events
Peter Hutterer
peter.hutterer at who-t.net
Thu Feb 9 23:01:07 UTC 2017
On Thu, Feb 09, 2017 at 11:21:40AM -0800, Jason Gerecke wrote:
> On Tue, Feb 7, 2017 at 6:42 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> > From: Jason Gerecke <killertofu at gmail.com>
> >
> > Creates and maintains the canonical trio of X devices (stylus, eraser,
> > and cursor) to be shared by all connected tablets. A per-tablet trio
> > could be created instead, but there are very few benefits to such a
> > configuration since all tablets still ultimately share control of a
> > single master pointer.
> >
> > The three X devices are modeled after those created by xf86-input-wacom
> > but use a generic maximum X and Y that should be large enough to
> > accurately represent values from even the largest currently-available
> > tablets.
> >
> > Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
> > Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
> > Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > Changes to v1:
> > - extra comments for clarity
> >
> > hw/xwayland/xwayland-input.c | 142 +++++++++++++++++++++++++++++++++++++++++++
> > hw/xwayland/xwayland.h | 3 +
> > 2 files changed, 145 insertions(+)
> >
> > diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
> > index 3eac40f..97cc4d7 100644
> > --- a/hw/xwayland/xwayland-input.c
> > +++ b/hw/xwayland/xwayland-input.c
> > @@ -288,6 +288,75 @@ xwl_touch_proc(DeviceIntPtr device, int what)
> > #undef NTOUCHPOINTS
> > }
> >
> > +static int
> > +xwl_tablet_proc(DeviceIntPtr device, int what)
> > +{
> > +#define NBUTTONS 9
> > +#define NAXES 6
> > + Atom btn_labels[NBUTTONS] = { 0 };
> > + Atom axes_labels[NAXES] = { 0 };
> > + BYTE map[NBUTTONS + 1] = { 0 };
> > + int i;
> > +
> > + switch (what) {
> > + case DEVICE_INIT:
> > + device->public.on = FALSE;
> > +
> > + for (i = 1; i <= NBUTTONS; i++)
> > + map[i] = i;
> > +
> > + axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
> > + axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
> > + axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
> > + axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X);
> > + axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y);
> > + axes_labels[5] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_WHEEL);
> > +
> > + if (!InitValuatorClassDeviceStruct(device, NAXES, axes_labels,
> > + GetMotionHistorySize(), Absolute))
> > + return BadValue;
> > +
> > + /* Valuators - match the xf86-input-wacom ranges */
> > + InitValuatorAxisStruct(device, 0, axes_labels[0],
> > + 0, 262143, 10000, 0, 10000, Absolute);
> > + InitValuatorAxisStruct(device, 1, axes_labels[1],
> > + 0, 262143, 10000, 0, 10000, Absolute);
> > + /* pressure */
> > + InitValuatorAxisStruct(device, 2, axes_labels[2],
> > + 0, 2048, 1, 0, 1, Absolute);
>
> The latest-generation of Wacom hardware supports 8192 pressure levels.
> The xf86-input-wacom-0.34.0 driver changes this range to max out at
> 65536 instead of 2048 to avoid having to continually bump it upwards.
> You'll need to change the 'tablet_tool_pressure' function in the
> following patch to change (remove) the scaling factor.
done locally, but I maxed it at 65535 - that way we don't have to convert at
all from the protocol. I don't think that one value will make a difference.
Cheers,
Peter
More information about the xorg-devel
mailing list