[haiku-development] Re: BMenu click behaviour

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 20 Nov 2013 12:31:37 +0100

Hi,

Am 20.11.2013 um 11:35 schrieb Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>:
> 
> I've been looking into a bug which crashes Gobe Productive whenever you 
> click twice on one of its toolbar popup-menu buttons (i.e. click on the 
> button again while the popup-menu is already open -> crash).
> 
> The problem is in BMenu -- when you call BMenu::Show() twice, it crashes 
> (view gets added twice which calls into debugger()). The second click 
> on a popup menu in Gobe running on Haiku causes Show() to be called a 
> second time.
> 
> I checked how it works in BeOS. With a little test application I 
> verified that it also  crashes when BMenu::Show() is called twice, so 
> Haiku is not different in this regard. However, when a BMenu is shown 
> on BeOS, you cannot click on anything else in the window until the menu 
> is closed again. That is why clicking twice doesn't crash when running 
> Gobe on BeOS: the second click doesn't register.
> On Haiku, when a menu is open, you can still directly click other UI 
> elements (click goes through).
> 
> So, questions...
> - is this different behaviour intentional? (I assume yes, in the end 
> click-goes-through seems more useful.)
> - if yes, should we fix it by allowing BMenu::Show() to be called more 
> than once, i.e. ignore further calls when the menu is already open?

A third option may be that the menu is forced to close /before/ the click 
registers. But in this particular case, it is hard to achieve the optimal 
behavior. I've worked on these type of controls in another context. The user 
expectation is for the popup to close when they press the button again that 
opened in the first place. And I also find it better that clicks register 
elsewhere additionally to closing such popups. However, in Gobe Productive, the 
behavior would result in either the menu staying open (making BMenu::Show() 
robust), or the menu opening again (when the menu is forced to close, but the 
click registers).

Maybe… if clicks /near/ popup don't register and just close, but clicks farther 
away close and do register. That might actually make sense, but can also feel 
inconsistent. However, considering that the effects of the click to close the 
menu is easier seen when the click was near but does not register, maybe it's 
an OK solution that would also reinstall the correct behavior for Gobe 
Productive.

Best regards,
-Stephan


Other related posts: