backend

package
v0.0.0-...-c3f8d49 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Exec(bin string, arg ...string)
	Terminate()
	PointerSetPosition(pos wlc.Point)
	KeyboardGetKeysymForKey(key uint32, mods *wlc.Modifiers) uint32
}

Backend is an inteface describing the functions of a backend like wlc. This is used instead of calling wlc functions directly making it easier to implement tests which mocks the functionality of wlc.

func Get

func Get(ctx context.Context) Backend

Get backend from context.

type Mock

type Mock struct{}

Mock implements a mock interface satifying the Backend interface. Can be used for tests.

func (Mock) Exec

func (m Mock) Exec(bin string, arg ...string)

Exec mocks executing a command in the compositor.

func (Mock) KeyboardGetKeysymForKey

func (m Mock) KeyboardGetKeysymForKey(key uint32, mods *wlc.Modifiers) uint32

KeyboardGetKeysymForKey mocks getting keysym fro key.

func (Mock) PointerSetPosition

func (m Mock) PointerSetPosition(pos wlc.Point)

PointerSetPosition mocks setting pointer position.

func (Mock) Terminate

func (m Mock) Terminate()

Terminate mocks terminating the compositor.

type Output

type Output interface {
	Focus()
	GetMask() uint32
	GetMutableViews() []wlc.View // TODO: abstract this further if needed.
	Name() string
	GetRenderer() wlc.Renderer
	GetResolution() *wlc.Size
	GetVirtualResolution() *wlc.Size
	SetResolution(resolution wlc.Size, scale uint32)
	GetScale() uint32
	GetSleep() bool
	GetViews() []wlc.View
	ScheduleRender()
	SetMask(mask uint32)
	SetSleep(sleep bool)
	SetViews(views []wlc.View) bool
}

Output is an interface for the wlc Output type. Its purpose is to make it easy to mock wlc in tests.

type View

type View interface {
	BringAbove(other wlc.View)
	BringToFront()
	Close()
	Focus()
	GetAppID() string
	GetClass() string
	GetGeometry() *wlc.Geometry
	GetMask() uint32
	GetOutput() wlc.Output
	GetParent() wlc.View
	// GetRole() *C.struct_wl_resource
	GetState() uint32
	GetSurface() wlc.Resource
	Title() string
	GetType() uint32
	GetVisibleGeometry() wlc.Geometry
	// GetWlClient() *C.struct_wl_client
	SendBelow(other wlc.View)
	SendToBack()
	SetGeometry(edges uint32, geometry wlc.Geometry)
	SetMask(mask uint32)
	SetOutput(output wlc.Output)
	SetParent(parent wlc.View)
	SetState(state wlc.ViewStateBit, toggle bool)
	SetType(typ wlc.ViewTypeBit, toggle bool)
}

View is an interface for the wlc View type. Its purpose is to make it easy to mock wlc in tests.

type WLC

type WLC struct{}

WLC is a wrapper around the wlc api which implement the Backend interface.

func (WLC) Exec

func (w WLC) Exec(bin string, arg ...string)

Exec executes a command in the compositor.

func (WLC) KeyboardGetKeysymForKey

func (w WLC) KeyboardGetKeysymForKey(key uint32, mods *wlc.Modifiers) uint32

KeyboardGetKeysymForKey is an utility function to convert raw keycode to keysym. Passed modifiers may transform the key.

func (WLC) PointerSetPosition

func (w WLC) PointerSetPosition(pos wlc.Point)

PointerSetPosition sets pointer position.

func (WLC) Terminate

func (w WLC) Terminate()

Terminate terminates the compositor.

Jump to

Keyboard shortcuts

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