func viewHandlesSliceToCArray(arr []View) (*C.wlc_handle, C.size_t) { carr := C.handle_array_init(C.size_t(len(arr))) for i, h := range arr { C.handle_array_insert(carr, C.wlc_handle(h), C.int(i)) } return carr, C.size_t(len(arr)) }
// GetClass gets class. (shell-surface only). func (v View) GetClass() string { cclass := C.wlc_view_get_class(C.wlc_handle(v)) return C.GoString(cclass) }
// GetMutableViews gets mutable views in creation order. //This is mainly useful for wm's who need another view stack for inplace //sorting. For example tiling wms, may want to use this to keep their tiling //order separated from floating order. func (o Output) GetMutableViews() []View { var len C.size_t handles := C.wlc_output_get_mutable_views(C.wlc_handle(o), &len) return viewHandlesCArraytoGoSlice(handles, int(len)) }
// GetMask gets current visibility bitmask. func (o Output) GetMask() uint32 { return uint32(C.wlc_output_get_mask(C.wlc_handle(o))) }
// SetResolution sets output resolution. func (o Output) SetResolution(resolution Size, scale uint32) { csize := resolution.c() defer C.free(unsafe.Pointer(csize)) C.wlc_output_set_resolution(C.wlc_handle(o), csize, C.uint32_t(scale)) }
// SetSleep sets sleep status: wake up / sleep. func (o Output) SetSleep(sleep bool) { C.wlc_output_set_sleep(C.wlc_handle(o), C._Bool(sleep)) }
// Name gets output name. func (o Output) Name() string { cname := C.wlc_output_get_name(C.wlc_handle(o)) return C.GoString(cname) }
// SetType sets type bit. TOggle indicates whether it is set or not. func (v View) SetType(typ ViewTypeBit, toggle bool) { C.wlc_view_set_type(C.wlc_handle(v), uint32(typ), C._Bool(toggle)) }
// SendToBack sends view behind everything. func (v View) SendToBack() { C.wlc_view_send_to_back(C.wlc_handle(v)) }
// SetOutput sets output for view. Alternatively output.SetViews() can be used. func (v View) SetOutput(output Output) { C.wlc_view_set_output(C.wlc_handle(v), C.wlc_handle(output)) }
// GetOutput gets output of view. func (v View) GetOutput() Output { return Output(C.wlc_view_get_output(C.wlc_handle(v))) }
// Close closes view. func (v View) Close() { C.wlc_view_close(C.wlc_handle(v)) }
// Focus focuses view. func (v View) Focus() { C.wlc_view_focus(C.wlc_handle(v)) }
// GetPID gets pid of program owning the view. func (v View) GetPID() int { return int(C.wlc_view_get_pid(C.wlc_handle(v))) }
// GetAppID gets app id. (xdg-surface only). func (v View) GetAppID() string { capp := C.wlc_view_get_app_id(C.wlc_handle(v)) return C.GoString(capp) }
// SetGeometry sets geometry. Set edges if the geometry change is caused by // interactive resize. func (v View) SetGeometry(edges uint32, geometry Geometry) { cgeometry := geometry.c() defer C.free(unsafe.Pointer(cgeometry)) C.wlc_view_set_geometry(C.wlc_handle(v), C.uint32_t(edges), cgeometry) }
// GetType gets type bitfield for view. func (v View) GetType() uint32 { return uint32(C.wlc_view_get_type(C.wlc_handle(v))) }
// SendBelow sends view below another view. func (v View) SendBelow(other View) { C.wlc_view_send_below(C.wlc_handle(v), C.wlc_handle(other)) }
// Focus focuses output. func (o Output) Focus() { C.wlc_output_focus(C.wlc_handle(o)) }
// BringAbove brings view above another view. func (v View) BringAbove(other View) { C.wlc_view_bring_above(C.wlc_handle(v), C.wlc_handle(other)) }
// GetSleep gets output sleep state. func (o Output) GetSleep() bool { return bool(C.wlc_output_get_sleep(C.wlc_handle(o))) }
// BringToFront brings view to front of everything. func (v View) BringToFront() { C.wlc_view_bring_to_front(C.wlc_handle(v)) }
// GetVirtualResolution gets virtual output resolution with transformations // applied for proper rendering for example on high density displays. // Use this to figure out coordinate boundary. func (o Output) GetVirtualResolution() *Size { csize := C.wlc_output_get_virtual_resolution(C.wlc_handle(o)) return sizeCtoGo(csize) }
// GetMask gets current visibility bitmask. func (v View) GetMask() uint32 { return uint32(C.wlc_view_get_mask(C.wlc_handle(v))) }
// GetScale returns scale factor. func (o Output) GetScale() uint32 { return uint32(C.wlc_output_get_scale(C.wlc_handle(o))) }
// SetMask sets visibility bitmask. func (v View) SetMask(mask uint32) { C.wlc_view_set_mask(C.wlc_handle(v), C.uint32_t(mask)) }
// SetMask sets visibility bitmask. func (o Output) SetMask(mask uint32) { C.wlc_output_set_mask(C.wlc_handle(o), C.uint32_t(mask)) }
// GetGeometry gets current geometry (what the client sees). func (v View) GetGeometry() *Geometry { cgeometry := C.wlc_view_get_geometry(C.wlc_handle(v)) return geometryCtoGo(&Geometry{}, cgeometry) }
// SetViews sets views in stack order. This will also change mutable // views. Returns false on failure. func (o Output) SetViews(views []View) bool { cviews, len := viewHandlesSliceToCArray(views) return bool(C.wlc_output_set_views(C.wlc_handle(o), cviews, len)) }
// GetVisibleGeometry gets current visible geometry (what wlc displays). func (v View) GetVisibleGeometry() Geometry { cgeometry := C.struct_wlc_geometry{} C.wlc_view_get_visible_geometry(C.wlc_handle(v), &cgeometry) return *geometryCtoGo(&Geometry{}, &cgeometry) }