[PATCH weston] dnd: reset the mouse cursor after adding a new item

Derek Foreman derekf at osg.samsung.com
Wed Nov 19 07:16:02 PST 2014


On 18/11/14 05:08 PM, Bill Spitzak wrote:
> I think the dnd client needs to handle normal mouse enter events and set
> the cursor. If the server is not sending an enter right after the drop
> then this is a bug, right?

When dnd_drop_handler triggers (which could be before the enter event
every time - I haven't checked) it calls input_receive_drag_data() with
a callback function that will add the item.

So even if the drop and the enter always occur in a convenient order,
the drag data arrives a little later when it's too late for the enter
handler to set the cursor.

Unless I'm misunderstanding all of this of course.  ;)

So... I don't think it's a bug in the server.

> On 11/18/2014 02:24 PM, Derek Foreman wrote:
>> When ending a drag in the window the cursor will be wrong until the mouse
>> is moved again.  This is because the item being dragged isn't added
>> until after the enter event.
>>
>> This patch stores the input device that last entered the window, and
>> sets its mouse cursor as new items are dropped.
> 
>> +        input_get_position(dnd->last_input, &x, &y);
>> +        input_set_pointer_image(dnd->last_input,
>> +                    lookup_cursor(dnd, x, y));
> 
> Can't you just use the xy from the dnd event here?

I'm pretty sure the mouse may have already moved - exactly the same
reason as above, this handler is getting the drop co-ords but time has
passed since the drop.

So in theory I could have moved the mouse just far enough to not be on
an item and stopped moving before we hit that code, and I'll end up
pointing in space with the hand cursor.

I'm not sure I'm capable of doing that stupid-mouse-trick, but I think
it can happen...


More information about the wayland-devel mailing list