[RFC] Drag and drop icons

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Fri Feb 10 08:31:33 PST 2012


Hi,

I have cooked up these patches for implementing the display of a
drag'n'drop surface. I think there are a lot of issues with them (see
below) and getting some feedback now would be good.

This is implemented by adding data_device.set_surface request that
creates a surface that follows the cursor when it moves, keeping the
distance of the top-left corner of the surface to the cursor hotspot
unchanged. The name set_surface is misleading, and I don't know what
name the similar request for cursor surfaces will have. But I guess we
should be consistent here. This request receives two parameters, x and
y, that defines the initial distance between the surface and the cursor
hotspot.

One thing that is not clear is what is the behavior if a client calls
this request twice for the same grab. What happens if attach is
alternated between the two returned surfaces?

I was also wondering if we should add a drag icon surface type to
shell. The use case I'm thinking is in a touch screen scenario, where
we might want to display the icon above the user's finger. So maybe
we should define (x,y) as a hotspot instead of a delta from the cursor
hotspot and have the shell define what it means. This would also solve
the problem of mapping the drag surface under the shell panels.

Since data_device is implemented in libwayland-server, moving the icon
surface to the right position was a little tricky. When set_surface is
called, it stores the delta on the wl_input_device. On the compositor
side, whenever the surface's position needs to be udpated, this delta
will be checked and used if necessary. The problem is that when the
drag starts, the first attach will happen before any mouse movement,
so it was necessary to check it also in output_repaint().

libwayland-server will also force an attach with a null buffer when the
drag ends. This may causes flicker in the dnd demo.


Wayland changes:

Ander Conselvan de Oliveira (1):
  data_device: use a regular surface for drag icons

 protocol/wayland.xml |   18 +++++--
 src/data-device.c    |  142 +++++++++++++++++++++++++++++++++++++++++++++++---
 src/wayland-server.h |    5 ++
 3 files changed, 152 insertions(+), 13 deletions(-)


Weston changes:

Ander Conselvan de Oliveira (4):
  shell: don't crash on get_shell_surface with non-client surfaces
  compositor: fix two crashs on surface_attach() with null buffer
  compositor: implement new data_device.set_surface protocol
  clients/dnd: use new data_device.set_surface protocol

 clients/dnd.c    |   15 ++++++++++--
 src/compositor.c |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/compositor.h |    1 +
 src/shell.c      |    3 ++
 4 files changed, 80 insertions(+), 3 deletions(-)

-- 
1.7.4.1



More information about the wayland-devel mailing list