Gamepad focus model (Re: Input and games.)

Bill Spitzak spitzak at gmail.com
Tue May 14 12:08:21 PDT 2013


Rick Yorgason wrote:

> When you have multiplayer games, you just want to be able to launch the game
> and have everybody automatically in it. You don't want your extra players to
> have to think about focusing the app or anything like that.
> 
> That's the crux of the problem: how do you have one focus for multiple
> players?

I feel the underlying function should be this:

1. The game can enumerate all the gamepads.

2. The game can "grab the focus" for any gamepads it wants.

Once it is grabbed, the pointer motion makes NO difference, removing a 
lot of the questions people are asking here. If the device was moving 
the pointer, it stops moving the pointer. If another device like a mouse 
moves the pointer, it continues to do so, but it does not matter if the 
mouse is moved outside the game and clicked elsewhere: the mouse works 
like normal sending clicks to that other client, and the gamepad events 
continue going to the game.

The only complexity is to prevent clients from grabbing the gamepad when 
they should not. For this the "grab the focus" does not work unless the 
shell allows it to.

As I see it the gamepad is "attached" to at most one "pointer". The 
gamepad can be grabbed if the client has that pointer's focus. The 
gamepad can also be "attached" to any number of other devices. It can 
also be grabbed if the event that triggered the grab request is a 
focus-in or event for a related device (this is so keyboard keys can 
cause a gamepad grab).

Specifying this attachement is where the seat and hierarchy comes in.

I very much agree that the seat==user idea is best. Otherwise it seems 
like seats are pretty useless, and users would have to be added to 
wayland anyway, making it more complex for no good reason. To get the 
"one seat per gamepad but they all share the same pointer" the 
parent-seat proposal seems like as easy fit. I am having a hard time 
coming up with a plausible setup that this would not cover. Grabbing a 
gamepad does not change this parenting in any way.


More information about the wayland-devel mailing list