window

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package window implements a convenient wayland windowing

Index

Constants

View Source
const (
	TYPE_NONE byte = iota
	TYPE_TOPLEVEL
	TYPE_FULLSCREEN
	TYPE_MAXIMIZED
	TYPE_TRANSIENT
	TYPE_MENU
	TYPE_CUSTOM
)
View Source
const BufferTypeEglWindow = 0
View Source
const BufferTypeShm = 1
View Source
const CursorBlank = 16
View Source
const CursorBottom = 2
View Source
const CursorBottomLeft = 0
View Source
const CursorBottomRight = 1
View Source
const CursorDefault = 100
View Source
const CursorDndCopy = 14
View Source
const CursorDndForbidden = 15
View Source
const CursorDndMove = 13
View Source
const CursorDragging = 3
View Source
const CursorHand1 = 11
View Source
const CursorIbeam = 10
View Source
const CursorLeft = 5
View Source
const CursorLeftPtr = 4
View Source
const CursorRight = 6
View Source
const CursorTop = 9
View Source
const CursorTopLeft = 7
View Source
const CursorTopRight = 8
View Source
const CursorUnset = 101
View Source
const CursorWatch = 12
View Source
const FrameButtonClose = 0x1
View Source
const FrameButtonMaximize = 0x2
View Source
const FrameButtonMinimize = 0x4
View Source
const FrameButtonNone = 0
View Source
const FrameFlagActive = 0x1
View Source
const FrameFlagMaximized = 0x2
View Source
const FrameStatusClose = 0x8
View Source
const FrameStatusMaximize = 0x4
View Source
const FrameStatusMenu = 0x10
View Source
const FrameStatusMinimize = 0x2
View Source
const FrameStatusMove = 0x40
View Source
const FrameStatusNone = 0
View Source
const FrameStatusRepaint = 0x1
View Source
const FrameStatusResize = 0x20
View Source
const MaxLeaves = 3
View Source
const PreferredFormatNone = 0
View Source
const PreferredFormatRgb565 = 1
View Source
const SurfaceHintResize = 0x10
View Source
const SurfaceHintRgb565 = 0x100
View Source
const SurfaceOpaque = 0x01
View Source
const SurfaceShm = 0x02
View Source
const ZwpPointerConstraintsV1Version = 1
View Source
const ZwpRelativePointerManagerV1Version = 1

Variables

This section is empty.

Functions

func DisplayRun

func DisplayRun(Display *Display)

func SurfaceEnter

func SurfaceEnter(wlSurface *wl.Surface, wlOutput *wl.Output)

func SurfaceLeave

func SurfaceLeave(wlSurface *wl.Surface, wlOutput *wl.Output)

Types

type CloseHandler

type CloseHandler interface {
	Close()
}

type DataHandler

type DataHandler func(*Window, *Input, float32, float32, []string, *Window, WidgetHandler)

type DataSource

type DataSource struct {
	CopyBuffer string
	// contains filtered or unexported fields
}

func (*DataSource) AddListener

func (ds *DataSource) AddListener(l wlclient.DataSourceListener)

func (*DataSource) Offer

func (ds *DataSource) Offer(str string)

func (*DataSource) RemoveListener

func (ds *DataSource) RemoveListener(l wlclient.DataSourceListener)

type Display

type Display struct {
	Display *wl.Display
	// contains filtered or unexported fields
}

func DisplayCreate

func DisplayCreate(argv []string) (d *Display, e error)

line 6237

func (*Display) CreateDataSource

func (d *Display) CreateDataSource() (*DataSource, error)

func (*Display) Destroy

func (d *Display) Destroy()

func (*Display) Exit

func (d *Display) Exit()

func (*Display) GetSerial

func (d *Display) GetSerial() uint32

func (*Display) HandleRegistryGlobal

func (d *Display) HandleRegistryGlobal(e wl.RegistryGlobalEvent)

func (*Display) HandleRegistryGlobalRemove

func (d *Display) HandleRegistryGlobalRemove(e wl.RegistryGlobalRemoveEvent)

func (*Display) HandleShmFormat

func (d *Display) HandleShmFormat(e wl.ShmFormatEvent)

