//XtensionRegisterWriter registers the writer wrapped by XtensionWrapWriter //with the surface so that it does not get garbage collected until libcairo //releases the device. // //See XtensionWrapWriter for more information. func (d *XtensionDevice) XtensionRegisterWriter(w unsafe.Pointer) { if err := d.Err(); err != nil { go_write_callback_reaper(w) } W := (*writer)(w) W.id = d.id() C.cairo_device_set_user_data(d.d, wkey, w, C.wreaper_getter()) storeWriter(W) }
func deviceSetID(d *C.cairo_device_t) { if C.cairo_device_get_user_data(d, idkey) != nil { return } C.cairo_device_set_user_data(d, idkey, generateID(), free) }