Buggy code:
void drawWidget ( int control , int context , int damageRgn , int visibleRgn , int theEvent ) { } void enableWidget ( boolean enabled ) { } Cursor findCursor ( ) { } void fixFocus ( Control focusControl ) { } int focusHandle ( ) { } public boolean forceFocus ( ) { } public Accessible getAccessible ( ) { } public Color getBackground ( ) { } public int getBorderWidth ( ) { } public Rectangle getBounds ( ) { } int getDrawCount ( int control ) { } public boolean getEnabled ( ) { } public Font getFont ( ) { } public Color getForeground ( ) { } public Object getLayoutData ( ) { } public Point getLocation ( ) { } public Menu getMenu ( ) { } int getMininumHeight ( ) { } public Monitor getMonitor ( ) { } public Composite getParent ( ) { } float [ ] getParentBackground ( ) { } Control [ ] getPath ( ) { } public Shell getShell ( ) { } public Point getSize ( ) { } public String getToolTipText ( ) { } public boolean getVisible ( ) { } int getVisibleRegion ( int control , boolean clipChildren ) { } boolean hasFocus ( ) { } int helpProc ( int inControl , int inGlobalMouse , int inRequest , int outContentProvided , int ioHelpContent ) { } void hookEvents ( ) { } public int internal_new_GC ( GCData data ) { checkWidget ( ) ; int window = OS . GetControlOwner ( handle ) ; int port = ( data != null ) ? data . port : 0 ; if ( port == 0 ) port = OS . GetWindowPort ( window ) ; int context ; int [ ] buffer = new int [ 1 ] ; boolean isPaint = ( ( OS . HIVIEW ) && ( data != null ) ) && ( ( data . paintEvent ) != 0 ) ; if ( isPaint ) { OS . GetEventParameter ( data . paintEvent , kEventParamCGContextRef , typeCGContextRef , null , 4 , null , buffer ) ; } else { OS . CreateCGContextForPort ( port , buffer ) ; } context = buffer [ 0 ] ; if ( context == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; int visibleRgn = 0 ; if ( ( data != null ) && ( ( data . paintEvent ) != 0 ) ) { visibleRgn = data . visibleRgn ; } else { if ( ( getDrawCount ( handle ) ) > 0 ) { visibleRgn = OS . NewRgn ( ) ; } else { visibleRgn = getVisibleRegion ( handle , true ) ; } } Rect rect = new Rect ( ) ; Rect portRect = new Rect ( ) ; OS . GetControlBounds ( handle , rect ) ; OS . GetPortBounds ( port , portRect ) ; if ( isPaint ) { rect . right += rect . left ; rect . bottom += rect . top ; rect . left = rect . top = 0 ; } else { if ( OS . HIVIEW ) { int [ ] contentView = new int [ 1 ] ; OS . HIViewFindByID ( OS . HIViewGetRoot ( window ) , OS . kHIViewWindowContentID ( ) , contentView ) ; CGPoint pt = new CGPoint ( ) ; <START_BUG> OS . HIViewConvertPoint ( pt , handle , contentView [ 0 ] ) ; <END_BUG> rect . left += ( ( int ) ( pt . x ) ) ; rect . top += ( ( int ) ( pt . y ) ) ; rect . right += ( ( int ) ( pt . x ) ) ; rect . bottom += ( ( int ) ( pt . y ) ) ; } OS . ClipCGContextToRegion ( context , portRect , visibleRgn ) ; int portHeight = ( portRect . bottom ) - ( portRect . top ) ; OS . CGContextScaleCTM ( context , 1 , ( - 1 ) ) ; OS . CGContextTranslateCTM ( context , rect . left , ( ( - portHeight ) + ( rect . top ) ) ) ; } if ( data != null ) { int mask = ( SWT . LEFT_TO_RIGHT ) | ( SWT . RIGHT_TO_LEFT ) ; if ( ( ( data . style ) & mask ) == 0 ) { data . style |= ( style ) & ( mask | ( SWT . MIRRORED ) ) ; } data . device = display ; data . thread = display . thread ; data . background = ( ( background ) != null ) ? background : defaultBackground ( ) . handle ; data . foreground = ( ( foreground ) != null ) ? foreground : defaultForeground ( ) . handle ; data . font = ( ( font ) != null ) ? font : defaultFont ( ) ; data . visibleRgn = visibleRgn ; data . control = handle ; data . portRect = portRect ; data . controlRect = rect ; if ( ( data . paintEvent ) == 0 ) { if ( ( gcs ) == null ) gcs = new GCData [ 4 ] ; int index = 0 ; while ( ( index < ( gcs . length ) ) && ( ( gcs [ index ] ) != null ) ) index ++ ; if ( index == ( gcs . length ) ) { GCData [ ] newGCs = new GCData [ ( gcs . length ) + 4 ] ; System . arraycopy ( gcs , 0 , newGCs , 0 , gcs . length ) ; gcs = newGCs ; } gcs [ index ] = data ; }

Fix:
OS . HIViewConvertPoint ( pt , OS . HIViewGetSuperview ( handle ) , contentView [ 0 ] ) ;