func (*Display) HandleWmBasePing

func (d *Display) HandleWmBasePing(ev zxdg.WmBasePingEvent)

func (*Display) RegistryGlobal

func (d *Display) RegistryGlobal(registry *wl.Registry, id uint32, iface string, version uint32)

func (*Display) RegistryGlobalRemove

func (d *Display) RegistryGlobalRemove(wlRegistry *wl.Registry, name uint32)

func (*Display) SetGlobalHandler

func (d *Display) SetGlobalHandler(gh GlobalHandler)

func (*Display) SetSeatHandler

func (d *Display) SetSeatHandler(h SeatHandler)

func (*Display) SetUserData

func (d *Display) SetUserData(data interface{})

func (*Display) ShellPing

func (d *Display) ShellPing(shell *zxdg.WmBase, serial uint32)

func (*Display) ShmFormat

func (d *Display) ShmFormat(wlShm *wl.Shm, format uint32)

type FullscreenHandler

type FullscreenHandler interface {
	Fullscreen(*Window, WidgetHandler)
}

type GlobalHandler

type GlobalHandler interface {
	HandleGlobal(d *Display, id uint32, iface string, version uint32, data interface{})
}

type Input

type Input struct {
	Display *Display
	// contains filtered or unexported fields
}

func (*Input) CallbackDone

func (input *Input) CallbackDone(wlCallback *wl.Callback, callbackData uint32)

func (*Input) Destroy

func (input *Input) Destroy()

func (*Input) DeviceSetSelection

func (input *Input) DeviceSetSelection(src *DataSource, serial uint32)

func (*Input) GetModifiers

func (input *Input) GetModifiers() ModType

func (*Input) GetRune

func (input *Input) GetRune(sym *uint32, _ uint32) (r rune)

This gets the UTF32 rune from the key sym ("notUnicode")

func (*Input) GetUtf8

func (input *Input) GetUtf8() []byte

This gets the compose UTF8 string from input

func (*Input) HandleCallbackDone

func (input *Input) HandleCallbackDone(ev wl.CallbackDoneEvent)

func (*Input) HandleDataDeviceDataOffer

func (input *Input) HandleDataDeviceDataOffer(ev wl.DataDeviceDataOfferEvent)

func (*Input) HandleDataDeviceDrop

func (input *Input) HandleDataDeviceDrop(ev wl.DataDeviceDropEvent)

func (*Input) HandleDataDeviceEnter

func (input *Input) HandleDataDeviceEnter(ev wl.DataDeviceEnterEvent)

func (*Input) HandleDataDeviceLeave

func (input *Input) HandleDataDeviceLeave(ev wl.DataDeviceLeaveEvent)

func (*Input) HandleDataDeviceMotion

func (input *Input) HandleDataDeviceMotion(ev wl.DataDeviceMotionEvent)

func (*Input) HandleDataDeviceSelection

func (input *Input) HandleDataDeviceSelection(ev wl.DataDeviceSelectionEvent)

func (*Input) HandleKeyboardEnter

func (input *Input) HandleKeyboardEnter(e wl.KeyboardEnterEvent)

func (*Input) HandleKeyboardKey

func (input *Input) HandleKeyboardKey(e wl.KeyboardKeyEvent)

func (*Input) HandleKeyboardKeymap

func (input *Input) HandleKeyboardKeymap(e wl.KeyboardKeymapEvent)

func (*Input) HandleKeyboardLeave

func (input *Input) HandleKeyboardLeave(e wl.KeyboardLeaveEvent)

func (*Input) HandleKeyboardModifiers

func (input *Input) HandleKeyboardModifiers(e wl.KeyboardModifiersEvent)

func (*Input) HandleKeyboardRepeatInfo

func (input *Input) HandleKeyboardRepeatInfo(e wl.KeyboardRepeatInfoEvent)

func (*Input) HandlePointerAxis

func (input *Input) HandlePointerAxis(ev wl.PointerAxisEvent)

func (*Input) HandlePointerAxisDiscrete

func (input *Input) HandlePointerAxisDiscrete(ev wl.PointerAxisDiscreteEvent)

