[haiku-commits] r36762 - haiku/trunk/src/kits/tracker

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 9 May 2010 00:41:55 +0200 (CEST)

Author: stippi
Date: 2010-05-09 00:41:55 +0200 (Sun, 09 May 2010)
New Revision: 36762
Changeset: http://dev.haiku-os.org/changeset/36762/haiku

Modified:
   haiku/trunk/src/kits/tracker/ContainerWindow.cpp
Log:
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?


Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/ContainerWindow.cpp    2010-05-08 22:36:37 UTC 
(rev 36761)
+++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp    2010-05-08 22:41:55 UTC 
(rev 36762)
@@ -2453,6 +2453,7 @@
                item->SetMessage(new BMessage(kCreateLink));
        }
 
+       global += BPoint(2, 2);
        item = fDropContextMenu->Go(global, true, true);
        if (item)
                return item->Command();
@@ -2467,6 +2468,7 @@
        ASSERT(IsLocked());
        BPoint global(loc);
        PoseView()->ConvertToScreen(&global);
+       global += BPoint(2, 2);
        PoseView()->CommitActivePose();
 
        if (ref) {
@@ -2481,10 +2483,7 @@
                        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());
        


Other related posts: