[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] Drag images and background during DND on Windows
|
Hi,
I have a custom widget based on Canvas that displays some items that the
user can drag sort. When the user drags something, I am using an Image
of the dragged item as the drag image:
final DragSource source = new DragSource(this, DND.DROP_MOVE);
source.setDragSourceEffect(new DragSourceEffect(this) {
@Override
public void dragStart(DragSourceEvent event) {
event.image = // do some stuff to generate an image
}
});
This worked fine until I've implemented animating the items in the
Canvas to indicate to the user how items will be rearranged if a drop
were to occur. That is, it still works perfectly on all platforms (GTK,
Mac) except Windows. On Windows it looks like whenever I move the mouse,
the platform takes a snapshot of the current Canvas contents, composes
the drag image on top and places the (non transparent) result on screen.
Obviously that mechanism has horrible results when the background is
actually animated and changes while the mouse doesn't move. The area
where the drag image appears still displays the contents at the time of
the last mouse move, while the area around the drag image is animated
and updated.
The solution that comes to mind is to implement a drag image myself by
manually moving a transparent, custom shaped Shell along with the mouse.
Before I go and do that, is my interpretation of the problem correct,
and is there perhaps a simple solution that would fix the drag image
rendering against an animated background on Windows?
Thanks for any help!
Best regards,
-Stephan