Gamepad focus model (Re: Input and games.)

Rick Yorgason rick at firefang.com
Thu May 9 03:49:03 PDT 2013


Pekka Paalanen <ppaalanen at ...> writes:
> From the game's point of view, it will need to iterate over all
> wl_seats. For each seat with the gamepad capability bit set, create a
> wl_gamepad_manager, receive all wl_gamepad objects, and for each
> wl_gamepad receive the player id. Create your surfaces, wait for foci
> to arrive, and fire away.

So, the purpose of wl_gamepad_manager is to allow multiple gamepads to share
one application focus. That seemed weird to me (why is it only gamepads that
would want that ability?) which is why I started thinking about wl_seat
parenting, and I apologize if that caused more heat than light.

But now I'm seriously wondering, does the compositor really need *any*
protocol support to handle this case? I think we've been assuming that each
seat will get its own free reign over the desktop, but isn't the compositor
free to *not* do that? And instead to have some seats which only interact
with the focused application?

We could have one wl_gamepad per wl_seat, just like wl_pointer, wl_keyboard,
or wl_touch, put the player ID in wl_seat instead of wl_gamepad, and give
compositor writers a few suggestions:

* Not all seats need to have a desktop pointer or the ability to control
their own focus. It can be useful to allow "second class" seats which follow
the focus of another seat, in which case neither the pointer nor any other
event from that seat should be allowed outside of the focused application.

* Each gamepad should automatically be put in a separate seat, either by
putting it in an existing seat without a gamepad, or automatically creating
a new seat.

* If a seat is automatically created for a gamepad, it should ideally be of
the "second class" type by default. Users can always reconfigure their seat
if they want control over the desktop.

Wouldn't that allow everything we want? It allows every user to have a full
set of devices, and users don't have to worry about focus issues unless they
want to. It also means the protocol doesn't need the contrivances of
wl_gamepad_manager or seat parenting.

-Rick-



More information about the wayland-devel mailing list