[PATCH wayland 2/4] server: fix wl_seat_set_keyboard

Bill Spitzak spitzak at gmail.com
Tue Jul 10 12:05:50 PDT 2012


How about:

         if (keyboard) {
                 if (seat->keyboard || keyboard->seat)
                         return;
         } else {
                 if (!seat->keyboard)
                         return;
         }
         seat->keyboard = keyboard;

Kristian Høgsberg wrote:
> On Tue, Jul 10, 2012 at 01:05:01PM +0300, Pekka Paalanen wrote:
>> This makes wl_seat_set_keyboard similar to wl_seat_set_pointer in that
>> it's a no-op, if you try to set keyboard to NULL when it already is
>> NULL, instead of refusing to set it to NULL ever.
> 
> Yup, looks right.
> 
> Kristian
> 
>> Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
>> ---
>>  src/wayland-server.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/wayland-server.c b/src/wayland-server.c
>> index 82ed326..df9bd07 100644
>> --- a/src/wayland-server.c
>> +++ b/src/wayland-server.c
>> @@ -750,7 +750,7 @@ wl_seat_set_keyboard(struct wl_seat *seat, struct wl_keyboard *keyboard)
>>  {
>>  	if (keyboard && (seat->keyboard || keyboard->seat))
>>  		return; /* XXX: error? */
>> -	if (!keyboard && seat->keyboard)
>> +	if (!keyboard && !seat->keyboard)
>>  		return;
>>  
>>  	seat->keyboard = keyboard;
>> -- 
>> 1.7.8.6
>>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list