RFC: multitouch support v2

Chase Douglas chase.douglas at canonical.com
Thu Dec 22 08:27:04 PST 2011


On 12/22/2011 07:53 AM, Kristian Høgsberg wrote:
> 2011/12/22 Chase Douglas <chase.douglas at canonical.com>:
>> I don't know wayland's protocol yet, but shouldn't enter/leave events
>> have some kind of device identifier in them? I would think that should
>> alleviate any client-side confusion.
> 
> I don't think so.  To be clear, the problem I'm thinking of is where
> the toolkit does select for touch events, but only to do client side
> pointer emulation in the toolkit.  What should a client do in case the
> pointer is hovering over a button in one window, when it then receives
> a touch down in another window?  The toolkit only maintains one
> pointer focus (which is current in that other window), and what
> happens when you receive touch events in a different window?  What
> kind of pointer events do you synthesize?  We can't move the system
> pointer to match the touch position.

In X we move the cursor sprite to the first touch location, always. This
is because you have moved the master pointer, so the sprite needs to be
in sync with the master pointer location.

Off the top of my head, I would think Wayland should automatically
create the equivalent of X master pointer devices for each touchscreen
device. There shouldn't be a sprite for touchscreens, though the WM
could do fancy effects like MS Surface if you wanted it to.

> I guess you could synthesize a leave event for the window the pointer
> is in but remember the window and position.  Then synthesize an enter
> event for the window with the touch event and send button down and
> motion events etc.   Then when the touch session is over (all touch
> points up), the toolkit synthesizes an enter event for the window and
> position the pointer is actually in.

That sounds hacky, and trying to fit multiple input devices into a
single input device world.

I would suggest not sending or synthesizing enter/leave events for touch
events. The toolkit can switch focus to the last window with a touch
event or a pointer motion event.

-- Chase


More information about the wayland-devel mailing list