Bug 47065 - [ViewMgmt] View pulldown menu (on the right) should follow platform interaction conventions
Summary: [ViewMgmt] View pulldown menu (on the right) should follow platform interacti...
Status: RESOLVED DUPLICATE of bug 193318
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 61307 79049 80948 (view as bug list)
Depends on: 81891
Blocks:
  Show dependency tree
 
Reported: 2003-11-20 05:49 EST by Markus Keller CLA
Modified: 2007-06-20 10:00 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2003-11-20 05:49:34 EST
Some views (e.g. the Package Explorer) have a pulldown menu on the right (a
black triangle).

Clicking the left mouse button on the triangle and holding it down should show
the menu (that's a Windows standard behavior). The menu only shows up on mouse
up, which is too late.
Comment 1 Tod Creasey CLA 2003-11-20 13:24:30 EST
The behaviour you are suggesting is different than the windows behaviour. In 
Windows you can have a left click and a right click menu (look at the 
pulldowns on the tool bar in IE). We would be inconsistent if we made these 
the same menu.

We don't have a menu bound to the toolbar so not having a menu popup when you 
right click is the correct behaviour.
Comment 2 Tod Creasey CLA 2003-11-20 13:24:47 EST
Marking as WORKSFORME
Comment 3 Markus Keller CLA 2003-11-20 13:49:58 EST
Seems my description wasn't clear enough. I'll try again:

I'm *not* referring to context menus (right-click menus).

I'm talking about the menu in a view's title bar:
- if the view is not a fast view, it's the second item from the right (next to
the close button)
- icon is a big black triangle
- tooltip says "Menu"
- opens on left mouse click

What's not cool about it is that I have to *release* the mouse button to make
the menu appear. Usually, I can press the left mouse button down on a menu, drag
to a menu item, and release the mouse button to activate the item.
Comment 4 Tod Creasey CLA 2003-11-20 14:02:32 EST
Ah - I see the issue now. I thought you were advocating having the same menu 
for left and right mouse click.

The behaviour you are talking about is supplied by SWT.
Comment 5 Grant Gayed CLA 2003-11-26 10:59:38 EST
ViewPane.SystemContribution.fill(...) adds a SelectionListener to the ToolItem 
for notification of when to display the menu.  A ToolItem Selection event will 
only ever fire after mouseDown+mouseUp, same as for Buttons.  So to make the 
menu appear sooner, MouseDown needs to be hooked instead of Selection.  Moving 
to UI.
Comment 6 Nick Edgar CLA 2003-11-26 11:40:32 EST
Grant, isn't the gesture for activating menus platform-specific?

The MenuDetect event is supposed to abstract away the details, but I believe it 
really only represents the context menu gesture, and wouldn't be applicable 
here (and you can't currently hook this event on a ToolItem anyway).

Is the gesture for activating pull-down menus platform-specific, or just the 
gesture for context menus?
Comment 7 Grant Gayed CLA 2003-11-26 12:16:48 EST
I've checked all of the platforms except Photon, and they're quite uniform 
w.r.t. pull-down menus.  The variations I saw occurred when I did a MouseDown 
on the pull-down item, dragged somewhere other than the newly-displayed menu, 
and then did MouseUp.  In this case win32 kept the menu up, while the others 
dismissed it.

MenuDetect would be strange here since the ToolItem is just a PUSH which shows 
a menu when it's pressed.  MenuDetect might make sense for DROP_DOWN ToolItems, 
but that's a different case than here.
Comment 8 Nick Edgar CLA 2004-09-01 09:05:34 EDT
*** Bug 61307 has been marked as a duplicate of this bug. ***
Comment 9 Stefan Xenos CLA 2004-11-07 04:51:34 EST
I took a stab at fixing this over the weekend. It's a lot harder than it looks.

If you try to open the menu on mousedown (as per comment 5), the ToolItem gets
permanently stuck in its "down" state, even after you close the menu. That is,
it will still look like you're clicking on the dropdown even after you move the
mouse away. (Presumably the mouseup gets lost after we open the menu)

This can be fixed by changing the ToolItem to a separator or disabling it. In
this case, the toolitem doesn't change its appearance when you click on it.. but
then we lose the mouseover affordances, which is almost as bad as the original
problem.

It also might be possible to fix this by tricking the ToolItem to go back to its
normal state immediately before opening the menu (this is what toolitems created
with SWT.DROP_DOWN seem to do). I tried toggling its visibility, enablement,
forcing a redraw, moving focus, etc... and I could not find a way to cause the
ToolItem to draw itself in its default state before the user lifts their finger
off the mouse.

It would work if we used a completely rendered widget, but that seems like
overkill (and it would take some effort to make a custom widget that provides
exactly the same mouseover affordances as ToolItem does on all platforms).

It looks as though more SWT support is needed to fix this. At minimum, ToolBar
should be able to support a mousedown listener that opens a popup menu over an
SWT.PUSH ToolItem (comment 5). 
Comment 10 Nick Edgar CLA 2004-11-08 11:56:52 EST
Moving to SWT for comment.  Can we get something akin to SWT.MenuDetect but for
drop-down menus rather than context menus?
Comment 11 Steve Northover CLA 2004-11-09 16:34:59 EST
SWT.MenuDetect doesn't really make sense here because menus are normally 
requested on mouse up for button 3 on Windows, not mouse down.  SWT.Selection 
can't be used because this normally happens on mouse up for button 1 when the 
mouse up occurs within the tool item.

What you are trying to do is use a tool item like a menu bar item by dropping 
down the menu on mouse down.  This is an odd use of tool items.  Normally, 
when a drop down menu is needed, an SWT.DROP_DOWN tool item is used.  This 
displays a menu on mouse down, but doesn't draw the way you want (it draws an 
icon and a small triangle).

