event.time = xEvent.time;
boolean translateTraversal (int key, XKeyEvent xEvent) {	int detail = 0;	switch (key) {		case OS.XK_Escape:		case OS.XK_Cancel:			Shell shell = getShell ();			if (shell.parent == null) return false;			if (!shell.isVisible () || !shell.isEnabled ()) return false;			detail = SWT.TRAVERSE_ESCAPE;			break;		case OS.XK_Return:			Button button = menuShell ().getDefaultButton ();			if (button == null || button.isDisposed ()) return false;			if (!button.isVisible () || !button.isEnabled ()) return false;			detail = SWT.TRAVERSE_RETURN;			break;		case OS.XK_Tab:			detail = SWT.TRAVERSE_TAB_PREVIOUS;			boolean next = (xEvent.state & OS.ShiftMask) == 0;			if (next && ((xEvent.state & OS.ControlMask) != 0)) return false;			if (next) detail = SWT.TRAVERSE_TAB_NEXT;			break;		case OS.XK_Up:		case OS.XK_Left: 			detail = SWT.TRAVERSE_ARROW_PREVIOUS;			break;		case OS.XK_Down:		case OS.XK_Right:			detail = SWT.TRAVERSE_ARROW_NEXT;			break;		default:			return false;	}	boolean doit = (detail & traversalCode ()) != 0;	if (hooks (SWT.Traverse)) {		Event event = new Event();		event.doit = doit;		event.detail = detail;		setKeyState (event, xEvent);		sendEvent (SWT.Traverse, event);		doit = event.doit;		detail = event.detail;	}	/*	* NOTE:  The native widgets handle tab and arrow key traversal	* so it is not necessary to traverse these keys.  A canvas widget	* has no native traversal by definition so it is necessary to	* traverse all keys.	*/	if (doit) {		int flags = SWT.TRAVERSE_RETURN | SWT.TRAVERSE_ESCAPE;		if ((detail & flags) != 0 || (state & CANVAS) != 0) {			return traverse (detail);		}	}	return false;}