samure

package module
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Zlib Imports: 3 Imported by: 0

README

SamuraiRender Go

Go bindings to SamuraiRender which is an easy to use library to render into the layer shell of wayland compositors.

Getting Started

package main

import (
	"fmt"
	"os"

	samure "github.com/Samudevv/samurai-render-go"
	samureCairo "github.com/Samudevv/samurai-render-go/backends/cairo"
	"github.com/gotk3/gotk3/cairo"
)

type App struct {
}

func (*App) OnEvent(ctx samure.Context, event interface{}) {
}

func (*App) OnRender(ctx samure.Context, layerSurface samure.LayerSurface, o samure.Rect) {
	c := samureCairo.Get(layerSurface)
	c.SetOperator(cairo.OPERATOR_SOURCE)
	c.SetSourceRGBA(1.0, 1.0, 1.0, 0.2)
	c.Paint()
}

func (*App) OnUpdate(ctx samure.Context, deltaTime float64) {
}

func main() {
	cfg := samure.CreateContextConfig(&App{})

	ctx, err := samure.CreateContextWithBackend(cfg, &samureCairo.Backend{})
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create context: %v\n", err)
		os.Exit(1)
	}
	defer ctx.Destroy()

	ctx.Run()
}

Documentation

Index

Constants

View Source
const (
	RenderStateAlways = C.SAMURE_RENDER_STATE_ALWAYS
	RenderStateNone   = C.SAMURE_RENDER_STATE_NONE
	RenderStateOnce   = C.SAMURE_RENDER_STATE_ONCE
)
View Source
const (
	ErrorNone                    = C.SAMURE_ERROR_NONE
	ErrorFailed                  = C.SAMURE_ERROR_FAILED
	ErrorNotImplemented          = C.SAMURE_ERROR_NOT_IMPLEMENTED
	ErrorDisplayConnect          = C.SAMURE_ERROR_DISPLAY_CONNECT
	ErrorNoOutputs               = C.SAMURE_ERROR_NO_OUTPUTS
	ErrorNoXDGOutputManager      = C.SAMURE_ERROR_NO_XDG_OUTPUT_MANAGER
	ErrorNoLayerShell            = C.SAMURE_ERROR_NO_LAYER_SHELL
	ErrorNoSHM                   = C.SAMURE_ERROR_NO_SHM
	ErrorNoCompositor            = C.SAMURE_ERROR_NO_COMPOSITOR
	ErrorNoCursorShapeManager    = C.SAMURE_ERROR_NO_CURSOR_SHAPE_MANAGER
	ErrorNoScreencopyManager     = C.SAMURE_ERROR_NO_SCREENCOPY_MANAGER
	ErrorBackendInit             = C.SAMURE_ERROR_BACKEND_INIT
	ErrorNoBackendSupport        = C.SAMURE_ERROR_NO_BACKEND_SUPPORT
	ErrorLayerSurfaceInit        = C.SAMURE_ERROR_LAYER_SURFACE_INIT
	ErrorMemory                  = C.SAMURE_ERROR_MEMORY
	ErrorSharedBufferInit        = C.SAMURE_ERROR_SHARED_BUFFER_INIT
	ErrorOpenGLLoadProc          = C.SAMURE_ERROR_OPENGL_LOAD_PROC
	ErrorOpenGLDisplayConnect    = C.SAMURE_ERROR_OPENGL_DISPLAY_CONNECT
	ErrorOpenGLInitialize        = C.SAMURE_ERROR_OPENGL_INITIALIZE
	ErrorOpenGLConfig            = C.SAMURE_ERROR_OPENGL_CONFIG
	ErrorOpenGLBindAPI           = C.SAMURE_ERROR_OPENGL_BIND_API
	ErrorOpenGLContextInit       = C.SAMURE_ERROR_OPENGL_CONTEXT_INIT
	ErrorOpenGLwl_egl_windowInit = C.SAMURE_ERROR_OPENGL_WL_EGL_WINDOW_INIT
	ErrorOpenGLSurfaceInit       = C.SAMURE_ERROR_OPENGL_SURFACE_INIT
	ErrorSharedBufferFdInit      = C.SAMURE_ERROR_SHARED_BUFFER_FD_INIT
	ErrorSharedBufferTruncate    = C.SAMURE_ERROR_SHARED_BUFFER_TRUNCATE
	ErrorSharedBufferMmap        = C.SAMURE_ERROR_SHARED_BUFFER_MMAP
	ErrorSharedBufferPoolInit    = C.SAMURE_ERROR_SHARED_BUFFER_POOL_INIT
	ErrorSharedBufferBufferInit  = C.SAMURE_ERROR_SHARED_BUFFER_BUFFER_INIT
	ErrorFrameInit               = C.SAMURE_ERROR_FRAME_INIT
	ErrorCairoSurfaceInit        = C.SAMURE_ERROR_CAIRO_SURFACE_INIT
	ErrorCairoInit               = C.SAMURE_ERROR_CAIRO_INIT
	ErrorSurfaceInit             = C.SAMURE_ERROR_SURFACE_INIT
	ErrorOutputInit              = C.SAMURE_ERROR_OUTPUT_INIT
)
View Source
const (
	KeyReserved         = C.KEY_RESERVED
	KeyEsc              = C.KEY_ESC
	Key1                = C.KEY_1
	Key2                = C.KEY_2
	Key3                = C.KEY_3
	Key4                = C.KEY_4
	Key5                = C.KEY_5
	Key6                = C.KEY_6
	Key7                = C.KEY_7
	Key8                = C.KEY_8
	Key9                = C.KEY_9
	Key0                = C.KEY_0
	KeyMinus            = C.KEY_MINUS
	KeyEqual            = C.KEY_EQUAL
	KeyBackspace        = C.KEY_BACKSPACE
	KeyTab              = C.KEY_TAB
	KeyQ                = C.KEY_Q
	KeyW                = C.KEY_W
	KeyE                = C.KEY_E
	KeyR                = C.KEY_R
	KeyT                = C.KEY_T
	KeyY                = C.KEY_Y
	KeyU                = C.KEY_U
	KeyI                = C.KEY_I
	KeyO                = C.KEY_O
	KeyP                = C.KEY_P
	KeyLeftbrace        = C.KEY_LEFTBRACE
	KeyRightbrace       = C.KEY_RIGHTBRACE
	KeyEnter            = C.KEY_ENTER
	KeyLeftctrl         = C.KEY_LEFTCTRL
	KeyA                = C.KEY_A
	KeyS                = C.KEY_S
	KeyD                = C.KEY_D
	KeyF                = C.KEY_F
	KeyG                = C.KEY_G
	KeyH                = C.KEY_H
	KeyJ                = C.KEY_J
	KeyK                = C.KEY_K
	KeyL                = C.KEY_L
	KeySemicolon        = C.KEY_SEMICOLON
	KeyApostrophe       = C.KEY_APOSTROPHE
	KeyGrave            = C.KEY_GRAVE
	KeyLeftshift        = C.KEY_LEFTSHIFT
	KeyBackslash        = C.KEY_BACKSLASH
	KeyZ                = C.KEY_Z
	KeyX                = C.KEY_X
	KeyC                = C.KEY_C
	KeyV                = C.KEY_V
	KeyB                = C.KEY_B
	KeyN                = C.KEY_N
	KeyM                = C.KEY_M
	KeyComma            = C.KEY_COMMA
	KeyDot              = C.KEY_DOT
	KeySlash            = C.KEY_SLASH
	KeyRightshift       = C.KEY_RIGHTSHIFT
	KeyKpasterisk       = C.KEY_KPASTERISK
	KeyLeftalt          = C.KEY_LEFTALT
	KeySpace            = C.KEY_SPACE
	KeyCapslock         = C.KEY_CAPSLOCK
	KeyF1               = C.KEY_F1
	KeyF2               = C.KEY_F2
	KeyF3               = C.KEY_F3
	KeyF4               = C.KEY_F4
	KeyF5               = C.KEY_F5
	KeyF6               = C.KEY_F6
	KeyF7               = C.KEY_F7
	KeyF8               = C.KEY_F8
	KeyF9               = C.KEY_F9
	KeyF10              = C.KEY_F10
	KeyNumlock          = C.KEY_NUMLOCK
	KeyScrolllock       = C.KEY_SCROLLLOCK
	KeyKp7              = C.KEY_KP7
	KeyKp8              = C.KEY_KP8
	KeyKp9              = C.KEY_KP9
	KeyKpminus          = C.KEY_KPMINUS
	KeyKp4              = C.KEY_KP4
	KeyKp5              = C.KEY_KP5
	KeyKp6              = C.KEY_KP6
	KeyKpplus           = C.KEY_KPPLUS
	KeyKp1              = C.KEY_KP1
	KeyKp2              = C.KEY_KP2
	KeyKp3              = C.KEY_KP3
	KeyKp0              = C.KEY_KP0
	KeyKpdot            = C.KEY_KPDOT
	KeyZenkakuhankaku   = C.KEY_ZENKAKUHANKAKU
	Key_102Nd           = C.KEY_102ND
	KeyF11              = C.KEY_F11
	KeyF12              = C.KEY_F12
	KeyRo               = C.KEY_RO
	KeyKatakana         = C.KEY_KATAKANA
	KeyHiragana         = C.KEY_HIRAGANA
	KeyHenkan           = C.KEY_HENKAN
	KeyKatakanahiragana = C.KEY_KATAKANAHIRAGANA
	KeyMuhenkan         = C.KEY_MUHENKAN
	KeyKpjpcomma        = C.KEY_KPJPCOMMA
	KeyKpenter          = C.KEY_KPENTER
	KeyRightctrl        = C.KEY_RIGHTCTRL
	KeyKpslash          = C.KEY_KPSLASH
	KeySysrq            = C.KEY_SYSRQ
	KeyRightalt         = C.KEY_RIGHTALT
	KeyLinefeed         = C.KEY_LINEFEED
	KeyHome             = C.KEY_HOME
	KeyUp               = C.KEY_UP
	KeyPageup           = C.KEY_PAGEUP
	KeyLeft             = C.KEY_LEFT
	KeyRight            = C.KEY_RIGHT
	KeyEnd              = C.KEY_END
	KeyDown             = C.KEY_DOWN
	KeyPagedown         = C.KEY_PAGEDOWN
	KeyInsert           = C.KEY_INSERT
	KeyDelete           = C.KEY_DELETE
	KeyMacro            = C.KEY_MACRO
	KeyMute             = C.KEY_MUTE
	KeyVolumedown       = C.KEY_VOLUMEDOWN
	KeyVolumeup         = C.KEY_VOLUMEUP
	KeyPower            = C.KEY_POWER
	KeyKpequal          = C.KEY_KPEQUAL
	KeyKpplusminus      = C.KEY_KPPLUSMINUS
	KeyPause            = C.KEY_PAUSE
	KeyScale            = C.KEY_SCALE
	KeyKpcomma          = C.KEY_KPCOMMA
	KeyHangeul          = C.KEY_HANGEUL
	KeyHanguel          = C.KEY_HANGUEL
	KeyHanja            = C.KEY_HANJA
	KeyYen              = C.KEY_YEN
	KeyLeftmeta         = C.KEY_LEFTMETA
	KeyRightmeta        = C.KEY_RIGHTMETA
	KeyCompose          = C.KEY_COMPOSE
	KeyStop             = C.KEY_STOP
	KeyAgain            = C.KEY_AGAIN
	KeyProps            = C.KEY_PROPS
	KeyUndo             = C.KEY_UNDO
	KeyFront            = C.KEY_FRONT
	KeyCopy             = C.KEY_COPY
	KeyOpen             = C.KEY_OPEN
	KeyPaste            = C.KEY_PASTE
	KeyFind             = C.KEY_FIND
	KeyCut              = C.KEY_CUT
	KeyHelp             = C.KEY_HELP
	KeyMenu             = C.KEY_MENU
	KeyCalc             = C.KEY_CALC
	KeySetup            = C.KEY_SETUP
	KeySleep            = C.KEY_SLEEP
	KeyWakeup           = C.KEY_WAKEUP
	KeyFile             = C.KEY_FILE
	KeySendfile         = C.KEY_SENDFILE
	KeyDeletefile       = C.KEY_DELETEFILE
	KeyXfer             = C.KEY_XFER
	KeyProg1            = C.KEY_PROG1
	KeyProg2            = C.KEY_PROG2
	KeyWww              = C.KEY_WWW
	KeyMsdos            = C.KEY_MSDOS
	KeyCoffee           = C.KEY_COFFEE
	KeyScreenlock       = C.KEY_SCREENLOCK
	KeyRotateDisplay    = C.KEY_ROTATE_DISPLAY
	KeyDirection        = C.KEY_DIRECTION
	KeyCyclewindows     = C.KEY_CYCLEWINDOWS
	KeyMail             = C.KEY_MAIL
	KeyBookmarks        = C.KEY_BOOKMARKS
	KeyComputer         = C.KEY_COMPUTER
	KeyBack             = C.KEY_BACK
	KeyForward          = C.KEY_FORWARD
	KeyClosecd          = C.KEY_CLOSECD
	KeyEjectcd          = C.KEY_EJECTCD
	KeyEjectclosecd     = C.KEY_EJECTCLOSECD
	KeyNextsong         = C.KEY_NEXTSONG
	KeyPlaypause        = C.KEY_PLAYPAUSE
	KeyPrevioussong     = C.KEY_PREVIOUSSONG
	KeyStopcd           = C.KEY_STOPCD
	KeyRecord           = C.KEY_RECORD
	KeyRewind           = C.KEY_REWIND
	KeyPhone            = C.KEY_PHONE
	KeyIso              = C.KEY_ISO
	KeyConfig           = C.KEY_CONFIG
	KeyHomepage         = C.KEY_HOMEPAGE
	KeyRefresh          = C.KEY_REFRESH
	KeyExit             = C.KEY_EXIT
	KeyMove             = C.KEY_MOVE
	KeyEdit             = C.KEY_EDIT
	KeyScrollup         = C.KEY_SCROLLUP
	KeyScrolldown       = C.KEY_SCROLLDOWN
	KeyKpleftparen      = C.KEY_KPLEFTPAREN
	KeyKprightparen     = C.KEY_KPRIGHTPAREN
	KeyNew              = C.KEY_NEW
	KeyRedo             = C.KEY_REDO
	KeyF13              = C.KEY_F13
	KeyF14              = C.KEY_F14
	KeyF15              = C.KEY_F15
	KeyF16              = C.KEY_F16
	KeyF17              = C.KEY_F17
	KeyF18              = C.KEY_F18
	KeyF19              = C.KEY_F19
	KeyF20              = C.KEY_F20
	KeyF21              = C.KEY_F21
	KeyF22              = C.KEY_F22
	KeyF23              = C.KEY_F23
	KeyF24              = C.KEY_F24
	KeyPlaycd           = C.KEY_PLAYCD
	KeyPausecd          = C.KEY_PAUSECD
	KeyProg3            = C.KEY_PROG3
	KeyProg4            = C.KEY_PROG4
	KeyAllApplications  = C.KEY_ALL_APPLICATIONS
	KeyDashboard        = C.KEY_DASHBOARD
	KeySuspend          = C.KEY_SUSPEND
	KeyClose            = C.KEY_CLOSE
	KeyPlay             = C.KEY_PLAY
	KeyFastforward      = C.KEY_FASTFORWARD
	KeyBassboost        = C.KEY_BASSBOOST
	KeyPrint            = C.KEY_PRINT
	KeyHp               = C.KEY_HP
	KeyCamera           = C.KEY_CAMERA
	KeySound            = C.KEY_SOUND
	KeyQuestion         = C.KEY_QUESTION
	KeyEmail            = C.KEY_EMAIL
	KeyChat             = C.KEY_CHAT
	KeySearch           = C.KEY_SEARCH
	KeyConnect          = C.KEY_CONNECT
	KeyFinance          = C.KEY_FINANCE
	KeySport            = C.KEY_SPORT
	KeyShop             = C.KEY_SHOP
	KeyAlterase         = C.KEY_ALTERASE
	KeyCancel           = C.KEY_CANCEL
	KeyBrightnessdown   = C.KEY_BRIGHTNESSDOWN
	KeyBrightnessup     = C.KEY_BRIGHTNESSUP
	KeyMedia            = C.KEY_MEDIA
	KeySwitchvideomode  = C.KEY_SWITCHVIDEOMODE
	KeyKbdillumtoggle   = C.KEY_KBDILLUMTOGGLE
	KeyKbdillumdown     = C.KEY_KBDILLUMDOWN
	KeyKbdillumup       = C.KEY_KBDILLUMUP
	KeySend             = C.KEY_SEND
	KeyReply            = C.KEY_REPLY
	KeyForwardmail      = C.KEY_FORWARDMAIL
	KeySave             = C.KEY_SAVE
	KeyDocuments        = C.KEY_DOCUMENTS
	KeyBattery          = C.KEY_BATTERY
	KeyBluetooth        = C.KEY_BLUETOOTH
	KeyWlan             = C.KEY_WLAN
	KeyUwb              = C.KEY_UWB
	KeyUnknown          = C.KEY_UNKNOWN
	KeyVideoNext        = C.KEY_VIDEO_NEXT
	KeyVideoPrev        = C.KEY_VIDEO_PREV
	KeyBrightnessCycle  = C.KEY_BRIGHTNESS_CYCLE
	KeyBrightnessAuto   = C.KEY_BRIGHTNESS_AUTO
	KeyBrightnessZero   = C.KEY_BRIGHTNESS_ZERO
	KeyDisplayOff       = C.KEY_DISPLAY_OFF
	KeyWwan             = C.KEY_WWAN
	KeyWimax            = C.KEY_WIMAX
	KeyRfkill           = C.KEY_RFKILL
	KeyMicmute          = C.KEY_MICMUTE
)