func (*Input) HandlePointerAxisSource

func (input *Input) HandlePointerAxisSource(ev wl.PointerAxisSourceEvent)

func (*Input) HandlePointerAxisStop

func (input *Input) HandlePointerAxisStop(ev wl.PointerAxisStopEvent)

func (*Input) HandlePointerButton

func (input *Input) HandlePointerButton(ev wl.PointerButtonEvent)

func (*Input) HandlePointerEnter

func (input *Input) HandlePointerEnter(ev wl.PointerEnterEvent)

func (*Input) HandlePointerFrame

func (input *Input) HandlePointerFrame(ev wl.PointerFrameEvent)

func (*Input) HandlePointerLeave

func (input *Input) HandlePointerLeave(ev wl.PointerLeaveEvent)

func (*Input) HandlePointerMotion

func (input *Input) HandlePointerMotion(ev wl.PointerMotionEvent)

func (*Input) HandleSeatCapabilities

func (input *Input) HandleSeatCapabilities(ev wl.SeatCapabilitiesEvent)

func (*Input) HandleSeatName

func (input *Input) HandleSeatName(ev wl.SeatNameEvent)

func (*Input) HandleTouchCancel

func (input *Input) HandleTouchCancel(e wl.TouchCancelEvent)

func (*Input) HandleTouchDown

func (input *Input) HandleTouchDown(e wl.TouchDownEvent)

func (*Input) HandleTouchFrame

func (input *Input) HandleTouchFrame(e wl.TouchFrameEvent)

func (*Input) HandleTouchMotion

func (input *Input) HandleTouchMotion(e wl.TouchMotionEvent)

func (*Input) HandleTouchOrientation

func (input *Input) HandleTouchOrientation(e wl.TouchOrientationEvent)

func (*Input) HandleTouchShape

func (input *Input) HandleTouchShape(e wl.TouchShapeEvent)

func (*Input) HandleTouchUp

func (input *Input) HandleTouchUp(e wl.TouchUpEvent)

func (*Input) PointerAxis

func (input *Input) PointerAxis(wlPointer *wl.Pointer, time uint32, axis uint32, value float32)

func (*Input) PointerAxisDiscrete

func (input *Input) PointerAxisDiscrete(wlPointer *wl.Pointer, axis uint32, discrete int32)

func (*Input) PointerAxisSource

func (input *Input) PointerAxisSource(wlPointer *wl.Pointer, axisSource uint32)

func (*Input) PointerAxisStop

func (input *Input) PointerAxisStop(wlPointer *wl.Pointer, time uint32, axis uint32)

func (*Input) PointerButton

func (input *Input) PointerButton(
	wlPointer *wl.Pointer,
	serial uint32,
	time uint32,
	button uint32,
	stateW uint32,
)

func (*Input) PointerEnter

func (input *Input) PointerEnter(
	wlPointer *wl.Pointer,
	serial uint32,
	surface *wl.Surface,
	sx float32,
	sy float32,
)

func (*Input) PointerFrame

func (input *Input) PointerFrame(wlPointer *wl.Pointer)

func (*Input) PointerLeave

func (input *Input) PointerLeave(wlPointer *wl.Pointer, serial uint32, wlSurface *wl.Surface)

func (*Input) PointerMotion

func (input *Input) PointerMotion(
	wlPointer *wl.Pointer,
	time uint32,
	surfaceX float32,
	surfaceY float32,
)

func (*Input) ReceiveSelectionData

func (input *Input) ReceiveSelectionData(mimeType string, function io.WriteCloser) error

func (*Input) SeatCapabilities

func (input *Input) SeatCapabilities(seat *wl.Seat, caps uint32)

func (*Input) SeatName

func (input *Input) SeatName(wlSeat *wl.Seat, name string)

type KeyboardHandler

type KeyboardHandler interface {
	Key(
		window *Window,
		input *Input,
		time uint32,
		key uint32,
		notUnicode uint32,
		state wl.KeyboardKeyState,
		data WidgetHandler,
	)
	Focus(window *Window, device *Input)
}

type ModType

type ModType uint8

ModType is the type of Mod Masks