So, I have fixed the cheese problem on Windows but since this is an odd thing 
to do to a tool item and most applications use SWT.DROP_DOWN when they want to 
add a menu to a tool item, I'm not crazy about adding new API.  Using mouse 
down and hit testing the tool item will work.

Fixed > 20041109 (cheese only)
Comment 12 Markus Keller CLA 2004-11-10 02:54:53 EST
Steve: your fix only seems to fix a sidenote in comment 9. The original problem
is not fixed and the bug should be moved back as requested in comment 10.
Comment 13 Steve Northover CLA 2004-11-10 09:47:49 EST
I am leaning towards not adding the API.
Comment 14 Stefan Xenos CLA 2004-11-10 11:31:16 EST
Steve: It would be great if there were some "accepted" way to use toolitem as
though they were a menu. I agree with Nick that SWT.PUSH + mousedown listener is
a bit of a hack.

If there were some way to change the appearance of SWT.DROP_DOWN to what we
wanted, this would be pretty near perfect.
Comment 15 Stefan Xenos CLA 2004-11-10 12:28:29 EST
The patch to bug 62280 includes a fix to this PR.
Comment 16 Nick Edgar CLA 2004-11-10 13:25:30 EST
Steve, one reason for requesting new API for this is that I thought the gestures
for invoking a pull-down menu differs on different platforms, so the UI
shouldn't hardcode it as mouse down.
Comment 17 Steve Northover CLA 2004-11-10 17:05:46 EST
Stefan:  I agree.  I looked at getting SWT.DROP_DOWN items to hide their 
triangle and couldn't get it to work.

Nick:  But the UI is hard coding the mouse gesture.  On Windows, 
SWT.MenuDetect is normally button 3 up.  You want the tool item pop up a menu 
on button 1 down on every platform.  So the title of this bug report isn't 
quite right.
Comment 18 Stefan Xenos CLA 2004-11-10 17:16:38 EST
I suspect Nick isn't too particular about whether the listener gets a
SWT.MenuDetect event or something else. The important bit is that whatever mouse
gesture works for the main menubar should also open the view dropdown.
Comment 19 Nick Edgar CLA 2004-11-10 17:23:16 EST
If there are no platform dependencies for the drop-down menu gesture (it's mouse
down everywhere), then it sounds like Steve's cheese fix and Stefan's existing
patch will work, and no new API is needed.  

Moving to Stefan to confirm/close when patch is released.

Comment 20 Stefan Xenos CLA 2004-12-10 16:40:48 EST
Looks like the patch to bug 62280 isn't going in. I've extracted the bits that
relate to this PR and prepared a fix for M4. Fixed in HEAD.

cc'ing Doug since this should end up in our build submission.
Comment 21 Stefan Xenos CLA 2004-12-14 15:00:02 EST
The mousedown trick is causing problems on GTK. I'm reverting this patch until
we have time to investigate properly.

Billy, can you describe the behavior you're observing?
Comment 22 Douglas Pollock CLA 2004-12-14 15:01:48 EST
See Bug 80948 
Comment 23 Stefan Xenos CLA 2004-12-14 15:25:14 EST
This has been rolled back in HEAD.

Steve, there seems to be some event ordering differences between Windows and
GTK. Even on windows, this didn't behave perfectly:
1. clicking twice on a windows menu closes the menu, but the mousedown+toolbar
trick leaves it open.
2. On a windows menu, if you click and drag on a menu but let your mouseup fall
somewhere off the menu, it will close. With the mousedown trick, the menu stays
open.

Bouncing back to SWT:

It looks like what we really need is a widget that behaves exactly like a menu,
but can contain an image.