Keyboard keys

View Source
const (
	ButtonMisc          = C.BTN_MISC
	Button0             = C.BTN_0
	Button1             = C.BTN_1
	Button2             = C.BTN_2
	Button3             = C.BTN_3
	Button4             = C.BTN_4
	Button5             = C.BTN_5
	Button6             = C.BTN_6
	Button7             = C.BTN_7
	Button8             = C.BTN_8
	Button9             = C.BTN_9
	ButtonMouse         = C.BTN_MOUSE
	ButtonLeft          = C.BTN_LEFT
	ButtonRight         = C.BTN_RIGHT
	ButtonMiddle        = C.BTN_MIDDLE
	ButtonSide          = C.BTN_SIDE
	ButtonExtra         = C.BTN_EXTRA
	ButtonForward       = C.BTN_FORWARD
	ButtonBack          = C.BTN_BACK
	ButtonTask          = C.BTN_TASK
	ButtonJoystick      = C.BTN_JOYSTICK
	ButtonTrigger       = C.BTN_TRIGGER
	ButtonThumb         = C.BTN_THUMB
	ButtonThumb2        = C.BTN_THUMB2
	ButtonTop           = C.BTN_TOP
	ButtonTop2          = C.BTN_TOP2
	ButtonPinkie        = C.BTN_PINKIE
	ButtonBase          = C.BTN_BASE
	ButtonBase2         = C.BTN_BASE2
	ButtonBase3         = C.BTN_BASE3
	ButtonBase4         = C.BTN_BASE4
	ButtonBase5         = C.BTN_BASE5
	ButtonBase6         = C.BTN_BASE6
	ButtonDead          = C.BTN_DEAD
	ButtonGamepad       = C.BTN_GAMEPAD
	ButtonSouth         = C.BTN_SOUTH
	ButtonA             = C.BTN_A
	ButtonEast          = C.BTN_EAST
	ButtonB             = C.BTN_B
	ButtonC             = C.BTN_C
	ButtonNorth         = C.BTN_NORTH
	ButtonX             = C.BTN_X
	ButtonWest          = C.BTN_WEST
	ButtonY             = C.BTN_Y
	ButtonZ             = C.BTN_Z
	ButtonTl            = C.BTN_TL
	ButtonTr            = C.BTN_TR
	ButtonTl2           = C.BTN_TL2
	ButtonTr2           = C.BTN_TR2
	ButtonSelect        = C.BTN_SELECT
	ButtonStart         = C.BTN_START
	ButtonMode          = C.BTN_MODE
	ButtonThumbl        = C.BTN_THUMBL
	ButtonThumbr        = C.BTN_THUMBR
	ButtonDigi          = C.BTN_DIGI
	ButtonToolPen       = C.BTN_TOOL_PEN
	ButtonToolRubber    = C.BTN_TOOL_RUBBER
	ButtonToolBrush     = C.BTN_TOOL_BRUSH
	ButtonToolPencil    = C.BTN_TOOL_PENCIL
	ButtonToolAirbrush  = C.BTN_TOOL_AIRBRUSH
	ButtonToolFinger    = C.BTN_TOOL_FINGER
	ButtonToolMouse     = C.BTN_TOOL_MOUSE
	ButtonToolLens      = C.BTN_TOOL_LENS
	ButtonToolQuinttap  = C.BTN_TOOL_QUINTTAP
	ButtonStylus3       = C.BTN_STYLUS3
	ButtonTouch         = C.BTN_TOUCH
	ButtonStylus        = C.BTN_STYLUS
	ButtonStylus2       = C.BTN_STYLUS2
	ButtonToolDoubletap = C.BTN_TOOL_DOUBLETAP
	ButtonToolTripletap = C.BTN_TOOL_TRIPLETAP
	ButtonToolQuadtap   = C.BTN_TOOL_QUADTAP
	ButtonWheel         = C.BTN_WHEEL
	ButtonGearDown      = C.BTN_GEAR_DOWN
	ButtonGearUp        = C.BTN_GEAR_UP
)

