On 02/23/2011 01:26 PM, Ping Cheng wrote:
> On Wed, Feb 23, 2011 at 9:36 AM, Duncan McGreggor
> <duncan.mcgreg...@canonical.com <mailto:duncan.mcgreg...@canonical.com>>
> wrote:
> 
> 
>     -------- Original Message --------
>     Subject: Re: touch input rotation
>     Date: Tue, 29 Jun 2010 07:43:56 -0700
>     From: Kees Cook <kees.c...@canonical.com
>     <mailto:kees.c...@canonical.com>>
>     Organization: Canonical
>     To: Alberto Milone <alberto.mil...@canonical.com
>     <mailto:alberto.mil...@canonical.com>>
>     CC: Federico Mena Quintero <feder...@novell.com
>     <mailto:feder...@novell.com>>,        Bryce
>     Harrington <br...@canonical.com <mailto:br...@canonical.com>>,      
>      Chase Douglas
>     <chase.doug...@canonical.com <mailto:chase.doug...@canonical.com>>,
>            "Duncan M. McGreggor"
>     <duncan.mcgreg...@canonical.com
>     <mailto:duncan.mcgreg...@canonical.com>>,        Rick Spencer
>     <rick.spen...@canonical.com <mailto:rick.spen...@canonical.com>>,  
>          Rafi Rubin <r...@seas.upenn.edu <mailto:r...@seas.upenn.edu>>
> 
>     Hi Alberto,
> 
>     On Tue, Jun 29, 2010 at 04:20:56PM +0200, Alberto Milone wrote:
>     > On 28 June 2010 20:14, Kees Cook <kees.c...@canonical.com
>     <mailto:kees.c...@canonical.com>> 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

_______________________________________________
Mailing list: https://launchpad.net/~multi-touch-dev
Post to     : multi-touch-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~multi-touch-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to