Comment 24 Stefan Xenos CLA 2004-12-14 15:30:31 EST
*** Bug 80948 has been marked as a duplicate of this bug. ***
Comment 25 Stefan Xenos CLA 2004-12-14 15:34:48 EST
Correction to comment 14: a ToolItem with SWT.DROP_DOWN wouldn't have the
correct behavior either, since it doesn't close the menu if you drag off the
dropdown.
Comment 26 Steve Northover CLA 2004-12-16 15:30:58 EST
A fix for the GTK+ "menu disappears" behaviour has been released in HEAD.
Comment 27 Stefan Xenos CLA 2004-12-23 12:56:17 EST
Okay, I've put back the mousedown patch.

This releives the symptoms somewhat on most platforms, but it is still not
perfect.  I'll leave this open until the view menu behaves exactly like a menu
on all platforms.
Comment 28 Billy Biggs CLA 2004-12-23 22:52:02 EST
With this change, the view menu now acts like a normal menu on GTK+, except for
the problem described in bug 81891.
Comment 29 Veronika Irvine CLA 2005-03-10 12:59:58 EST
Can we close this bug report?
Comment 30 Stefan Xenos CLA 2005-03-10 14:09:15 EST
No... it is greatly improved, but still not exactly like a native menu (at least
on Win XP). 

On Windows, if you use mousedown to open a menu and drag your mouse off the menu
such that the mouseup arrives elsewhere, the menu will close. Currently, the
view menu will remain open.
Comment 31 Stefan Xenos CLA 2005-03-10 14:18:48 EST
I'm not sure if this last issue should be addressed by SWT or the UI.

UI could probably solve this by attaching a global event filter which listens
for a mouseup event on a different widget from the view menu chevron, and close
the menu if this occurs.

SWT could solve this by offering a new widget (or toolitem style, etc.) that
creates something with a dropdown menu that behaves exactly like a menu on the
native platform.

SWT could also solve this by changing the behavior of popup menus on Win XP: if
a popup menu is open and a mouseup arrives on any widget other than the popup
menu or the widget that received the mousedown, then close the popup menu. This
would be more consistent with the windows top-level menus.

Thoughts?
Comment 32 Ed Burnette CLA 2005-03-10 15:54:06 EST
Without knowing how hard it would be, the second idea sounds best to me because
it would "behave exactly like a menu on the native platform". The other ideas
sound like they're trying to just emulate what the platform does but there's no
guarantee it will feel native on each platform. 
Comment 33 Steve Northover CLA 2005-04-04 14:36:23 EDT
I'm sorry but we didn't get to this for 3.1.
Comment 34 Ed Burnette CLA 2005-04-04 17:00:34 EDT
I've seen native applications work the way that Eclipse works for these little
down-triangle menus. For example, in the toolbox menus in Word 2002, it works
the same way. So I'm happy with the way it is currently working under Windows in
3.1M6.
Comment 35 Markus Keller CLA 2005-04-05 03:19:15 EDT
The current solution is also fine for me, since it is a major improvement for
the normal workflow. OK to resolve the last non-nativity later (or never ;-).
Comment 36 Stefan Xenos CLA 2005-04-05 13:11:45 EDT
I'd like to see this fully fixed, especially since we're so close. I'll be happy
to write a workaround in the UI code, but I first want to wait for SWT to decide
if they're going to support this directly.
Comment 37 Steve Northover CLA 2005-04-05 13:38:39 EDT
I think we'd need new API to really support this properly, something like 
ToolItem.setMenu().  Since we are API frozen for M6 and we are working on 
other things, it won't happen for 3.1.

Personally, I'd just leave the menu coming up on mouse up.  It seems like a 
lot of work for not much benefit.
Comment 38 Ed Burnette CLA 2005-04-05 14:40:05 EDT
It's much more useful now than the way it used to be (it used to wait until
mouse-up). I vote for declaring victory and closing the bug.
Comment 39 Stefan Xenos CLA 2005-04-05 16:13:26 EDT
To be honest, that's the way I always close menus so I personally notice it all
the time. :-)
Comment 40 Stefan Xenos CLA 2005-04-21 19:13:15 EDT
Just found some other platform inconsistencies:

On windows, if you give a menu keyboard focus and press down, the menu opens.

If you give a toolbar button keyboard focus and press space, the button activates.

The current keyboard behavior doesn't behave like either a menu or a toolbar
dropdown.
Comment 41 Billy Biggs CLA 2005-04-23 23:56:29 EDT
*** Bug 79049 has been marked as a duplicate of this bug. ***
Comment 42 Steve Northover CLA 2007-06-20 09:13:25 EDT

*** This bug has been marked as a duplicate of bug 139318 ***
Comment 43 Steve Northover CLA 2007-06-20 10:00:28 EDT
Oops, wrong dup.
Comment 44 Steve Northover CLA 2007-06-20 10:00:45 EDT

*** This bug has been marked as a duplicate of bug 193318 ***