← Back to team overview

multi-touch-dev team mailing list archive

Re: tablets and auto-rotation

 

On 02/23/2011 01:26 PM, Ping Cheng wrote:
> On Wed, Feb 23, 2011 at 9:36 AM, Duncan McGreggor
> <duncan.mcgreggor@xxxxxxxxxxxxx <mailto:duncan.mcgreggor@xxxxxxxxxxxxx>>
> wrote:
> 
> 
>     -------- Original Message --------
>     Subject: Re: touch input rotation
>     Date: Tue, 29 Jun 2010 07:43:56 -0700
>     From: Kees Cook <kees.cook@xxxxxxxxxxxxx
>     <mailto:kees.cook@xxxxxxxxxxxxx>>
>     Organization: Canonical
>     To: Alberto Milone <alberto.milone@xxxxxxxxxxxxx
>     <mailto:alberto.milone@xxxxxxxxxxxxx>>
>     CC: Federico Mena Quintero <federico@xxxxxxxxxx
>     <mailto:federico@xxxxxxxxxx>>,        Bryce
>     Harrington <bryce@xxxxxxxxxxxxx <mailto:bryce@xxxxxxxxxxxxx>>,      
>      Chase Douglas
>     <chase.douglas@xxxxxxxxxxxxx <mailto:chase.douglas@xxxxxxxxxxxxx>>,
>            "Duncan M. McGreggor"
>     <duncan.mcgreggor@xxxxxxxxxxxxx
>     <mailto:duncan.mcgreggor@xxxxxxxxxxxxx>>,        Rick Spencer
>     <rick.spencer@xxxxxxxxxxxxx <mailto:rick.spencer@xxxxxxxxxxxxx>>,  
>          Rafi Rubin <rafi@xxxxxxxxxxxxxx <mailto:rafi@xxxxxxxxxxxxxx>>
> 
>     Hi Alberto,
> 
>     On Tue, Jun 29, 2010 at 04:20:56PM +0200, Alberto Milone wrote:
>     > On 28 June 2010 20:14, Kees Cook <kees.cook@xxxxxxxxxxxxx
>     <mailto:kees.cook@xxxxxxxxxxxxx>> wrote:
>     > > I saw your touch input rotation work[1].  I was looking at this too,
>     > > and I think it needs to be done more generally (in gnome-desktop
>     rather
>     > > than g-s-d), and with XInput (rather than calling out to xsetwacom).
> 
>  
> I agree with Alberto on this point. Using something generic, like
> Xinput, rather than vendor/project-specific helps the community in the
> long term.

There's a few steps to handle autorotation:

1. Detect rotation
  - Listen for lid switch events?
  - Listen for accelerometer events?
2. Rotate screen using XRandR
3. Rotate touchscreen input devices
  - X server has a "Coordinate Transformation Matrix" property for each
device, use it to perform input coordinate transformation

I have a feeling that step 1 will be hardest, because I don't think
there's any standard way to determine device orientation. We probably
need some system-wide service to watch for these types of events and
handle them appropriately.

Step 2 is already performed by gnome-settings-daemon (g-s-d) when you
connect or disconnect a monitor. I would think it could be extended for
this purpose.

For step 3 we need a mapping from touchscreens to Xinerama screens. We
don't currently have any tool to do this. If you have a touchscreen on
one monitor, and you plug in another, you will need to set the transform
matrix manually or else your touchscreen will operate over the entire X
screen! I don't know where this mapping should live, but if g-s-d could
get to it then it could also handle this too.

> The good news is that kernel input subsystem has added (maybe not in the
> tree yet, Henrik should be able to tell us more) a new set of ioctl so
> we can retrieve the device types directly from the kernel. With this new
> ioctl, generic "device self-identification" is available.

Yep, this will be very useful for setting up devices. In XI 2.1, devices
will have a "mode" that tells us whether it's being used as a
touchscreen or a touchpad or something else. g-s-d could look for these
devices to map them to xinerama displays.

I have a feeling we should revisit this at UDS to map out how this
should be tackled. There's a good chunk of development here, but it
shouldn't be too difficult with the apis and interfaces we have already.

-- Chase



Follow ups

References