int  window = 0; switch (eventType) { case OS.GDK_KEY_PRESS: case OS.GDK_KEY_RELEASE: case OS.GDK_ENTER_NOTIFY: case OS.GDK_LEAVE_NOTIFY: case OS.GDK_BUTTON_PRESS: case OS.GDK_2BUTTON_PRESS: case OS.GDK_3BUTTON_PRESS: case OS.GDK_BUTTON_RELEASE: case OS.GDK_MOTION_NOTIFY:  { window = OS.GDK_EVENT_WINDOW (event); int  [] user_data = new int  [1]; do { OS.gdk_window_get_user_data (window, user_data); int  handle = user_data [0]; if (handle != 0) { Widget widget = getWidget (handle); if (widget != null && widget instanceof Control) { control = (Control) widget; break;
int  grabHandle = OS.gtk_grab_get_current (); if (grabHandle != 0 && OS.GTK_IS_WINDOW (grabHandle) && OS.gtk_window_get_modal (grabHandle)) { switch (eventType) { case OS.GDK_KEY_PRESS: case OS.GDK_KEY_RELEASE: case OS.GDK_ENTER_NOTIFY: case OS.GDK_LEAVE_NOTIFY: case OS.GDK_BUTTON_PRESS: case OS.GDK_2BUTTON_PRESS: case OS.GDK_3BUTTON_PRESS: case OS.GDK_BUTTON_RELEASE: case OS.GDK_MOTION_NOTIFY:  { int  window = OS.GDK_EVENT_WINDOW (event); int  [] user_data = new int  [1]; do { OS.gdk_window_get_user_data (window, user_data); int  handle = user_data [0]; if (handle != 0) { Widget widget = getWidget (handle); if (widget != null && widget instanceof Control) { control = (Control) widget; break; }
int /*long*/ eventProc (int /*long*/ event, int /*long*/ data) {	/*	* Use gdk_event_get_time() rather than event.time or	* gtk_get_current_event_time().  If the event does not	* have a time stamp, then the field will contain garbage.	* Note that calling gtk_get_current_event_time() from	* outside of gtk_main_do_event() seems to always	* return zero.	*/	int time = OS.gdk_event_get_time (event);	if (time != 0) lastEventTime = time;	int eventType = OS.GDK_EVENT_TYPE (event);	switch (eventType) {		case OS.GDK_BUTTON_PRESS:		case OS.GDK_KEY_PRESS:			lastUserEventTime = time;	}	boolean dispatch = true;	if (dispatchEvents != null) {		dispatch = false;		for (int i = 0; i < dispatchEvents.length; i++) {			if (eventType == dispatchEvents [i]) {				dispatch = true;				break;			}		}	}	if (!dispatch) {		addGdkEvent (OS.gdk_event_copy (event));		return 0;	}	Control control = null;	int /*long*/ window = 0;	switch (eventType) {		case OS.GDK_KEY_PRESS:		case OS.GDK_KEY_RELEASE:		case OS.GDK_ENTER_NOTIFY:		case OS.GDK_LEAVE_NOTIFY:		case OS.GDK_BUTTON_PRESS:		case OS.GDK_2BUTTON_PRESS: 		case OS.GDK_3BUTTON_PRESS:		case OS.GDK_BUTTON_RELEASE: 		case OS.GDK_MOTION_NOTIFY:  {			window = OS.GDK_EVENT_WINDOW (event);			int /*long*/ [] user_data = new int /*long*/ [1];			do {				OS.gdk_window_get_user_data (window, user_data);				int /*long*/ handle = user_data [0];				if (handle != 0) {					Widget widget = getWidget (handle);					if (widget != null && widget instanceof Control) {						control = (Control) widget;						break;					}				}			} while ((window = OS.gdk_window_get_parent (window)) != 0);		}	}	Shell shell = null;	if (control != null ) {		shell = control.getShell ();		if ((shell.style & SWT.ON_TOP) != 0) {			OS.gtk_grab_add (shell.shellHandle);		}	}	OS.gtk_main_do_event (event);	if (dispatchEvents == null) putGdkEvents ();	if (control != null ) {		if (shell != null && !shell.isDisposed () && (shell.style & SWT.ON_TOP) != 0) {			OS.gtk_grab_remove (shell.shellHandle);		}	}	return 0;}