opens simultanously both the reference menu and the float menu.

The problem is in InsetText::lfunMouseRelease(...), it checks if an inset 
was hit, and then calls localDispatch of that inset with the mouse release 
event. On InsetReference (and pretty much on all "button" insets, i.e. all 
except from ert,tabular,text and collapsables), localDispatch is not 
overloaded from Inset (which returns UNDISPATCHED).

The relevant part of InsetText::lfunMouseRelease:
...
        Inset * inset = getLyXText(bv)->checkInsetHit(bv, tmp_x, tmp_y);
        bool ret = false;
        if (inset) {
                if (isHighlyEditableInset(inset))
                        ret = inset->localDispatch(cmd1);
                else {
                        inset_x = cix(bv) - top_x + drawTextXOffset;
                        inset_y = ciy(bv) + drawTextYOffset;
                        cmd1.x = cmd.x - inset_x;
                        cmd1.y = cmd.x - inset_y;
//NEXT LINE IS THE PROBLEM:
                        ret = inset->localDispatch(cmd1);
                        inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
                }
                updateLocal(bv, CURSOR_PAR, false);
        }
        return ret;
}

The bug can be easily avoided by replacing the offending line with ret=true; 
but I fail to see the logic here. Shouldn't we overload 
Inset::localDispatch() on, say, InsetButton, making it to catch 
LFUN_MOUSE_RELEASE and call edit() by itself?

I can make a patch if wanted (both ways).

Bye, Alfredo

PD: What's the logic behind changing coordinates of the mouse event for 
different types of insets (if isHiglyEditable() or not)? Shouldn't the 
inset itself take care of that?



Reply via email to