diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index b301d231c7..55b5e04eae 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -7,6 +7,7 @@ * Stefano Ceccherini (burton666@libero.it) */ +#include #include #include @@ -264,9 +265,11 @@ BMenu::AttachedToWindow() free(chars); free(keys); + BMenuItem *superItem = Superitem(); + BMenu *superMenu = Supermenu(); if (AddDynamicItem(B_INITIAL_ADD)) { do { - if (!OkToProceed(NULL)) { + if (superMenu != NULL && !superMenu->OkToProceed(superItem)) { AddDynamicItem(B_ABORT); fAttachAborted = true; break; @@ -1873,10 +1876,19 @@ BMenu::RedrawAfterSticky(BRect bounds) bool BMenu::OkToProceed(BMenuItem* item) { - // ToDo: test if the window could be closed again already - - // ToDo: for now - return true; + bool proceed = true; + BPoint where; + ulong buttons; + GetMouse(&where, &buttons, false); + ConvertToScreen(&where); + + // Quit if user releases the mouse button or moves + // the pointer over another item + // TODO: For some reason, this doesn't work + if (buttons == 0 /*|| HitTestItems(where) != item*/) + proceed = false; + + return proceed; }