JDK-4327618 : MouseDragged,MouseReleased are not triggered by scrollbar for left mouse button
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-04-04
  • Updated: 2001-01-09
  • Resolved: 2000-09-06
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.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
In Windows,MouseDragged,MouseReleased Event is not triggered by scrollbar for Left mouse,Middle Mouse buttons when mouse is dragged and released to outside of component. 

How to reproduce the Bug? -------->
Run this sample code. You would see a frame with a scrollbar at the North.
Press the Left/Middle mouse button inside the scrollbar and drag it.
Drag the mouse outside the scrollbar and drag it all over the screen without
releasing the mouse button. Release the mouse button when mouse pointer
is outside the scrollbar. Check whether Mouse Dragged Event,Mouse Released
Events are triggering for scrollbar or not. 

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin FIXED IN: merlin-beta INTEGRATED IN: merlin-beta VERIFIED IN: merlin-beta
14-06-2004

EVALUATION Commit to fix in Merlin (SQE yellow bug). eric.hawkes@eng 2000-05-07 Name: biR10147 Date: 09/01/2000 ###@###.### The only way to deliver mouse events to the components when the mouse is outside the window is to capture the mouse on each pressing. AwtComponent defines standard behavior, and AwtScrollbar inherits it. ====================================================================== Name: biR10147 Date: 09/01/2000 ###@###.### As for the other part of bug report, which says about failed delivery of events from the left button on scrollbar, this issue is pretty well covered by the evaluation of the bug #4328862, so it isn't actual anymore. ======================================================================
11-06-2004

SUGGESTED FIX Name: biR10147 Date: 09/01/2000 ###@###.### Capture the mouse over a component where dragging started so mouse events could be delivered to the components properly. ------- awt_Component.h ------- *************** *** 500,505 **** --- 500,507 ---- BOOL m_dragged; /* in drag operation */ virtual INLINE HWND GetWrappeeHandle() { return NULL; } + virtual void AwtComponent::SetDragCapture(); + virtual void AwtComponent::ReleaseDragCapture(); private: ------- awt_Component.cpp ------- *************** *** 3749,3754 **** --- 3749,3764 ---- env->DeleteLocalRef(target); } + void AwtComponent::SetDragCapture() + { + ::SetCapture(GetHWnd()); + } + + void AwtComponent::ReleaseDragCapture() + { + ::ReleaseCapture(); + } + void AwtComponent::SendMouseEvent(long id, jlong when, long x, long y, long modifiers, long clickCount, long popupTrigger, *************** *** 3795,3800 **** --- 3805,3819 ---- env->ExceptionDescribe(); env->ExceptionClear(); } + + if (id == java_awt_event_MouseEvent_MOUSE_PRESSED) { + SetDragCapture(); + } + + if (id == java_awt_event_MouseEvent_MOUSE_RELEASED) { + ReleaseDragCapture(); + } + DASSERT(mouseEvent != NULL); if (pMsg != 0) { AwtAWTEvent::saveMSG(env, pMsg, mouseEvent); ======================================================================
11-06-2004