[PATCH weston] input: Destroy the pointer when the last device is unplugged

Derek Foreman derekf at osg.samsung.com
Wed Jan 7 13:03:05 PST 2015


On 06/01/15 09:25 PM, Jonas Ã…dahl wrote:
> On Tue, Jan 06, 2015 at 07:51:43PM -0600, Derek Foreman wrote:
>> Removing the last device that provides a pointer now destroys the
>> pointer struct and sets it to NULL (so things like zoom don't use
>> the old co-ordinates)
> 
> The fact that the pointer is not destroyed was delibaret, as some
> pointer related state should be kept even after the last pointer is
> unplugged. The use case that should work is:
> 
> 1. Session has pointer, position initialized to to (x, y)
> 2. User moves the pointer, position changed to (x', y')
> 3. User unplugs the (only) pointer
> 4. User plugs in a pointer
> 
> At this state, the cursor position should be initialized to (x', y').

Completely sensible (especially if you've got a dodgy device that
sometimes drops off usb and re-initializes...).  Thanks for the explanation.

I've flagged this patch as rejected in patchwork, and sent a new one
that comments this a bit in the hopes that others won't make this mistake.

> Jonas
> 
>>
>> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
>> ---
>>  src/input.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/input.c b/src/input.c
>> index d3bfa5e..ec5ee08 100644
>> --- a/src/input.c
>> +++ b/src/input.c
>> @@ -2221,11 +2221,9 @@ weston_seat_release_pointer(struct weston_seat *seat)
>>  					 wl_fixed_from_int(0));
>>  		weston_pointer_cancel_grab(pointer);
>>  
>> -		if (pointer->sprite)
>> -			pointer_unmap_sprite(pointer);
>> -
>> -		weston_pointer_reset_state(pointer);
>>  		seat_send_updated_caps(seat);
>> +		weston_pointer_destroy(pointer);
>> +		seat->pointer = NULL;
>>  	}
>>  }
>>  
>> -- 
>> 2.1.4
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> 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