Mouse buttons

Button and Key states

View Source
const (
	CursorShapeDefault      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT
	CursorShapeContextMenu  = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CONTEXT_MENU
	CursorShapeHelp         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_HELP
	CursorShapePointer      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER
	CursorShapeProgress     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_PROGRESS
	CursorShapeWait         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_WAIT
	CursorShapeCell         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CELL
	CursorShapeCrosshair    = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_CROSSHAIR
	CursorShapeText         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_TEXT
	CursorShapeVerticalText = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_VERTICAL_TEXT
	CursorShapeAlias        = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALIAS
	CursorShapeCopy         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_COPY
	CursorShapeMove         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_MOVE
	CursorShapeNoDrop       = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NO_DROP
	CursorShapeNotAllowed   = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NOT_ALLOWED
	CursorShapeGrab         = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_GRAB
	CursorShapeGrabbing     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_GRABBING
	CursorShapeEResize      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_E_RESIZE
	CursorShapeNResize      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_N_RESIZE
	CursorShapeNeResize     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NE_RESIZE
	CursorShapeNwResize     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NW_RESIZE
	CursorShapeSResize      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_S_RESIZE
	CursorShapeSeResize     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_SE_RESIZE
	CursorShapeSwResize     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_SW_RESIZE
	CursorShapeWResize      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_W_RESIZE
	CursorShapeEwResize     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_EW_RESIZE
	CursorShapeNsResize     = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NS_RESIZE
	CursorShapeNeswResize   = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NESW_RESIZE
	CursorShapeNwseResize   = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_NWSE_RESIZE
	CursorShapeColResize    = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_COL_RESIZE
	CursorShapeRowResize    = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ROW_RESIZE
	CursorShapeAllScroll    = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ALL_SCROLL
	CursorShapeZoomIn       = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ZOOM_IN
	CursorShapeZoomOut      = C.WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_ZOOM_OUT
)

