store_cutbuffer(inst->pasteout_data, inst->pasteout_data_len);
void write_clip(void *frontend, wchar_t * data, int len, int must_deselect){    struct gui_data *inst = (struct gui_data *)frontend;    if (inst->pasteout_data)	sfree(inst->pasteout_data);    if (inst->pasteout_data_ctext)	sfree(inst->pasteout_data_ctext);    if (inst->pasteout_data_utf8)	sfree(inst->pasteout_data_utf8);    /*     * Set up UTF-8 and compound text paste data. This only happens     * if we aren't in direct-to-font mode using the D800 hack.     */    if (!inst->direct_to_font) {	wchar_t *tmp = data;	int tmplen = len;	XTextProperty tp;	char *list[1];	inst->pasteout_data_utf8 = snewn(len*6, char);	inst->pasteout_data_utf8_len = len*6;	inst->pasteout_data_utf8_len =	    charset_from_unicode(&tmp, &tmplen, inst->pasteout_data_utf8,				 inst->pasteout_data_utf8_len,				 CS_UTF8, NULL, NULL, 0);	if (inst->pasteout_data_utf8_len == 0) {	    sfree(inst->pasteout_data_utf8);	    inst->pasteout_data_utf8 = NULL;	} else {	    inst->pasteout_data_utf8 =		sresize(inst->pasteout_data_utf8,			inst->pasteout_data_utf8_len + 1, char);	    inst->pasteout_data_utf8[inst->pasteout_data_utf8_len] = '\0';	}	/*	 * Now let Xlib convert our UTF-8 data into compound text.	 */	list[0] = inst->pasteout_data_utf8;	if (Xutf8TextListToTextProperty(GDK_DISPLAY(), list, 1,					XCompoundTextStyle, &tp) == 0) {	    inst->pasteout_data_ctext = snewn(tp.nitems+1, char);	    memcpy(inst->pasteout_data_ctext, tp.value, tp.nitems);	    inst->pasteout_data_ctext_len = tp.nitems;	    XFree(tp.value);	}    } else {	inst->pasteout_data_utf8 = NULL;	inst->pasteout_data_utf8_len = 0;	inst->pasteout_data_ctext = NULL;	inst->pasteout_data_ctext_len = 0;    }    inst->pasteout_data = snewn(len*6, char);    inst->pasteout_data_len = len*6;    inst->pasteout_data_len = wc_to_mb(inst->ucsdata.line_codepage, 0,				       data, len, inst->pasteout_data,				       inst->pasteout_data_len,				       NULL, NULL, NULL);    if (inst->pasteout_data_len == 0) {	sfree(inst->pasteout_data);	inst->pasteout_data = NULL;    } else {	inst->pasteout_data =	    sresize(inst->pasteout_data, inst->pasteout_data_len, char);    }    if (gtk_selection_owner_set(inst->area, GDK_SELECTION_PRIMARY,				inst->input_event_time)) {	gtk_selection_add_target(inst->area, GDK_SELECTION_PRIMARY,				 GDK_SELECTION_TYPE_STRING, 1);	if (inst->pasteout_data_ctext)	    gtk_selection_add_target(inst->area, GDK_SELECTION_PRIMARY,				     compound_text_atom, 1);	if (inst->pasteout_data_utf8)	    gtk_selection_add_target(inst->area, GDK_SELECTION_PRIMARY,				     utf8_string_atom, 1);    }    if (must_deselect)	term_deselect(inst->term);}