JDK-6323058 : MouseReleased event consumed on toplevel if press occur on other
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: generic
  • Submitted: 2005-09-13
  • Updated: 2011-01-19
  • Resolved: 2005-11-12
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.

To download the current JDK release, click here.
JDK 6
6 b61Fixed
Related Reports
Relates :  
Description
A regression in JDK6.0b53
Hi Andrei,

There is an issue with the fix for bug* *4869912. The bug is fixed, but mouse released event is ignored for the first click on the second frame, after the first frame is closed.

Run the testcase given in the description of the bug (StartFrame.java) on Windows. Move the smaller frame outside the bigger frame. Close the smaller frame by double clicking on left cornor of title bar. Now click inside the bigger frame. Mouse released is not triggered, but mouse pressed and clicked are triggered. This happens only for the first click. For the second click onwards, mouse released is triggered correctly.

Shall I mark the bug as fix failed? Or should I file a new bug?

Thanks,
Girish

Comments
SUGGESTED FIX The possible fix is in initializing variable with false every MousePress but we decided just to backout the fix for 4869912 as it causes inconsistencies with native applications. --- awt_Component.cpp 2005-09-13 13:09:19.000000000 +0400 lastTime = now; m_dragged = FALSE; + AwtComponent::shouldSkipNextMouseReleasedEvent = FALSE; MSG msg; InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y); SendMouseEvent(java_awt_event_MouseEvent_MOUSE_PRESSED, now, x, y, GetJavaModifiers(), clickCount, JNI_FALSE, GetButton(button), &msg); So the current diffs would be: --- /net/karanar/export/dav/mustang53_clear//webrev/src/windows/native/sun/windows/awt_Component.cpp 2005-09-21 19:25:05.000000000 +0400 *** 199,209 **** BOOL AwtComponent::m_QueryNewPaletteCalled = FALSE; CriticalSection windowMoveLock; BOOL windowMoveLockHeld = FALSE; BOOL windowSizing = FALSE; - BOOL AwtComponent::shouldSkipNextMouseReleasedEvent = FALSE; /************************************************************************ * AwtComponent methods */ --- 199,208 ---- *** 1262,1272 **** * Dispatch messages for this window class--general component */ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { JNILocalFrame lframe(AwtToolkit::GetEnv(), 10); - POINT p = { 0, 0 }; SpyWinMessage(GetHWnd(), message, (message == WM_AWT_RELEASE_ALL_DCS) ? TEXT("Disposed Component") : GetClassName()); LRESULT retValue = 0; MsgRouting mr = mrDoDefault; --- 1261,1270 ---- *** 1441,1457 **** mr = WmSizing(); break; case WM_SHOWWINDOW: mr = WmShowWindow(static_cast<BOOL>(wParam), static_cast<UINT>(lParam)); break; case WM_SYSCOMMAND: - // 4869912: check if mouse is in left top corner. - ::GetCursorPos(&p); - if( wParam == SC_CLOSE && ::SendMessage(GetHWnd(), WM_NCHITTEST, 0, - MAKELPARAM(p.x, p.y)) == HTSYSMENU) { - AwtComponent::shouldSkipNextMouseReleasedEvent = TRUE; - } - mr = WmSysCommand(static_cast<UINT>(wParam & 0xFFF0), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; case WM_EXITSIZEMOVE: windowSizing = FALSE; --- 1439,1448 ---- *** 2511,2529 **** MsgRouting AwtComponent::WmMouseUp(UINT flags, int x, int y, int button) { MSG msg; InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y); - // 4869912: skip MouseRelease as it goes into underlaying toplevel if exist - if (!AwtComponent::shouldSkipNextMouseReleasedEvent){ SendMouseEvent(java_awt_event_MouseEvent_MOUSE_RELEASED, nowMillisUTC(), x, y, GetJavaModifiers(), clickCount, (GetButton(button) == java_awt_event_MouseEvent_BUTTON3 ? TRUE : FALSE), GetButton(button), &msg); - } else { - AwtComponent::shouldSkipNextMouseReleasedEvent = FALSE; - } /* * If no movement, then report a click following the button release */ if (!m_dragged) { SendMouseEvent(java_awt_event_MouseEvent_MOUSE_CLICKED, --- 2502,2515 ---- --- /net/karanar/export/dav/mustang53_clear//webrev/src/windows/native/sun/windows/awt_Component.h 2005-09-21 19:25:09.000000000 +0400 *** 96,106 **** static jmethodID resetGCMID; static jmethodID replaceSurfaceDataMID; static jmethodID replaceSurfaceDataLaterMID; static const UINT WmAwtIsComponent; - static BOOL shouldSkipNextMouseReleasedEvent; AwtComponent(); virtual ~AwtComponent(); /* * Dynamic class registration & creation --- 96,105 ----
13-09-2005

EVALUATION Should assign AwtComponent::shouldSkipNextMouseReleasedEvent FALSE value on MousePress.
13-09-2005