if (onClipboard) { OS.gtk_clipboard_clear(Clipboard.GTKCLIPBOARD); } if (onPrimary) { OS.gtk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD); }  GtkTargetEntry[] entries = new  GtkTargetEntry [0]; for (int i = 0; i < dataTypes.length; i++) { Transfer transfer = dataTypes[i]; int[] typeIds = transfer.getTypeIds(); String[] typeNames = transfer.getTypeNames(); for (int j = 0; j < typeIds.length; j++) { GtkTargetEntry	entry = new GtkTargetEntry(); entry.info = typeIds[j]; byte[] buffer = Converter.wcsToMbcs(null, typeNames[j], true); int  pName = OS.g_malloc(buffer.length); OS.memmove(pName, buffer, buffer.length); entry.target = pName; GtkTargetEntry[] tmp = new GtkTargetEntry [entries.length + 1]; System.arraycopy(entries, 0, tmp, 0, entries.length); tmp[entries.length] = entry; entries = tmp; } }  int  pTargetsList = OS.g_malloc(GtkTargetEntry.sizeof * entries.length); int offset = 0; for (int i = 0; i < entries.length; i++) { OS.memmove(pTargetsList + offset, entries[i], GtkTargetEntry.sizeof); offset += GtkTargetEntry.sizeof; }  this.data = data; this.dataTypes = dataTypes;  onPrimary = OS.gtk_clipboard_set_with_data(Clipboard.GTKPRIMARYCLIPBOARD, pTargetsList, entries.length, getFunc.getAddress(), clearFunc.getAddress(), 0); onClipboard = OS.gtk_clipboard_set_with_data(Clipboard.GTKCLIPBOARD, pTargetsList, entries.length, getFunc.getAddress(), clearFunc.getAddress(), 0);  for (int i = 0; i < entries.length; i++) { GtkTargetEntry entry = entries[i]; if( entry.target != 0) OS.g_free(entry.target); } if (pTargetsList != 0) OS.g_free(pTargetsList);  return (onClipboard && onPrimary);
return setData(data, dataTypes, DND.CLIPBOARD);
boolean setData(Object[] data, Transfer[] dataTypes) {	if (onClipboard) {			OS.gtk_clipboard_clear(Clipboard.GTKCLIPBOARD);	}	if (onPrimary) {		OS.gtk_clipboard_clear(Clipboard.GTKPRIMARYCLIPBOARD);	}			GtkTargetEntry[] entries = new  GtkTargetEntry [0];	for (int i = 0; i < dataTypes.length; i++) {		Transfer transfer = dataTypes[i];		int[] typeIds = transfer.getTypeIds();		String[] typeNames = transfer.getTypeNames();		for (int j = 0; j < typeIds.length; j++) {			GtkTargetEntry	entry = new GtkTargetEntry();									entry.info = typeIds[j];			byte[] buffer = Converter.wcsToMbcs(null, typeNames[j], true);			int /*long*/ pName = OS.g_malloc(buffer.length);			OS.memmove(pName, buffer, buffer.length);			entry.target = pName;			GtkTargetEntry[] tmp = new GtkTargetEntry [entries.length + 1];			System.arraycopy(entries, 0, tmp, 0, entries.length);			tmp[entries.length] = entry;			entries = tmp;						}		}		int /*long*/ pTargetsList = OS.g_malloc(GtkTargetEntry.sizeof * entries.length);	int offset = 0;	for (int i = 0; i < entries.length; i++) {		OS.memmove(pTargetsList + offset, entries[i], GtkTargetEntry.sizeof);		offset += GtkTargetEntry.sizeof;	}	this.data = data;	this.dataTypes = dataTypes;	onPrimary = OS.gtk_clipboard_set_with_data(Clipboard.GTKPRIMARYCLIPBOARD, pTargetsList, entries.length, getFunc.getAddress(), clearFunc.getAddress(), 0);	onClipboard = OS.gtk_clipboard_set_with_data(Clipboard.GTKCLIPBOARD, pTargetsList, entries.length, getFunc.getAddress(), clearFunc.getAddress(), 0);		for (int i = 0; i < entries.length; i++) {		GtkTargetEntry entry = entries[i];		if( entry.target != 0) OS.g_free(entry.target);	}	if (pTargetsList != 0) OS.g_free(pTargetsList);		return (onClipboard && onPrimary);}