Variables

This section is empty.

Functions

func AddGlobalApp

func AddGlobalApp(a App) int

func AddGlobalBackend

func AddGlobalBackend(bak Backend) int

Types

type App

type App interface {
	OnEvent(ctx Context, event interface{})
	OnRender(ctx Context, layerSurface LayerSurface, outputGeo Rect)
	OnUpdate(ctx Context, deltaTime float64)
}

func GetGlobalApp

func GetGlobalApp(idx int) App

type Backend

type Backend interface {
	Init(ctx Context) error
	OnLayerSurfaceConfigure(ctx Context, layerSurface LayerSurface, width, height int)
	RenderStart(ctx Context, layerSurface LayerSurface)
	RenderEnd(ctx Context, layerSurface LayerSurface)
	Destroy(ctx Context)
	AssociateLayerSurface(ctx Context, layerSurface LayerSurface) uint64
	UnassociateLayerSurface(ctx Context, layerSurface LayerSurface)
}

func GetGlobalBackend

func GetGlobalBackend(idx int) Backend

type Context

type Context struct {
	Handle *C.struct_samure_context
}

func CreateContextWithBackend

func CreateContextWithBackend(cfg *ContextConfig, bak Backend) (Context, error)

func (Context) Compositor

func (ctx Context) Compositor() unsafe.Pointer