const ModAltMask ModType = 0x02

ModAltMask is the Alt modifier mask - provided for convenience only

const ModControlMask ModType = 0x04

ModControlMask is the Control modifier mask - provided for convenience only

const ModShiftMask ModType = 0x01

ModShiftMask is the Shift modifier mask - provided for convenience only

type Popup struct {
	Popup *zxdg.Popup

	Display *Display
	// contains filtered or unexported fields
}

func (*Popup) BufferRelease added in v0.1.2

func (w *Popup) BufferRelease(buffer *wl.Buffer)

func (*Popup) Destroy added in v0.1.2

func (w *Popup) Destroy()

func (*Popup) HandleBufferRelease added in v0.1.2

func (w *Popup) HandleBufferRelease(ev wl.BufferReleaseEvent)

func (*Popup) HandleCallbackDone added in v0.1.2

func (w *Popup) HandleCallbackDone(ev wl.CallbackDoneEvent)

func (*Popup) HandlePopupConfigure added in v0.1.2

func (w *Popup) HandlePopupConfigure(ev zxdg.PopupConfigureEvent)

func (*Popup) HandlePopupPopupDone added in v0.1.2

func (w *Popup) HandlePopupPopupDone(ev zxdg.PopupPopupDoneEvent)

func (*Popup) HandleSurfaceConfigure added in v0.1.2

func (w *Popup) HandleSurfaceConfigure(ev zxdg.SurfaceConfigureEvent)

func (*Popup) PopupConfigure added in v0.1.2

func (w *Popup) PopupConfigure(x, y, width, height int32)

func (*Popup) PopupGetSurface added in v0.1.2

func (p *Popup) PopupGetSurface() cairo.Surface

func (*Popup) PopupPopupDone added in v0.1.2

func (w *Popup) PopupPopupDone()

func (*Popup) SetPopupHandler added in v0.2.0

func (p *Popup) SetPopupHandler(ph Popuper)

func (*Popup) SurfaceConfigure added in v0.1.2

func (w *Popup) SurfaceConfigure(serial uint32)

type Popuper added in v0.1.2

type Popuper interface {
	Render(cairo.Surface, uint32)
	Done()
	Configure() *Widget
}

type Rectangle

type Rectangle struct {
	X      int32
	Y      int32
	Width  int32
	Height int32
}

type ResizeHandler

type ResizeHandler interface {
	MinimumSize() (int32, int32)
}

type SeatHandler

type SeatHandler interface {
	Capabilities(i *Input, seat *wl.Seat, caps uint32)
	Name(i *Input, seat *wl.Seat, name string)
}

type Widget

type Widget struct {
	Window *Window
	// contains filtered or unexported fields
}

func (*Widget) AddWidget

func (parent *Widget) AddWidget(data WidgetHandler) *Widget

func (*Widget) Destroy

func (parent *Widget) Destroy()

func (*Widget) GetAllocation

func (widget *Widget) GetAllocation() Rectangle

func (*Widget) ScheduleRedraw

func (parent *Widget) ScheduleRedraw()

func (*Widget) ScheduleResize

func (parent *Widget) ScheduleResize(width int32, height int32)

func (*Widget) SetAllocation

func (Widget *Widget) SetAllocation(x int32, y int32, width int32, height int32)

func (*Widget) SetUserDataWidgetHandler added in v0.2.0

func (w *Widget) SetUserDataWidgetHandler(wh WidgetHandler)

func (*Widget) WidgetGetLastTime

func (parent *Widget) WidgetGetLastTime() uint32

line 1887

type WidgetHandler

