Gamepad focus model (Re: Input and games.)
Daniel Stone
daniel at fooishbar.org
Mon May 6 07:57:10 PDT 2013
On 6 May 2013 14:48, Todd Showalter <todd at electronjump.com> wrote:
> On Mon, May 6, 2013 at 8:36 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
>> 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?)
>
> There are options here:
>
> - have the capability bit, if the bit is set the client can request a
> manager -- has to deal with the case where the client sent the request
> but the caps bit wasn't set, presumably by returning NULL or -1 the
> protocol equivalent
>
> - leave out the caps bit, client requests the manager if they want it,
> they get NULL equivalent if there are no gamepads
Wayland doesn't have a 'return NULL' facility: the client creates an
entry for the object, and a proxy, and then the server later
instantiates that object. The only way to return NULL is an
asynchronous error which requires specialised handling.
> - leave out the caps bit, gampad manager is always there, but can be
> expected to return 0 if asked to enumerate gamepads when none are
> connected
Similarly, there's no round trip to enumerate gamepads. The
wl_gamepad_manager would advertise new (to the client) gamepads, i.e.
when the client creates the gamepad manager, the manager immediately
advertises all existing devices, and then later advertises new devices
as they're added.
>> 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?
>
> I think we need enter/leave events. The client can be responsible
> for cleaning up its own state, though if an initial state is sent on
> focus gain that makes things much easier.
Yeah, I think we definitely need enter/leave with current state.
Cheers,
Daniel
More information about the wayland-devel
mailing list