Some of my thoughts on input for wayland

Chase Douglas chase.douglas at canonical.com
Mon Jan 24 16:00:22 PST 2011


On 01/24/2011 05:27 PM, Daniel Stone wrote:
> On Mon, Jan 24, 2011 at 01:04:35PM -0800, Bill Spitzak wrote:
>> Chase Douglas wrote:
>> I really believe passive grabs can be replaced by adding an API that
>> says "I did not handle this event". It can then be passed to another
>> window. The typical grabber would be the *last* one in line, not the
>> first. Wayland itself would have simple unchangable rules about what
>> windows receive events, but these rules produce a list and it tries
>> each in turn.
>>
>> Grabs have the unfortunate problem that the grabber cannot change
>> it's mind, and grabs must always be obscure key combinations and
>> sequences to avoid the chance that they will interfere with some
>> program.
> 
> Er, grabs do have that ability: see the ReplayPointer and ReplayKeyboard
> arguments to XAllowEvents.

This is still a simplification since this only works for passive grabs :).

> The problem with that is that you're introducing latency: you're sending
> the event through the X server to app A, which rejects it and asks the X
> server to pass it on to app B, which rejects it and asks the X server to
> pass it on to app C, etc.  The X server is probably busy doing a million
> other things, so the latency stacks up quite badly.

I'd say we should allow for what Bill suggests, mostly because there's
no real reason not to, and it may simplify the protocol and
implementation. The change I would make is that you have two places you
can hook into: on the traditional "grabbing" side where propagation
occurs root -> child windows, and then the traditional "selecting" side
where propagation is reversed.

The one thing I'm unsure of is whether to support grab modifiers in any
way. For example, in X we can specify a grab modifier of the control
key. When I use the mouse with the control key held, the grab is
activated. This allows for the same mechanism as above as long as the
condition for acceptance or rejection of the pointer events is whether
the control key is held, and no round trip latency is needed because the
condition is supplied up front.

However, the modifier keys just don't get you much. Who has ever used a
modifier key so that a certain application can grab the mouse? So the
question becomes: can we make a mechanism that allows for static up
front conditional "grabbing" that is flexible enough for normal needs?
I'm not sure there is a way that wouldn't be a protocol, implementation,
and maintenance nightmare :(.

-- Chase


More information about the wayland-devel mailing list