Exemplo n.º 1
0
func bind_seat(client *C.struct_wl_client, data unsafe.Pointer,
	version C.int, id C.uint32_t) {

	if version >= 2 {
		version = 2
	}

	resource := C.wl_resource_create(client, C.WL_seat_interface, version, id)

	C.wl_resource_set_implementation(
		resource,
		(unsafe.Pointer)(&seat_impl),
		nil,
		nil)

	if version >= 2 {
		C.wl_seat_send_name(resource, C.CString("default"))
	}

	C.wl_seat_send_capabilities(resource, 0)

}
Exemplo n.º 2
0
		}).Info("surface damage")
	},
)

var frame = cfn.CreateFunc(
	func(client *C.struct_wl_client,
		resource *C.struct_wl_resource,
		id C.uint32_t) {

		log.Info("frame")

		callback_resource := C.wl_resource_create(client,
			C.WL_callback_interface,
			1, id)

		C.wl_resource_set_implementation(callback_resource,
			nil, nil, nil)

		surface := compositors[client].Surfaces[resource]

		surface.frame_cbs = append(surface.frame_cbs, callback_resource)

	},
)

func argbToRgba(buf []byte) []byte {

	buffer := bytes.NewBuffer(buf)
	new_buffer := new(bytes.Buffer)

	read_buffer := make([]byte, 4)
	convert_buffer := make([]byte, 4)
Exemplo n.º 3
0
	set_class:      cPtr(set_class.CPtr()),
}

var get_shell_surface = cfn.CreateFunc(
	func(client *C.struct_wl_client,
		resource *C.struct_wl_resource,
		id C.uint32_t,
		surface_resource *C.struct_wl_resource) {
		println("get_shell_surface")
		shell_surface_res := C.wl_resource_create(client,
			C.WL_shell_surface_interface,
			C.wl_resource_get_version(resource),
			id)
		C.wl_resource_set_implementation(
			shell_surface_res,
			(unsafe.Pointer)(&shell_surface_impl),
			nil,
			nil)
	},
)

var shell_impl = C.struct_wl_shell_interface{
	get_shell_surface: cPtr(get_shell_surface.CPtr()),
}

var bind_shell = cfn.CreateFunc(
	func(client *C.struct_wl_client, data unsafe.Pointer,
		version C.int, id C.uint32_t) {

		if version >= 1 {
			version = 1
Exemplo n.º 4
0
	pool := Pool{
		client: client,
		id:     int(id),
		fd:     int(fd),
		ptr:    mmap_ptr,
	}

	pools[int(id)] = &pool

	// C.wl_resource_set_implementation(pool_res,
	// 	(unsafe.Pointer)(&shm_pool_impl),
	// 	unsafe.Pointer(&pool),
	// 	cPtr(pool.get_destroy_func()))
	C.wl_resource_set_implementation(pool_res,
		(unsafe.Pointer)(&shm_pool_impl),
		unsafe.Pointer(&pool),
		nil)

})

type WLBufferImage struct {
	buffer *Buffer
}

func newBufferImage(buffer *Buffer) *WLBufferImage {
	img := &WLBufferImage{
		buffer: buffer,
	}
	log.Info(buffer.format, buffer.stride)
	return img
}