int xEvent = OS.XtMalloc (XEvent.sizeof);
void wait(int timeout) {	int xDisplay = OS.XtDisplay(shellHandle);	if (xDisplay == 0) return;	long start = System.currentTimeMillis();	int xEvent = OS.XtMalloc (XEvent.sizeof);	Callback checkEventCallback = new Callback(this, "checkEvent", 3); //$NON-NLS-1$	int checkEventProc = checkEventCallback.getAddress();	display.timerExec(timeout, new Runnable() {		public void run() {			// timer required to force display.sleep() to wake up			// in the case where no events are received		}	});	while (!done && System.currentTimeMillis() - start <  timeout && display != null) {		if (OS.XCheckIfEvent (xDisplay, xEvent, checkEventProc, 0) != 0) {			OS.XtDispatchEvent(xEvent);		} else {			display.sleep();		}	}	OS.XtFree (xEvent);	checkEventCallback.dispose();}