Buggy code:
public class Shell extends Decorations { Menu activeMenu ; ToolTip [ ] toolTips ; int hIMC ; int hwndMDIClient ; int lpstrTip ; int toolTipHandle ; int balloonTipHandle ; int minWidth = SWT . DEFAULT ; int minHeight = SWT . DEFAULT ; int [ ] brushes ; boolean showWithParent ; String toolTitle ; String balloonTitle ; int toolIcon ; int balloonIcon ; int windowProc ; Control lastActive ; SHACTIVATEINFO psai ; Region region ; static int ToolTipProc ; static final int DialogProc ; static final TCHAR DialogClass = new TCHAR ( 0 , ( OS . IsWinCE ? "Dialog" : "#32770" ) , true ) ; static final int [ ] SYSTEM_COLORS = new int [ ] { OS . COLOR_BTNFACE , OS . COLOR_WINDOW , OS . COLOR_BTNTEXT , OS . COLOR_WINDOWTEXT , OS . COLOR_HIGHLIGHT , OS . COLOR_SCROLLBAR } ; static final int BRUSHES_SIZE = 32 ; public Shell ( ) { } public Shell ( int style ) { } public Shell ( Display display ) { } public Shell ( Display display , int style ) { } Shell ( Display display , Shell parent , int style , int handle , boolean embedded ) { } public Shell ( Shell parent ) { } public Shell ( Shell parent , int style ) { } public static Shell win32_new ( Display display , int handle ) { } public static Shell internal_new ( Display display , int handle ) { } static int checkStyle ( int style ) { } public void addShellListener ( ShellListener listener ) { } int balloonTipHandle ( ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } public void close ( ) { } void createBalloonTipHandle ( ) { } void createHandle ( ) { boolean embedded = ( ( handle ) != 0 ) && ( ( ( state ) & ( FOREIGN_HANDLE ) ) == 0 ) ; if ( ( ( handle ) == 0 ) || embedded ) { super . createHandle ( ) ; } else { <START_BUG> state |= ( CANVAS ) | ( DRAG_DETECT ) ; <END_BUG> if ( ( ( style ) & ( ( SWT . H_SCROLL ) | ( SWT . V_SCROLL ) ) ) == 0 ) { state |= THEME_BACKGROUND ; } windowProc = OS . GetWindowLong ( handle , GWL_WNDPROC ) ; } if ( ! embedded ) { int bits = OS . GetWindowLong ( handle , GWL_STYLE ) ; bits &= ~ ( ( OS . WS_OVERLAPPED ) | ( OS . WS_CAPTION ) ) ; if ( ! ( OS . IsWinCE ) ) bits |= OS . WS_POPUP ; if ( ( ( style ) & ( SWT . TITLE ) ) != 0 ) bits |= OS . WS_CAPTION ; if ( ( ( style ) & ( SWT . NO_TRIM ) ) == 0 ) { if ( ( ( style ) & ( ( SWT . BORDER ) | ( SWT . RESIZE ) ) ) == 0 ) bits |= OS . WS_BORDER ; } OS . SetWindowLong ( handle , GWL_STYLE , bits ) ; int flags = ( ( ( ( OS . SWP_DRAWFRAME ) | ( OS . SWP_NOMOVE ) ) | ( OS . SWP_NOSIZE ) ) | ( OS . SWP_NOZORDER ) ) | ( OS . SWP_NOACTIVATE ) ; SetWindowPos ( handle , 0 , 0 , 0 , 0 , 0 , flags ) ; if ( OS . IsWinCE ) _setMaximized ( true ) ; if ( OS . IsPPC ) { psai = new SHACTIVATEINFO ( ) ; psai . cbSize = SHACTIVATEINFO . sizeof ; } } if ( OS . IsDBLocale ) { hIMC = OS . ImmCreateContext ( ) ; if ( ( hIMC ) != 0 ) OS . ImmAssociateContext ( handle , hIMC ) ; } } void createToolTip ( ToolTip toolTip ) { } void createToolTipHandle ( ) { } void deregister ( ) { } void destroyToolTip ( ToolTip toolTip ) { } public void dispose ( ) { } void enableWidget ( boolean enabled ) { } int findBrush ( int value , int lbStyle ) { } Control findBackgroundControl ( ) { } Cursor findCursor ( ) { } Control findThemeControl ( ) { } ToolTip findToolTip ( int id ) { } void fixShell ( Shell newShell , Control control ) { } void fixToolTip ( ) { } public void forceActive ( ) { } void forceResize ( ) { } public Rectangle getBounds ( ) { } ToolTip getCurrentToolTip ( ) { } ToolTip getCurrentToolTip ( int hwndToolTip ) { } public boolean getEnabled ( ) { } public int getImeInputMode ( ) { } public Point getLocation ( ) { } public Point getMinimumSize ( ) { } public Region getRegion ( ) { } public Shell getShell ( ) { } public Point getSize ( ) { } public Shell [ ] getShells ( ) { } Composite findDeferredControl ( ) { } public boolean isEnabled ( ) { } public boolean isVisible ( ) { } int hwndMDIClient ( ) { } public void open ( ) { } void register ( ) { } void releaseBrushes ( ) { } void releaseChildren ( boolean destroy ) { } void releaseHandle ( ) { } void releaseParent ( ) { } void releaseWidget ( ) { } void removeMenu ( Menu menu ) { } public void removeShellListener ( ShellListener listener ) { } LRESULT selectPalette ( int hPalette ) { } public void setActive ( ) { } void setActiveControl ( Control control ) { } void setBounds ( int x , int y , int width , int height , int flags , boolean defer ) { } public void setEnabled ( boolean enabled ) { }

Fix:
state |= CANVAS ;