type WidgetHandler interface {
	Resize(Widget *Widget, width int32, height int32, pwidth int32, pheight int32)
	Redraw(Widget *Widget)
	Enter(Widget *Widget, Input *Input, x float32, y float32)
	Leave(Widget *Widget, Input *Input)
	Motion(Widget *Widget, Input *Input, time uint32, x float32, y float32) int
	Button(
		Widget *Widget,
		Input *Input,
		time uint32,
		button uint32,
		state wl.PointerButtonState,
		data WidgetHandler,
	)
	TouchUp(Widget *Widget, Input *Input, serial uint32, time uint32, id int32)
	TouchDown(
		Widget *Widget,
		Input *Input,
		serial uint32,
		time uint32,
		id int32,
		x float32,
		y float32,
	)
	TouchMotion(Widget *Widget, Input *Input, time uint32, id int32, x float32, y float32)
	TouchFrame(Widget *Widget, Input *Input)
	TouchCancel(Widget *Widget, width int32, height int32)
	Axis(Widget *Widget, Input *Input, time uint32, axis uint32, value float32)
	AxisSource(Widget *Widget, Input *Input, source uint32)
	AxisStop(Widget *Widget, Input *Input, time uint32, axis uint32)
	AxisDiscrete(Widget *Widget, Input *Input, axis uint32, discrete int32)
	PointerFrame(Widget *Widget, Input *Input)
}

type Window

type Window struct {
	Display *Display

	Userdata WidgetHandler
	// contains filtered or unexported fields
}

func Create

func Create(Display *Display) *Window

func (*Window) AddPopupWidget added in v0.1.2

func (Window *Window) AddPopupWidget(p *Popup, data WidgetHandler) *Widget

func (*Window) AddWidget

func (Window *Window) AddWidget(data WidgetHandler) *Widget

func (*Window) CreatePopup added in v0.1.2

func (w *Window) CreatePopup(seat *wl.Seat, clickSerial, width, height, x, y uint32) *Popup

func (*Window) Destroy

func (Window *Window) Destroy()

func (*Window) FrameCreate

func (Window *Window) FrameCreate(data WidgetHandler) *Widget

func (*Window) HandleSurfaceConfigure

func (Window *Window) HandleSurfaceConfigure(ev zxdg.SurfaceConfigureEvent)

func (*Window) HandleToplevelClose

func (Window *Window) HandleToplevelClose(ev zxdg.ToplevelCloseEvent)

func (*Window) HandleToplevelConfigure

func (Window *Window) HandleToplevelConfigure(ev zxdg.ToplevelConfigureEvent)

func (*Window) InhibitRedraw

func (Window *Window) InhibitRedraw()

func (*Window) Run

func (Window *Window) Run(events uint32)

This is the alternative to idle_redraw line 4617

func (*Window) ScheduleRedraw

func (Window *Window) ScheduleRedraw()

line 4636

func (*Window) ScheduleResize

func (Window *Window) ScheduleResize(width int32, height int32)

func (*Window) SetBufferType

func (Window *Window) SetBufferType(t int32)

line 5592

func (*Window) SetCloseHandler

func (Window *Window) SetCloseHandler(handler CloseHandler)

func (*Window) SetDataHandler

func (Window *Window) SetDataHandler(window *Window, handler DataHandler)

func (*Window) SetFullscreen

func (window *Window) SetFullscreen(fullscreen bool) error

func (*Window) SetFullscreenHandler

func (Window *Window) SetFullscreenHandler(handler FullscreenHandler)

func (*Window) SetKeyboardHandler

func (Window *Window) SetKeyboardHandler(handler KeyboardHandler)

func (*Window) SetMaximized

func (Window *Window) SetMaximized(maximized bool) error

func (*Window) SetMinimized

func (Window *Window) SetMinimized() error

func (*Window) SetTitle

func (Window *Window) SetTitle(title string)

line 4793

func (*Window) SurfaceConfigure

func (Window *Window) SurfaceConfigure(zxdgSurfaceV6 *zxdg.Surface, serial uint32)

func (*Window) ToggleMaximized

func (Window *Window) ToggleMaximized() error

func (*Window) ToplevelClose

func (Window *Window) ToplevelClose(zxdgToplevelV6 *zxdg.Toplevel)

func (*Window) ToplevelConfigure

func (Window *Window) ToplevelConfigure(
	zxdgToplevelV6 *zxdg.Toplevel,
	width int32,
	height int32,
	states []int32,
)

func (*Window) UninhibitRedraw

func (Window *Window) UninhibitRedraw()

func (*Window) WindowGetSurface

func (Window *Window) WindowGetSurface() cairo.Surface

Jump to

Keyboard shortcuts

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