func (Context) CreateOutputLayerSurfaces

func (ctx Context) CreateOutputLayerSurfaces() error

func (Context) Destroy

func (ctx Context) Destroy()

func (Context) Display

func (ctx Context) Display() unsafe.Pointer

func (Context) Flush

func (ctx Context) Flush()

func (Context) GetOutputRect

func (ctx Context) GetOutputRect() Rect

func (Context) LayerShell

func (ctx Context) LayerShell() unsafe.Pointer

func (Context) LenOutputs

func (ctx Context) LenOutputs() int

func (Context) LenSeats

func (ctx Context) LenSeats() int

func (Context) Output

func (ctx Context) Output(idx int) Output

func (Context) OutputManager

func (ctx Context) OutputManager() unsafe.Pointer

func (Context) ProcessEvents

func (ctx Context) ProcessEvents()

func (Context) RenderLayerSurface

func (ctx Context) RenderLayerSurface(sfc LayerSurface, o Rect)

func (Context) RenderOutput

func (ctx Context) RenderOutput(o Output)

func (Context) Run

func (ctx Context) Run()

func (Context) ScreencopyManager

func (ctx Context) ScreencopyManager() unsafe.Pointer

func (Context) Seat

func (ctx Context) Seat(idx int) Seat

func (Context) SetInputRegions

