Possible bug in DragContainer::onDragEnded

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

pusheax
Just popping in
Just popping in
Posts: 1
Joined: Mon Apr 16, 2012 12:01

Possible bug in DragContainer::onDragEnded

Postby pusheax » Tue Apr 17, 2012 18:02

CEGUI 0.7.6
CEGUIDragContainer.cpp: DragContainer::onDragEnded
Here d_dropflag is set only to notify dropTarget that window is dropped.

Code: Select all

if (d_dropTarget)
        {
            // set flag - we need to detect if the position changed in a DragDropItemDropped
            d_dropflag = true;
            // Notify that item was dropped in the target window
            d_dropTarget->notifyDragDropItemDropped(this);
            // reset flag
            d_dropflag = false;
        }

But DragContainer::onMoved also depends on this flag:

Code: Select all

void DragContainer::onMoved(WindowEventArgs& e)
    {
        Window::onMoved(e);
        if (d_dropflag)
        {
            d_startPosition = getPosition();
        }
    }

I checked that this if block is never executed(at least in my case when dragging DragContainer with StaticImage across FrameWindow).
So I made a workaround for the time being - called Window::setPosition() in DragContainer::onDragEnded to trigger DragContainer::onMoved().

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Possible bug in DragContainer::onDragEnded

Postby CrazyEddie » Mon Apr 30, 2012 07:58

I don't understand the issue you're (possibly ;) ) reporting.

From what I recall, the flag is used - as suggested by the comment - in order that the DragContainer::onMoved function can know whether it has been called because the user is dragging the container around or because the client code has manually called a function (like setPosition) triggering the onMoved notification. If the flag was not used any position set by the user in an event handler for the drop event would be overwritten by the system.

If the above is not what you're seeing and/or I have totally misunderstood, feel free to elaborate :)

CE.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 15 guests