[haiku] Re: Behavior of popup menus

  • From: "Travis D. Reed" <tdreed@xxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Mon, 20 Dec 2010 07:24:22 -0600

Thanks for responding! Just to be clear, as far as I can tell, the only
change in behavior a release-to-select person would have to make is that
selecting the first menu item in a list would entail moving the mouse by a
couple of pixels (behavior already required in Tracker,
ProcessController...).

> Save for the coding style
I put the space after if. Sorry. :(

> (just create it on the stack instead)
Done...I think. :-/

Attached is the updated patch.
--
Travis D. Reed
Index: src/kits/interface/PopUpMenu.cpp
===================================================================
--- src/kits/interface/PopUpMenu.cpp    (revision 39894)
+++ src/kits/interface/PopUpMenu.cpp    (working copy)
@@ -317,6 +317,12 @@
 BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened,
                BRect *_specialRect, bool async)
 {
+       if (startOpened && _specialRect == NULL) {
+               BRect clickToOpen = BRect(where, where);
+               clickToOpen.InsetBy(-2, -2);
+               _specialRect = &clickToOpen;
+       }
+       
        if (fTrackThread >= B_OK) {
                // we already have an active menu, wait for it to go away before
                // spawning another
Index: headers/os/interface/PopUpMenu.h
===================================================================
--- headers/os/interface/PopUpMenu.h    (revision 39894)
+++ headers/os/interface/PopUpMenu.h    (working copy)
@@ -23,7 +23,8 @@
        static  BArchivable*            Instantiate(BMessage* archive);
 
                        BMenuItem*                      Go(BPoint where, bool 
autoInvoke = false,
-                                                                       bool 
keepOpen = false, bool async = false);
+                                                                       bool 
keepOpen = true,
+                                                                       bool 
async = false);
                        BMenuItem*                      Go(BPoint where, bool 
autoInvoke,
                                                                        bool 
keepOpen, BRect openRect,
                                                                        bool 
async = false);

Other related posts: