JDK-6503772 : clicking java icon in title bar is not showing the menu if the frame.setFocusableWindowState(false)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u1
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-12-12
  • Updated: 2011-04-29
Related Reports
Relates :  
Description
Following defect is reproducible only in WINDOWS

1. Create Frame.
2. set the focusable state to false -->frame.setFocusableWindowState(false)
3. right click on the icon which is in tool bar.
   Menu is displayed with the options like move,size,maximize and minimize.
4. click on java cup icon in title bar of the frame.

Expected Result: menu should be displayed with the options like move,size,maximize and minimize.
Actual Result: menu is not displayed with the options like move,size,maximize and minimize 
Following are the steps to reproduce the defect.
1.run the attached test.
2.click on java cup icon in title bar of the frame.
  defect is reproduced if there is no menu with the options like move,size,maximize and  
  minimize.

Comments
EVALUATION Commenting out the CBTFilter() hook function in the awt_Window.cpp helps a bit. After the user moves the window at least once, the system menu starts opening. It seems to be a bug in the code that supports unfocusable windows in Java. My guess is: we should not use SW_SHONA and other special SW_ constants that show the window w/o activating it. In my opinion, presence of the WS_EX_NOACTIVATE style is enough for unfocusable windows to work correctly.
15-06-2007

EVALUATION It seems that the incorrect behavior is caused by an improper handling of the HITTEST values in the WmNcMouseDown() function in the awt_Frame.cpp file. Also I have noticed an interesting "feature". If a Frame is unfocusable, the Minimize and Maximize operations (when clicking on the corresponding buttons in the titlebar of the frame) are handled in the mentioned function (i.e. the WmNcMouseDown()). However, native Windows applications tend to use WmNcMouseUp() instead allowing the user to cancel the operation by releasing the mouse button somewhere outside of the Minimize or Maximize box. This seems to be worth fixing as well.
14-06-2007