United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6181157 : PIT: Default cursor is shown but changing when ALT key is down, on win32

Details
Type:
Bug
Submit Date:
2004-10-19
Status:
Closed
Updated Date:
2006-10-04
Project Name:
JDK
Resolved Date:
2005-11-26
Component:
client-libs
OS:
windows_xp
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.2.2
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
The following bug fix:
5097531: Mouse Cursor should be the default cursor when ALT key is pressed, on win32
is supposed to show the default cursor always when ALT key is pressed once. The cursor should change to the component specific cursor only when ALT is pressed again or when something is clicked.

But this bug fix has not considered the case of having an AWT menu added to the frame. It fixes the problem for the no-awt-menu case. The scenario is as follows:

I am having a frame with a button and a menu. 

1. Setting an image cursor for the frame containing a button.
2. setting wait cursor for the button.
3. pressing ALT. Chrsor changes to default cursor.
4. I am taking the mouse out of the frame and bringing it back.
5. Now I see Image cursor all over the frame, even on button.

This is incorrect. The cursor should always be the default cursor until I click something or press 'ALT' again.

This is noticed on Win_XP, since 1.2.2.

I have attached a test. Run the test. You would see a frame with a button. Move the mouse inside the frame. you should see an image cursor. Press & release the 'ALT' key. The cursor will change to def cursor. Take the mouse out of frame and bring it back. If you see the image cursor, the bug is reproduced.
###@###.### 10/19/04 13:10 GMT

                                    

Comments
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/awt_data/mustang/6181157/ 
*** (#1 of 1): [ UNSAVED ] ###@###.###
                                     
2005-11-02
EVALUATION

On windows, whenever a menu is activated, WM_ENTERMENULOOP message is passed to the app window indicating that a menu modal loop has been entered.
Similarly WM_EXITMENULOOP message is sent when the menu modal loop is exited.
The fix would be to update the cursor to component cursor only if there's no menu modal loop active.
                                     
2005-10-17
EVALUATION

We should prevent the components from updating the cursor when the popup menu is displayed.

This one is not so easy to fix. Viable options are using GetWindow with GW_ENABLEDPOPUP to locate an activated popup menu (proven to work, but w2k+ only so should emulate on older systems), or handling WM_[UN]INITMENUPOPUP for the same purposes (this fix would be generally cleaner but less local).
###@###.### 2005-06-29 16:17:48 GMT
                                     
2005-06-29



Hardware and Software, Engineered to Work Together