func (c *Compositor) resetFrameCallback() {
	for _, s := range c.Surfaces {
		for _, cb := range s.frame_cbs {
			C.wl_callback_send_done(cb, 1)
			C.wl_resource_destroy(cb)
		}

		s.frame_cbs = []*C.struct_wl_resource{}
	}
}
	frame_cbs     []*C.struct_wl_resource
	CommitBuffer  []byte
}

type Compositor struct {
	Pid      int
	Surfaces map[*C.struct_wl_resource]*Surface
}

var new_surface_signal C.struct_wl_signal

var surface_destroy = cfn.CreateFunc(
	func(client *C.struct_wl_client,
		resource *C.struct_wl_resource) {
		log.Info("surface_destroy")
		C.wl_resource_destroy(resource)
	},
)

var attach = cfn.CreateFunc(
	func(client *C.struct_wl_client,
		resource *C.struct_wl_resource,
		buffer *C.struct_wl_resource,
		x C.int32_t,
		y C.int32_t) {

		log.Info("attach")

		surface := compositors[client].Surfaces[resource]
		surface.pendingBuffer = buffer
	},