if (OS.GDK_WINDOWING_X11()) { xDisplay = OS.GDK_DISPLAY (); }
if (OS.GDK_WINDOWING_X11 ()) xDisplay = OS.GDK_DISPLAY ();
synchronized void createDisplay (DeviceData data) {	/* Required for g_main_context_wakeup */	if (!OS.g_thread_supported ()) {		OS.g_thread_init (0);	}	OS.gtk_set_locale();	if (!OS.gtk_init_check (new int /*long*/ [] {0}, null)) {		SWT.error (SWT.ERROR_NO_HANDLES, null, " [gtk_init_check() failed]");	}	if (OS.GDK_WINDOWING_X11()) {		xDisplay = OS.GDK_DISPLAY ();	}	int /*long*/ ptr = OS.gtk_check_version (MAJOR, MINOR, MICRO);	if (ptr != 0) {		int length = OS.strlen (ptr);		byte [] buffer = new byte [length];		OS.memmove (buffer, ptr, length);		System.out.println ("***WARNING: " + new String (Converter.mbcsToWcs (null, buffer)));		System.out.println ("***WARNING: SWT requires GTK " + MAJOR+ "." + MINOR + "." + MICRO);		int major = OS.gtk_major_version (), minor = OS.gtk_minor_version (), micro = OS.gtk_micro_version ();		System.out.println ("***WARNING: Detected: " + major + "." + minor + "." + micro);	}	if (fixed_type == 0) {		byte [] type_name = Converter.wcsToMbcs (null, "SwtFixed", true);		fixedClassInitCallback = new Callback (getClass (), "fixedClassInitProc", 2);		fixedClassInitProc = fixedClassInitCallback.getAddress ();		if (fixedClassInitProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);		fixedMapCallback = new Callback (getClass (), "fixedMapProc", 1);		fixedMapProc = fixedMapCallback.getAddress ();		if (fixedMapProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);		GTypeInfo fixed_info = new GTypeInfo ();		fixed_info.class_size = (short) OS.GtkFixedClass_sizeof ();		fixed_info.class_init = fixedClassInitProc;		fixed_info.instance_size = (short) OS.GtkFixed_sizeof ();		fixed_info_ptr = OS.g_malloc (GTypeInfo.sizeof);		OS.memmove (fixed_info_ptr, fixed_info, GTypeInfo.sizeof);		fixed_type = OS.g_type_register_static (OS.GTK_TYPE_FIXED (), type_name, fixed_info_ptr, 0);	}	if (rendererClassInitProc == 0) {		rendererClassInitCallback = new Callback (getClass (), "rendererClassInitProc", 2);		rendererClassInitProc = rendererClassInitCallback.getAddress ();		if (rendererClassInitProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);	}	if (rendererRenderProc == 0) {		rendererRenderCallback = new Callback (getClass (), "rendererRenderProc", 7);		rendererRenderProc = rendererRenderCallback.getAddress ();		if (rendererRenderProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);	}	if (rendererGetSizeProc == 0) {		rendererGetSizeCallback = new Callback (getClass (), "rendererGetSizeProc", 7);		rendererGetSizeProc = rendererGetSizeCallback.getAddress ();		if (rendererGetSizeProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);	}	if (text_renderer_type == 0) {		GTypeInfo renderer_info = new GTypeInfo ();		renderer_info.class_size = (short) OS.GtkCellRendererTextClass_sizeof ();		renderer_info.class_init = rendererClassInitProc;		renderer_info.instance_size = (short) OS.GtkCellRendererText_sizeof ();		text_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof);		OS.memmove (text_renderer_info_ptr, renderer_info, GTypeInfo.sizeof);		byte [] type_name = Converter.wcsToMbcs (null, "SwtTextRenderer", true);		text_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TEXT (), type_name, text_renderer_info_ptr, 0);	}	if (pixbuf_renderer_type == 0) {		GTypeInfo renderer_info = new GTypeInfo ();		renderer_info.class_size = (short) OS.GtkCellRendererPixbufClass_sizeof ();		renderer_info.class_init = rendererClassInitProc;		renderer_info.instance_size = (short) OS.GtkCellRendererPixbuf_sizeof ();		pixbuf_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof);		OS.memmove (pixbuf_renderer_info_ptr, renderer_info, GTypeInfo.sizeof);		byte [] type_name = Converter.wcsToMbcs (null, "SwtPixbufRenderer", true);		pixbuf_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_PIXBUF (), type_name, pixbuf_renderer_info_ptr, 0);	}		if (toggle_renderer_type == 0) {		GTypeInfo renderer_info = new GTypeInfo ();		renderer_info.class_size = (short) OS.GtkCellRendererToggleClass_sizeof ();		renderer_info.class_init = rendererClassInitProc;		renderer_info.instance_size = (short) OS.GtkCellRendererToggle_sizeof ();		toggle_renderer_info_ptr = OS.g_malloc (GTypeInfo.sizeof);		OS.memmove (toggle_renderer_info_ptr, renderer_info, GTypeInfo.sizeof);		byte [] type_name = Converter.wcsToMbcs (null, "SwtToggleRenderer", true);		toggle_renderer_type = OS.g_type_register_static (OS.GTK_TYPE_CELL_RENDERER_TOGGLE (), type_name, toggle_renderer_info_ptr, 0);	}		OS.gtk_widget_set_default_direction (OS.GTK_TEXT_DIR_LTR);	OS.gdk_rgb_init ();	byte [] buffer = Converter.wcsToMbcs (null, APP_NAME, true);	OS.g_set_prgname (buffer);	OS.gdk_set_program_class (buffer);	byte [] flatStyle = Converter.wcsToMbcs (null, "style \"swt-flat\" { GtkToolbar::shadow-type = none } widget \"*.swt-toolbar-flat\" style : highest \"swt-flat\"", true);	OS.gtk_rc_parse_string (flatStyle);	/* Initialize the hidden shell */	shellHandle = OS.gtk_window_new (OS.GTK_WINDOW_TOPLEVEL);	if (shellHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);	OS.gtk_widget_realize (shellHandle);	/* Initialize the filter and event callback */	eventCallback = new Callback (this, "eventProc", 2);	eventProc = eventCallback.getAddress ();	if (eventProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);	OS.gdk_event_handler_set (eventProc, 0, 0);	filterCallback = new Callback (this, "filterProc", 3);	filterProc = filterCallback.getAddress ();	if (filterProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);	OS.gdk_window_add_filter  (0, filterProc, 0);}