Added s small workaround in BMenu::OkToProceed() to fix deskbar not opening the be menu under heavy load (or, always, under qemu) if the mouse button was released too soon. Beos seems to do something similar, although it's a hack

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18500 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-08-13 05:39:00 +00:00
parent f1020a6c49
commit 509c95da0e
+13 -9
View File
@@ -1404,7 +1404,7 @@ bool
BMenu::_AddItem(BMenuItem *item, int32 index) BMenu::_AddItem(BMenuItem *item, int32 index)
{ {
ASSERT(item != NULL); ASSERT(item != NULL);
if (index < 0 || index > CountItems()) if (index < 0 || index > fItems.CountItems())
return false; return false;
if (!fItems.AddItem(item, index)) if (!fItems.AddItem(item, index))
@@ -1689,7 +1689,7 @@ BMenu::CalcFrame(BPoint where, bool *scrollOn)
// TODO: Horrible hack: // TODO: Horrible hack:
// When added to a BMenuField, a BPopUpMenu is the child of // When added to a BMenuField, a BPopUpMenu is the child of
// a _BMCItem_ inside a _BMCMenuBar_ to "fake" the menu hierarchy // a _BMCMenuBar_ to "fake" the menu hierarchy
if (superMenu == NULL || superItem == NULL if (superMenu == NULL || superItem == NULL
|| dynamic_cast<_BMCMenuBar_ *>(superMenu) != NULL) { || dynamic_cast<_BMCMenuBar_ *>(superMenu) != NULL) {
// just move the window on screen // just move the window on screen
@@ -2108,14 +2108,18 @@ BMenu::OkToProceed(BMenuItem* item)
BPoint where; BPoint where;
ulong buttons; ulong buttons;
GetMouse(&where, &buttons, false); GetMouse(&where, &buttons, false);
// Quit if user releases the mouse button (in nonsticky mode) bool stickyMode = IsStickyMode();
// or click the mouse button (in sticky mode) // Quit if user clicks the mouse button in sticky mode
// or releases the mouse button in nonsticky mode
// or moves the pointer over another item // or moves the pointer over another item
if ((buttons == 0 && !IsStickyMode()) // TODO: I added the check for BMenuBar to solve a problem with Deskbar.
|| (buttons != 0 && IsStickyMode()) // Beos seems to do something similar. This could also be a bug in Deskbar, though.
|| HitTestItems(where) != item) if ((buttons != 0 && stickyMode)
|| (dynamic_cast<BMenuBar *>(this) == NULL && (buttons == 0 && !stickyMode)
|| HitTestItems(where) != item))
proceed = false; proceed = false;
return proceed; return proceed;
} }
@@ -2142,7 +2146,7 @@ BMenu::ParseMsg(BMessage *msg, int32 *sindex, BMessage *spec,
status_t status_t
BMenu::DoMenuMsg(BMenuItem **next, BMenu *tar, BMessage *m, BMenu::DoMenuMsg(BMenuItem **next, BMenu *menu, BMessage *message,
BMessage *r, BMessage *spec, int32 f) const BMessage *r, BMessage *spec, int32 f) const
{ {
return B_ERROR; return B_ERROR;
@@ -2150,7 +2154,7 @@ BMenu::DoMenuMsg(BMenuItem **next, BMenu *tar, BMessage *m,
status_t status_t
BMenu::DoMenuItemMsg(BMenuItem **next, BMenu *tar, BMessage *m, BMenu::DoMenuItemMsg(BMenuItem **next, BMenu *menu, BMessage *message,
BMessage *r, BMessage *spec, int32 f) const BMessage *r, BMessage *spec, int32 f) const
{ {
return B_ERROR; return B_ERROR;