func (ctx Context) SetInputRegions(rs []Rect)

func (Context) SetKeyboardInteraction

func (ctx Context) SetKeyboardInteraction(enable bool)

func (Context) SetPointerInteraction

func (ctx Context) SetPointerInteraction(enable bool)

func (Context) SetPointerShape

func (ctx Context) SetPointerShape(shape int)

func (Context) SetRenderState

func (ctx Context) SetRenderState(v int)

func (Context) SetRunning

func (ctx Context) SetRunning(v bool)

func (Context) Shm

func (ctx Context) Shm() unsafe.Pointer

func (Context) Update

func (ctx Context) Update(deltaTime float64)

type ContextConfig

type ContextConfig struct {
	PointerInteraction           bool
	KeyboardInteraction          bool
	TouchInteraction             bool
	MaxUpdateFrequency           int
	NotCreateOutputLayerSurfaces bool
	NotRequestFrame              bool
	ForceClientCursors           bool
	GL                           OpenGLConfig

	App App
}

func CreateContextConfig

func CreateContextConfig(a App) *ContextConfig

type Error

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

func NewError

func NewError(errorCode uint64) *Error

func (*Error) Error

func (err *Error) Error() string

type EventKeyboardEnter

type EventKeyboardEnter struct {
	Seat    Seat
	Output  Output
	Surface LayerSurface
}

