Wrong mouse event in tip

Hi Jules,
Here is a small mouse bug that can be easily reproduced in the jucedemo:

On Windows, start the jucedemo over an empty desktop (no other windows displayed)
open the “Demo” menu, move the mouse over the menu, then move the mouse to the left, outside the jucedemo window, and click. This will discard the menu. Then move the mouse back into the jucedemo window. A spurious “drag” event will cause it to be resized when the mouse crosses the window border. The bug is on both master & modules branches

Thanks - I’ve found a work-around, will check in shortly…

Thanks, it is fixed. There is another unrelated bug , though, which happens with submenus in the menu bar, on windows. In order to reproduce it, modify MainDemoWindow.cpp:

            menu.addCommandItem (commandManager, showCodeEditor);
+          PopupMenu m2;
+          m2.addItem(999,"item0"); 
+          menu.addSubMenu("submenu",m2);
            menu.addCommandItem (commandManager, StandardApplicationCommandIDs::quit);

launch the demo, open the “Demo” menu, go down to the “submenu” entry, enter the submenu with the mouse, and them move the mouse back , without clicking anywhere, move it over the menu bar , and then back and forth between “Demo” and “Look and feel”. Very quickly the cpu consumption will go to 100% and the gui will be completely irresponsive.

Jeez, you’re really throwing some hard-to-track-down bugs at me! This was an absolute nightmare to trace, but I think I found it - can you confirm that this change in juce_PopupMenu.cpp works for you too:

[code]int PopupMenu::showWithOptionalCallback (const Options& options, ModalComponentManager::Callback* const userCallback,
const bool canBeModal)
ScopedPointerModalComponentManager::Callback userCallbackDeleter (userCallback);
ScopedPointer callback (new PopupMenuCompletionCallback());

Component* window = createWindow (options, &(callback->managerOfChosenCommand));
if (window == nullptr)
    return 0;

callback->component = window;

window->setVisible (true); // <<< this line added..
window->enterModalState (false, userCallbackDeleter.release());


I have a beta tester that is very good at finding this kind of issues :smiley:

Your patch works here also, thanks a lot ! I know how annoying it is to trace this kind of bugs. Although there is still something a bit strange: if you click on the “demo” menu and then move then mouse back and forth between “Demo” and “Look and Feel” , after a few seconds the menus will stop responding to mouse moves: you will end up stuck with either the “demo” or the “look and feel menu” until you click somewhere.