Don't open context menus right under the mouse so that the first item is

already selected and get's picked when the user releases the mouse right after
the initial click. For model context menus, like right clicking a mounted disk
on the desktop, this somehow worked without selecting the item. But opening
the context menu on an empty part of the desktop always selected the Desktop
entry which resulted in the menu immediately closing without any effect. The
perhaps unwanted side-effect of this change is that navigation menus don't
automatically open unless you move the mouse a bit. Please play with this a bit
before commiting to alpha branch. I remember having to move the mouse a bit
on R5 as well, but could be wrong about it.

The real fix would be in BMenu and BMenuBar tracking code, but the changes
which I would have in mind are too radical to do before the release. I
understand that _IsStickyMode() is supposed to handle this case, but it actually
has too little information, since each menu is tracking the mouse state itself
and doesn't know what another menu already knows. Perhaps this is what the
"start" parameter was for in the original _Track() hook, but why not simply
create an object which is passed from menu to menu and tracks everything of
relevance and maintains state?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36762 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-05-08 22:41:55 +00:00
parent 7a2f989819
commit da8169406f

View File

@ -2453,6 +2453,7 @@ BContainerWindow::ShowDropContextMenu(BPoint loc)
item->SetMessage(new BMessage(kCreateLink));
}
global += BPoint(2, 2);
item = fDropContextMenu->Go(global, true, true);
if (item)
return item->Command();
@ -2467,6 +2468,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
ASSERT(IsLocked());
BPoint global(loc);
PoseView()->ConvertToScreen(&global);
global += BPoint(2, 2);
PoseView()->CommitActivePose();
if (ref) {
@ -2481,10 +2483,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref *ref, BView *)
DeleteSubmenu(fNavigationItem);
// selected item was trash, show the trash context menu instead
BPoint global(loc);
PoseView()->ConvertToScreen(&global);
PoseView()->CommitActivePose();
EnableNamedMenuItem(fTrashContextMenu, kEmptyTrash,
static_cast<TTracker *>(be_app)->TrashFull());