wlcursor

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wlcursor implements a Wayland cursor

Index

Constants

View Source
const (
	BottomLeftCorner  = "bottom_left_corner"
	BottomRightCorner = "bottom_right_corner"
	BottomSide        = "bottom_side"
	Grabbing          = "grabbing"
	LeftPtr           = "left_ptr"
	LeftSide          = "left_side"
	RightSide         = "right_side"
	TopLeftCorner     = "top_left_corner"
	TopRightCorner    = "top_right_corner"
	TopSide           = "top_side"
	Xterm             = "xterm"
	Hand1             = "hand1"
	Watch             = "watch"
)

interesting cursor icons.

Variables

This section is empty.

Functions

func PointerSetCursor

func PointerSetCursor(p *wl.Pointer, serial uint32, pointerSurface *wl.Surface,
	hotspotX int32, hotspotY int32) error

PointerSetCursor sets Cursor of Pointer

Types

type Cursor

type Cursor struct {
	Name          string
	Images        []*ImageBuffer
	TotalDuration uint32
}

Cursor is a Theme cursor

func (*Cursor) Destroy

func (c *Cursor) Destroy() (err error)

Destroy destroys a Cursor

func (*Cursor) FrameAndDuration

func (c *Cursor) FrameAndDuration(millis uint32) FrameAndDuration

FrameAndDuration informs which frame and duration should be used at a specific time

func (*Cursor) GetCursorImage

func (c *Cursor) GetCursorImage(n int) *ImageBuffer

GetCursorImage gets the n-th image from cursor or nil

func (*Cursor) ImageCount

func (c *Cursor) ImageCount() int

ImageCount returns image count

type FrameAndDuration

type FrameAndDuration struct {
	FrameIndex    int
	FrameDuration uint32
}

FrameAndDuration carries information about a frame and duration that should be used

type Image

type Image interface {
	GetBuffer() *wl.Buffer
	GetWidth() int
	GetHeight() int
	GetHotspotX() int
	GetHotspotY() int
}

Image is a wlCursor cursor image

type ImageBuffer

type ImageBuffer struct {
	Delay uint32
	// contains filtered or unexported fields
}

ImageBuffer is a Wayland buffer for cursor

func NewImageBuffer

func NewImageBuffer(theme *Theme, image *xcursor.Image) (*ImageBuffer, error)

NewImageBuffer creates a new ImageBuffer from Theme and cursor Image

func (*ImageBuffer) Destroy

func (b *ImageBuffer) Destroy() error

Destroy destroys the ImageBuffer

func (*ImageBuffer) GetBuffer

func (b *ImageBuffer) GetBuffer() *wl.Buffer

GetBuffer gets buffer

func (*ImageBuffer) GetHeight

func (b *ImageBuffer) GetHeight() int

GetHeight gets height

func (*ImageBuffer) GetHotspotX

func (b *ImageBuffer) GetHotspotX() int

GetHotspotX gets hotspot x

func (*ImageBuffer) GetHotspotY

func (b *ImageBuffer) GetHotspotY() int

GetHotspotY gets hotspot Y

func (*ImageBuffer) GetWidth

func (b *ImageBuffer) GetWidth() int

GetWidth gets width

type Theme

type Theme struct {
	Pool     *wl.ShmPool
	File     *os.File
	Name     string
	Cursors  []*Cursor
	Size     uint32
	PoolSize int32
}

Theme is a wlCursor cursor image theme

func LoadTheme

func LoadTheme(size uint32, shm *wl.Shm) (*Theme, error)

LoadTheme loads a default-named theme with default size and shm pool, based on environment

func LoadThemeFromName

func LoadThemeFromName(name string, size uint32, shm *wl.Shm) (*Theme, error)

LoadThemeFromName loads a named theme with size and shm pool

func LoadThemeOr

func LoadThemeOr(name string, size uint32, shm *wl.Shm) (*Theme, error)

LoadThemeOr loads a named theme with size and shm pool, based on environment

func (*Theme) Destroy

func (t *Theme) Destroy() (err error)

Destroy destroys a Theme

func (*Theme) GetCursor

func (t *Theme) GetCursor(name string) (*Cursor, error)

GetCursor gets a Theme cursor by name

Directories

Path Synopsis
Package xcursor loads and parses the X cursor
Package xcursor loads and parses the X cursor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL