JDK-7034766 : closed/java/awt/EmbeddedFrame/EmbeddedFrameGrabTest/EmbeddedFrameGrabTest.java failed on jdk7 b134
Type:Bug
Component:client-libs
Sub-Component:java.awt
Affected Version:7
Priority:P2
Status:Closed
Resolution:Fixed
OS:windows
CPU:generic
Submitted:2011-04-07
Updated:2011-05-25
Resolved:2011-05-24
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
SUGGESTED FIX
$ hg diff src/windows/native/sun/windows/awt_Frame.cpp
diff -r b5e609488bc8 src/windows/native/sun/windows/awt_Frame.cpp
--- a/src/windows/native/sun/windows/awt_Frame.cpp Tue Mar 01 15:24:46 2011 +0300
+++ b/src/windows/native/sun/windows/awt_Frame.cpp Tue Apr 19 16:11:15 2011 +0400
@@ -374,7 +374,11 @@ LRESULT AwtFrame::WindowProc(UINT messag
MsgRouting mr = mrDoDefault;
LRESULT retValue = 0L;
- retValue = ProxyWindowProc(message, wParam, lParam, mr);
+ // If the message comes from Java, then we don't want to call
+ // the "proxy" handler and would rather call the "top-level" handler
+ if (!sm_inSynthesizeFocus) {
+ retValue = ProxyWindowProc(message, wParam, lParam, mr);
+ }
if (mr != mrConsume) {
retValue = AwtWindow::WindowProc(message, wParam, lParam);
19-04-2011
EVALUATION
Before 6826397, a focus message generated from Java (sm_inSynthesizeFocus == TRUE) comes to the top-level handler:
awt_Component.h:
690 LRESULT res = ::SendMessage(targetHWnd, WM_SETFOCUS, (WPARAM)oppositeHWnd, 0);
where targetHWnd is always the top-level window
So, the proxy handler wasn't called for such focus messages.
After 6826397, all focus message (including the messages generated from Java) always come to the proxy handler first:
awt_Frame.h:
380 retValue = ProxyWindowProc(message, wParam, lParam, mr);
So, the proxy handler is called now and in this particular case (EmbeddedFrameGrabTest.java), the proxy handler generates "unexpected" WM_ACTIVATE/WA_INACTIVE and it generates the ungrab request for the menu and the test fails.
We can use the sm_inSynthesizeFocus variable to see if the focus message comes from Java (or not) and call the proxy handler (or not call).
19-04-2011
EVALUATION
The problem is reproducible on Windows Vista with jdk 7 b134. It is not reproducible with jdk 7 b 133.