Beispiel #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)

}
			"y":      y,
			"width":  width,
			"height": height,
		}).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)
Beispiel #3
0
	set_transient:  cPtr(set_transient.CPtr()),
	set_fullscreen: cPtr(set_fullscreen.CPtr()),
	set_popup:      cPtr(set_popup.CPtr()),
	set_maximized:  cPtr(set_maximized.CPtr()),
	set_title:      cPtr(set_title.CPtr()),
	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,
Beispiel #4
0
	mmap_ptr, err := syscall.Mmap(
		int(fd), 0,
		int(size),
		syscall.PROT_READ|syscall.PROT_WRITE,
		syscall.MAP_SHARED,
	)

	if err != nil {
		fmt.Println(err)
		// TODO: should send error
	}

	pool_res := C.wl_resource_create(
		client,
		&C.wl_shm_pool_interface,
		(C.wl_resource_get_version(resource)),
		id,
	)

	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),