Gamepad focus model (Re: Input and games.)

Peter Hutterer peter.hutterer at who-t.net
Wed May 8 23:44:09 PDT 2013


On Mon, May 06, 2013 at 03:36:20PM +0300, Pekka Paalanen wrote:
[...]
> I had a private chat with Daniel, and we came to an understanding,
> which I try to describe below. The interface names below are more like
> placeholders for now.
> 
> Into wl_seat, we should add a capability bit for gamepad. When the bit
> is set, a client can send wl_seat::get_gamepad_manager request, which
> creates a new wl_gamepad_manager object. (Do we actually need a
> capability bit?)
> 
> A wl_gamepad_manager will send an event for each physical gamepad (as
> it dynamically appears, if hotplugged later) associated with this
> particular wl_seat, creating a wl_gamepad object for each.
> 
> A wl_gamepad object will send an event about the player id as the first
> thing, and also if it later changes.

do you expect the player ID to be exposed on the protocol?
what does it contain and who manages the association?
is it related to any physical ID of the gamepad, and if not, can such ID be
provided (if the device supports it)?
is the player ID not better represented through a wl_seat? - if you're
playing a full-screen game, both seats can safely have the same focus,
otherwise, players can play games independently.
plus, if both players have a separate seat, they can use their keyboard
independently for data entry.

Cheers,
   Peter

> If a gamepad is hot-unplugged, a wl_gamepad event will notify about
> that, and the wl_gamepad object becomes inert (does not send any
> events, ignores all but the destroy request).
> 
> Associating physical devices into wl_seats is left as a server detail.
> The only rule is, that a physical device can appear at most in one
> wl_seat at a time. The server is free to move e.g. gamepads from one
> seat to another at runtime, clients will just see one gamepad
> hot-unplugged, and one hotplugged later under a different seat.
> 
> Gamepad input events are delivered according to the keyboard focus of
> the related wl_seat. If there is no keyboard to focus, then use the
> pointer focus, or something. It doesn't really affect the protocol
> design how the focus is assigned. However, would we need a
> wl_gamepad::enter,leave events? Probably, along with events for initial
> state. Or maybe enter/leave should be wl_gamepad_manager events?
> 
> This design allows several gamepads associated with one wl_seat, and
> thus one focus. It also allows gamepads to be assigned to different
> seats, but then we will have more problems on managing the foci, not
> unlike with keyboards. Hopefully there are no protocol design
> implications, though.
> 
> 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.
> 
> 
> Thanks,
> pq


More information about the wayland-devel mailing list