cursor

package
v0.0.0-...-24e3d11 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package cursor is Go port of wayland/cursor library

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

This section is empty.

Types

type Cursor

type Cursor struct {
	// slice of still images composing this animation
	Images []Image

	// name of this cursor
	Name string
	// contains filtered or unexported fields
}

Cursor as returned by Theme.GetCursor()

func (*Cursor) Destroy

func (cursor *Cursor) Destroy() error

func (*Cursor) Frame

func (cursor *Cursor) Frame(time uint32) int

Frame finds the frame for a given elapsed time in a cursor animation

cursor: The cursor
time: Elapsed time in ms since the beginning of the animation

Returns the index of the image that should be displayed for the given time in the cursor animation.

func (*Cursor) FrameAndDuration

func (cursor *Cursor) FrameAndDuration(time uint32, d uint32) (int, uint32)

FrameAndDuration finds the frame for a given elapsed time in a cursor animation as well as the time left until next cursor change.

cursor: The cursor
time: Elapsed time in ms since the beginning of the animation
duration: Time left for this image or zero if the cursor won't change.

Returns the index of the image that should be displayed for the given time in the cursor animation and updated duration.

type Image

type Image struct {
	// Actual Width
	Width uint32

	// Actual Height
	Height uint32

	// Hotspot x (must be inside image)
	HotspotX uint32

	// Hotspot y (must be inside image)
	HotspotY uint32

	// Animation Delay to next frame (ms)
	Delay uint32
	// contains filtered or unexported fields
}

Image is a still image part of a cursor

Use Image.GetBuffer() to get the corresponding WlBuffer to attach to your WlSurface.

func (*Image) Destroy

func (image *Image) Destroy() error

func (*Image) GetBuffer

func (image *Image) GetBuffer() (*client.Buffer, error)

type MultiError

type MultiError struct {
	// contains filtered or unexported fields
}

func (*MultiError) Add

func (e *MultiError) Add(err error)

func (*MultiError) Err

func (e *MultiError) Err() error

func (*MultiError) Error

func (e *MultiError) Error() string

Error returns `\n` separated string of all errors.

type Theme

type Theme struct {
	// contains filtered or unexported fields
}

func LoadTheme

func LoadTheme(name string, size int, shm *client.Shm) (*Theme, error)

LoadTheme loads a cursor theme to memory shared with the compositor

name: The name of the cursor theme to load. If empty, the default theme will be loaded. size: Desired size of the cursor images. shm: The compositor's shm interface.

Returns an object representing the theme that should be destroyed with Theme.Destroy().

func (*Theme) Destroy

func (theme *Theme) Destroy() error

func (*Theme) GetCursor

func (theme *Theme) GetCursor(name string) *Cursor

GetCursor gets a cursor for a given name from a cursor theme

Returns the theme's cursor of the given name or nil if there is no such cursor

Directories

Path Synopsis
Package xcursor is Go port of libxcursor functions required by wayland/cursor
Package xcursor is Go port of libxcursor functions required by wayland/cursor

Jump to

Keyboard shortcuts

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