type EventKeyboardKey

type EventKeyboardKey struct {
	Seat  Seat
	Key   int
	State int
}

type EventKeyboardLeave

type EventKeyboardLeave struct {
	Seat Seat
}

type EventPointerButton

type EventPointerButton struct {
	Seat   Seat
	Button int
	State  int
}

type EventPointerEnter

type EventPointerEnter struct {
	Seat    Seat
	Output  Output
	Surface LayerSurface
	X       float64
	Y       float64
}

type EventPointerLeave

type EventPointerLeave struct {
	Seat    Seat
	Output  Output
	Surface LayerSurface
}

type EventPointerMotion

type EventPointerMotion struct {
	Seat Seat
	X    float64
	Y    float64
}

type EventTouchDown

type EventTouchDown struct {
	Seat    Seat
	Output  Output
	Surface LayerSurface
	X       float64
	Y       float64
	TouchID int
}

type EventTouchMotion

type EventTouchMotion struct {
	Seat    Seat
	X       float64
	Y       float64
	TouchID int
}

type EventTouchUp

type EventTouchUp struct {
	Seat    Seat
	TouchID int
}

type Focus

type Focus struct {
	Handle C.struct_samure_focus
}

func (Focus) Output

func (f Focus) Output() Output

func (Focus) Surface

func (f Focus) Surface() LayerSurface

type LayerSurface

type LayerSurface struct {
	Handle *C.struct_samure_layer_surface
}

func CreateLayerSurface

func CreateLayerSurface(ctx Context, o *Output, layer, anchor int, keyboardInteraction, pointerInteraction, backendAssociation bool) (LayerSurface, error)

func (LayerSurface) BackendData

func (sfc LayerSurface) BackendData() unsafe.Pointer

func (LayerSurface) Destroy

func (sfc LayerSurface) Destroy(ctx Context)

func (LayerSurface) DrawBuffer

func (sfc LayerSurface) DrawBuffer(b SharedBuffer)

func (LayerSurface) FrameDeltaTime

func (sfc LayerSurface) FrameDeltaTime() float64

func (LayerSurface) H

func (sfc LayerSurface) H() int

func (LayerSurface) LayerSurface

func (sfc LayerSurface) LayerSurface() unsafe.Pointer

func (LayerSurface) Scale added in v1.24.0

func (sfc LayerSurface) Scale() float64

func (LayerSurface) Surface

func (sfc LayerSurface) Surface() unsafe.Pointer

func (LayerSurface) W

func (sfc LayerSurface) W() int

type OpenGLConfig

type OpenGLConfig struct {
	RedSize      int
	GreenSize    int
	BlueSize     int
	AlphaSize    int
	Samples      int
	DepthSize    int
	MajorVersion int
	MinorVersion int
	ProfileMask  int
	Debug        int
	ColorSpace   int
	RenderBuffer int
}

func DefaultOpenGLConfig

func DefaultOpenGLConfig() OpenGLConfig

type Output

type Output struct {
	Handle *C.struct_samure_output
}

func (Output) AttachLayerSurface

func (o Output) AttachLayerSurface(sfc LayerSurface)

func (Output) CircleInOutput

func (o Output) CircleInOutput(cx, cy, r int) bool

func (Output) Geo

func (o Output) Geo() Rect

func (Output) LenSurfaces

func (o Output) LenSurfaces() int

func (Output) Name

func (o Output) Name() string

func (Output) Output

func (o Output) Output() unsafe.Pointer

func (Output) PointInOutput

func (o Output) PointInOutput(x, y int) bool

