avyos.dev/pkg/graphics/backend/display
package displaybackend
Overview
No package-level documentation is provided.
| Export Group | Count |
|---|---|
| Constants | 0 |
| Variables | 0 |
| Functions | 0 |
| Types | 2 |
Types
Backend
type Backend struct {
// contains filtered or unexported fields
}Backend implements the display backend and input handler interfaces using the custom display protocol client.
Functions
New
func New() *BackendNew creates a display backend with default 800x600 size.
Methods
Buffer
func (b *Backend) Buffer() *core.BufferBuffer returns the shared memory pixel buffer.
Close
func (b *Backend) Close() errorClose stops the event loop and disconnects.
ClosePopup
func (b *Backend) ClosePopup(p *Popup)ClosePopup destroys a popup window. Safe to call multiple times.
Flush
func (b *Backend) Flush() errorFlush marks the entire window as damaged.
FlushRect
func (b *Backend) FlushRect(r image.Rectangle) errorFlushRect marks a region as damaged.
HasSystemCursor
func (b *Backend) HasSystemCursor() boolHasSystemCursor returns true since the server draws the cursor.
Info
func (b *Backend) Info() stringInfo returns backend information.
ListWindows
func (b *Backend) ListWindows() ([]display.WindowInfo, error)ListWindows returns current managed normal windows from the display server.
MousePosition
func (b *Backend) MousePosition() (int, int)MousePosition returns the last known pointer position.
Open
func (b *Backend) Open() errorOpen connects to the display server and creates a window or layer surface.
OpenPopup
func (b *Backend) OpenPopup(x, y, w, h int, content popupWidget, onClose func()) *PopupOpenPopup creates a popup window positioned relative to the main window. The content widget is rendered into the popup buffer and receives events. onClose is called when the popup is dismissed (e.g. click outside).
Poll
func (b *Backend) Poll() *gfxinput.EventPoll returns the next event or nil.
ReconfigureLayer
func (b *Backend) ReconfigureLayer(anchor uint32, exclusive int) errorReconfigureLayer updates anchor/exclusive for an already-open layer surface. The main layer surface is recreated in-place to apply new positioning.
RegisterShortcut
func (b *Backend) RegisterShortcut(shortcutID, windowID, scope uint32, key gfxinput.Key, modifiers gfxinput.Modifiers) errorRegisterShortcut registers a compositor shortcut for this client. Use ShortcutScopeGlobal for compositor-wide shortcuts and ShortcutScopeClient for shortcuts scoped to this client (optionally a specific window ID).
RegisterShortcutEx
func (b *Backend) RegisterShortcutEx(shortcutID, windowID, scope uint32, key gfxinput.Key, ch rune, modifiers gfxinput.Modifiers) errorRegisterShortcutEx registers a shortcut keyed either by gfxinput.Key, or by a printable rune when key is gfxinput.KeyNone.
Resize
func (b *Backend) Resize(width, height int) errorResize changes the main surface size at runtime. For layer surfaces this allows dynamic content-sized bars/docks.
SetLayer
func (b *Backend) SetLayer(layer, anchor uint32, exclusive int)SetLayer configures this backend as a layer surface. Call before Open(). Layer surfaces are anchored to screen edges and can reserve exclusive zones (e.g. 32px for a panel).
SetLayerOpaqueHint
func (b *Backend) SetLayerOpaqueHint(opaque bool)SetLayerOpaqueHint hints that the layer content is fully opaque.
SetScreenSize
func (b *Backend) SetScreenSize(_, _ int)SetScreenSize is a no-op for window-based backends.
SetSize
func (b *Backend) SetSize(width, height int)SetSize sets the window size (call before Open).
SetTitle
func (b *Backend) SetTitle(title string)SetTitle sets the window title (call before Open).
SetWindowState
func (b *Backend) SetWindowState(windowID, action uint32) errorSetWindowState updates a managed window state (minimize/maximize/restore/focus).
Size
func (b *Backend) Size() (int, int)Size returns the window dimensions.
Start
func (b *Backend) Start()Start begins the event loop goroutine.
UnregisterShortcut
func (b *Backend) UnregisterShortcut(shortcutID uint32) errorUnregisterShortcut removes a previously registered shortcut.
Popup
type Popup struct {
// contains filtered or unexported fields
}Popup represents a popup window managed by the display backend.
Methods
Redraw
func (p *Popup) Redraw()Redraw re-renders the popup widget into the popup buffer.