[PATCH weston] desktop-shell: Don't crash on zoom without a pointer in the seat

Derek Foreman derekf at osg.samsung.com
Wed Jan 7 12:30:16 PST 2015


On 06/01/15 09:27 PM, Jonas Ã…dahl wrote:
> On Tue, Jan 06, 2015 at 02:28:13PM -0600, Derek Foreman wrote:
>> The zoom effect zooms at the seat's current pointer location.  When no
>> pointer is present the zoom key bindings cause a crash.
>>
>> Instead, check for the absence of a pointer and log a warning.
>>
>> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
>> ---
>>  desktop-shell/shell.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
>> index a7514f7..0ec6d33 100644
>> --- a/desktop-shell/shell.c
>> +++ b/desktop-shell/shell.c
>> @@ -4671,6 +4671,11 @@ do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
>>  	struct weston_output *output;
>>  	float increment;
>>  
>> +	if (!seat->pointer) {
> 
> You could also check if (seat->pointer_device_count > 0) here.

True, but that has a neat problem.

Right now if I zoom, then unplug the mouse, I can still unzoom with the
keyboard hot key.

If I test seat->pointer_device_count instead of seat->pointer then I'll
be stuck zoomed until I plug a mouse back in.

> 
> Jonas
> 
>> +		weston_log("Zoom hotkey pressed but seat '%s' contains no pointer.\n", seat->seat_name);
>> +		return;
>> +	}
>> +
>>  	wl_list_for_each(output, &compositor->output_list, link) {
>>  		if (pixman_region32_contains_point(&output->region,
>>  						   wl_fixed_to_double(seat->pointer->x),
>> -- 
>> 2.1.4
>>
>> _______________________________________________
>> 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