func (Output) RectInOutput

func (o Output) RectInOutput(x, y, w, h int) bool

func (Output) Screenshot

func (o Output) Screenshot(ctx Context, captureCursor bool) (SharedBuffer, error)

func (Output) SetInputRegions

func (o Output) SetInputRegions(ctx Context, rs []Rect)

func (Output) SetKeyboardInteraction

func (o Output) SetKeyboardInteraction(enable bool)

func (Output) SetPointerInteraction

func (o Output) SetPointerInteraction(ctx Context, enable bool)

func (Output) SquareInOutput

func (o Output) SquareInOutput(x, y, size int) bool

func (Output) Surface

func (o Output) Surface(idx int) LayerSurface

func (Output) TriangleInOutput

func (o Output) TriangleInOutput(x1, y1, x2, y2, x3, y3 int) bool

func (Output) XdgOutput

func (o Output) XdgOutput() unsafe.Pointer

type RawBackend

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

func (*RawBackend) AssociateLayerSurface

func (raw *RawBackend) AssociateLayerSurface(ctx Context, layerSurface LayerSurface) uint64

func (*RawBackend) Destroy

func (raw *RawBackend) Destroy(ctx Context)

func (*RawBackend) Init

func (raw *RawBackend) Init(ctx Context) error

func (*RawBackend) OnLayerSurfaceConfigure

func (raw *RawBackend) OnLayerSurfaceConfigure(ctx Context, layerSurface LayerSurface, width, height int)

func (*RawBackend) RenderEnd

func (raw *RawBackend) RenderEnd(ctx Context, layerSurface LayerSurface)

func (*RawBackend) RenderStart

func (raw *RawBackend) RenderStart(ctx Context, layerSurface LayerSurface)

func (*RawBackend) UnassociateLayerSurface

func (raw *RawBackend) UnassociateLayerSurface(ctx Context, layerSurface LayerSurface)

type RawSurface

type RawSurface struct {
	Handle *C.struct_samure_raw_surface
}

func GetRaw

func GetRaw(sfc LayerSurface) RawSurface

func (RawSurface) Buffer

func (r RawSurface) Buffer() SharedBuffer

func (RawSurface) Data

func (r RawSurface) Data() unsafe.Pointer

type Rect

type Rect struct {
	X, Y, W, H int
}

func (Rect) CircleInOutput

func (o Rect) CircleInOutput(cx, cy, r int) bool

func (Rect) PointInOutput

func (o Rect) PointInOutput(x, y int) bool

func (Rect) RectInOutput

func (o Rect) RectInOutput(x, y, w, h int) bool

func (Rect) RelX

func (o Rect) RelX(x float64) float64

func (Rect) RelY

func (o Rect) RelY(y float64) float64

func (Rect) SquareInOutput

func (o Rect) SquareInOutput(x, y, size int) bool

func (Rect) TriangleInOutput

func (o Rect) TriangleInOutput(x1, y1, x2, y2, x3, y3 int) bool

type Seat

type Seat struct {
	Handle *C.struct_samure_seat
}

func (Seat) Keyboard

func (s Seat) Keyboard() unsafe.Pointer

func (Seat) KeyboardFocus

func (s Seat) KeyboardFocus() Focus

func (Seat) Name

func (s Seat) Name() string

func (Seat) Pointer

func (s Seat) Pointer() unsafe.Pointer

func (Seat) PointerFocus

func (s Seat) PointerFocus() Focus

func (Seat) Seat

func (s Seat) Seat() unsafe.Pointer

func (Seat) Touch

func (s Seat) Touch() unsafe.Pointer

func (Seat) TouchFocus

func (s Seat) TouchFocus() Focus

type SharedBuffer

type SharedBuffer struct {
	Handle *C.struct_samure_shared_buffer
}

func (SharedBuffer) Buffer

func (b SharedBuffer) Buffer() unsafe.Pointer

func (SharedBuffer) Copy

func (b SharedBuffer) Copy(src SharedBuffer) error

func (SharedBuffer) Data

func (b SharedBuffer) Data() unsafe.Pointer

func (SharedBuffer) Destroy

func (b SharedBuffer) Destroy()

func (SharedBuffer) Fd

func (b SharedBuffer) Fd() int

func (SharedBuffer) Format

func (b SharedBuffer) Format() int

func (SharedBuffer) Height

func (b SharedBuffer) Height() int

func (SharedBuffer) Width

func (b SharedBuffer) Width() int

Directories

Path Synopsis
backends
cmd

Jump to

Keyboard shortcuts

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