[PATCH 5/7] shell: update position of surfaces with type none on map()

Ander Conselvan de Oliveira conselvan2 at gmail.com
Fri Feb 17 03:55:48 PST 2012


Hi Pekka,

Thanks for reviewing this. Comments below.

On 02/16/2012 06:05 PM, Pekka Paalanen wrote:
> On Thu, 16 Feb 2012 16:42:03 +0200
> Ander Conselvan de Oliveira<conselvan2 at gmail.com>  wrote:
>> I actually had not consider the case where the drag surface is
>> transformed. We definitely want to move it according to the
>> transformation. For instance, the dnd demo uses the flower being dragged
>> as the icon and sets its position so it looks like that it is being
>> moved with the cursor.
>>
>> I cooked the attached patch that I can squash into the series. I tested
>> it by adding a rotation to the mouse cursor and checking if the dnd demo
>> behavior was still the same.
>
> When you rotated, around which point did you rotate? The
> surface origin, i.e. top-left corner?

See the attached patch.

> Ok, the new patch looks mostly fine, but I just can't quite grasp this
> hunk:
>
> @@ -1833,8 +1849,14 @@ weston_input_update_drag_surface(struct wl_input_device *input_device,
>   			input_device->drag_surface;
>   		device->drag_surface->pickable = 0;
>
> +		surface_to_global_float(device->drag_surface, 0, 0,
> +					&topl_x,&topl_y);
> +		topl_x -= device->drag_surface->geometry.x;
> +		topl_y -= device->drag_surface->geometry.y;
> +
>   		weston_surface_set_position(device->drag_surface,
> -					    input_device->x, input_device->y);
> +					    input_device->x - topl_x,
> +					    input_device->y - topl_y);
>   	}
>
> Does it all work so, that when the drag_surface becomes visible, we call
> map() with sx, sy being the surface-local coordinates of the hotspot?

The client may do that if it wants. The protocol does not define a 
surface hotspot. It only states that if an icon surface is supplied when 
a drag starts, its top-left corner will be positioned at the cursor 
hotspot. The client can then update the position regularly with 
surface_attach.

[...]

> In the above quoted hunk, why do you transform the surface top-left
> corner instead of the surface hotspot? How do you get the surface
> hotspot match the input device position?

Basically, it is the client's job to do surface_attach with the correct 
sx and sy coordinates.

> Btw. is there a weston_surface_update_transform() call somewhere
> guaranteeing that the surface geometry is not dirty?
> surface_{to,from}_global_float() functions are lower level functions
> than surface_{to,from}_global() and do not call it.

No. I'll add that.


Thanks,
Ander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rotate_cursor.patch
Type: text/x-patch
Size: 2131 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20120217/c2769364/attachment.bin>


More information about the wayland-devel mailing list