Buggy code:
int registerCellSubclass ( int cellClass , int size , int align , String types ) { } void initClasses ( ) { } public int internal_new_GC ( GCData data ) { } public void internal_dispose_GC ( int context , GCData data ) { } static boolean isValidClass ( Class clazz ) { } boolean isValidThread ( ) { } public boolean post ( Event event ) { } void postEvent ( Event event ) { } public Point map ( Control from , Control to , Point point ) { } public Point map ( Control from , Control to , int x , int y ) { } public Rectangle map ( Control from , Control to , Rectangle rectangle ) { } public Rectangle map ( Control from , Control to , int x , int y , int width , int height ) { } public boolean readAndDispatch ( ) { } static void register ( Display display ) { } protected void release ( ) { } void releaseDisplay ( ) { } void removeContext ( NSGraphicsContext context ) { } public void removeFilter ( int eventType , Listener listener ) { } public void removeListener ( int eventType , Listener listener ) { } Widget removeWidget ( NSObject view ) { } void removeMenu ( Menu menu ) { } void removePopup ( Menu menu ) { } boolean runAsyncMessages ( boolean all ) { } boolean runContexts ( ) { } boolean runDeferredEvents ( ) { } boolean runPopups ( ) { } boolean runTimers ( ) { } void sendEvent ( int eventType , Event event ) { } public static void setAppName ( String name ) { } Runnable hoverTimer = new Runnable ( ) { public void run ( ) { } } ; Runnable caretTimer = new Runnable ( ) { public void run ( ) { } } ; void setCurrentCaret ( Caret caret ) { } void setCursor ( Control control ) { } public void setCursorLocation ( int x , int y ) { } public void setCursorLocation ( Point point ) { } public void setData ( String key , Object value ) { } void setMenuBar ( Menu menu ) { } void setModalShell ( Shell shell ) { } public void setData ( Object data ) { } public void setSynchronizer ( Synchronizer synchronizer ) { } public boolean sleep ( ) { } int sourceProc ( int info ) { } public void syncExec ( Runnable runnable ) { } public void timerExec ( int milliseconds , Runnable runnable ) { } int timerProc ( int id , int sel , int timerID ) { } public void update ( ) { } public void wake ( ) { } void wakeThread ( ) { } Control findControl ( NSEvent nsEvent , boolean checkGrab , boolean checkTrim , boolean checkWindows ) { } int applicationNextEventMatchingMask ( int id , int sel , int mask , int expiration , int mode , int dequeue ) { } boolean applicationSendMouseEvent ( NSEvent nsEvent , boolean send ) { if ( send ) runDeferredEvents ( ) ; boolean up = false ; int type = ( ( int ) ( nsEvent . type ( ) ) ) ; switch ( type ) { case OS . NSLeftMouseDown : case OS . NSRightMouseDown : case OS . NSOtherMouseDown : { Control control = grabControl = findControl ( nsEvent , false , true , false ) ; consume [ 0 ] = false ; if ( control != null ) { if ( ( ( ( nsEvent . clickCount ( ) ) == 1 ) && ( ( ( control . state ) & ( Widget . DRAG_DETECT ) ) != 0 ) ) && ( control . hooks ( DragDetect ) ) ) { NSPoint windowLoc = nsEvent . locationInWindow ( ) ; <START_BUG> NSPoint viewLoc = control . view . convertPoint_toView_ ( windowLoc , null ) ; <END_BUG> if ( control . dragDetect ( ( ( int ) ( viewLoc . x ) ) , ( ( int ) ( viewLoc . y ) ) , false , consume ) ) { dragging = true ; } } control . sendMouseEvent ( nsEvent , MouseDown , send ) ; if ( ( nsEvent . clickCount ( ) ) == 2 ) { control . sendMouseEvent ( nsEvent , MouseDoubleClick , send ) ; } if ( consume [ 0 ] ) return true ; } break ; } case OS . NSLeftMouseUp : case OS . NSRightMouseUp : case OS . NSOtherMouseUp : { Control control = findControl ( nsEvent , true , true , false ) ; if ( control != null ) { control . sendMouseEvent ( nsEvent , MouseUp , send ) ; } grabControl = null ; up = true ; } case OS . NSLeftMouseDragged : case OS . NSRightMouseDragged : case OS . NSOtherMouseDragged : case OS . NSMouseMoved : { Control control = findControl ( nsEvent , true , true , ( type == ( OS . NSMouseMoved ) ) ) ; if ( dragging ) { dragging = false ; control . sendDragEvent ( nsEvent ) ; } if ( control != ( currentControl ) ) { if ( ( currentControl ) != null ) { currentControl . sendMouseEvent ( nsEvent , MouseExit , send ) ; } currentControl = control ; if ( control != null ) { control . sendMouseEvent ( nsEvent , MouseEnter , send ) ; if ( up ) timerExec ( getToolTipTime ( ) , hoverTimer ) ; } setCursor ( control ) ; } if ( ( ! up ) && ( control != null ) ) { timerExec ( getToolTipTime ( ) , hoverTimer ) ; control . sendMouseEvent ( nsEvent , MouseMove , send ) ;

Fix:
NSPoint viewLoc = control . view . convertPoint_fromView_ ( windowLoc , null ) ;