Opaque DragImageComponent sees itself

If an opaque DragImageComponent is used (one that returns true from IsOpaque(), which happens on systems without transparent window support or if manually set), drop targets do not see the drop enter / drop exit messages.

The reason is that the DragImageComponent ‘sees itself’ during DragImageComponent::findTarget. In other words, it is finding its own HWND. The chain of calls is as follows:

hit = Desktop::getInstance().findComponentAt (screenX, screenY); Component::getComponentAt() Component::contains() Win32ComponentPeer::contains()

in Win32ComponentPeer::contains(), WindowFromPoint returns the HWND of the DragImageComponent heavyweight peer, rather than the HWND behind it.

If the DragImageComponent HWND has the layered style set (for transparency) as a consequence of having returned false for IsOpaque(), WindowFromPoint does not find it in the call chain above and instead correctly finds the HWND behind the image window being dragged.

Thanks, I’ll look into that.

The fix for this other problem seemed to fix this one too: